Skip to content

Instantly share code, notes, and snippets.


Yakir Luc Gagnon yakir12

View GitHub Profile
View MWE.jl
using DataDeps, JuliaDB
register(DataDep("MWEdata", "The data needed for the MWE", "", "5c19286fb4b39cddbc43708c98dc77a0766541b82cb1e462bc286286373ec813"))
cm = load(joinpath(datadep"MWEdata", "cm.jldb"))
cmg = groupby((coord = identity,), cm, :interval)
cmg[6].coord.t .-= cmg[6].coord.t[1] # ERROR: ReadOnlyMemoryError()
View Manifest.toml
deps = ["Compat", "LinearAlgebra"]
git-tree-sha1 = "8d59c3b1463b5e0ad05a3698167f85fac90e184d"
uuid = "621f4979-c628-5d54-868e-fcf4e3e8185c"
version = "0.3.2"
deps = ["ColorBrewer", "ColorTypes", "Colors", "Contour", "FileIO", "FixedPointNumbers", "FreeType", "FreeTypeAbstraction", "GeometryTypes", "ImageMagick", "IntervalSets", "LinearAlgebra", "Markdown", "Observables", "Packing", "PlotUtils", "Printf", "Random", "Serialization", "Showoff", "SignedDistanceFields", "StaticArrays", "Statistics", "UnicodeFun"]
git-tree-sha1 = "b47cc331607de0daa3d3e40ed77b61b36dd19c17"
repo-rev = "master"
View samplingSphericalTriangles.jl
# "unitize" a vector
normalize(x) = x/norm(x)
# the [x|y] function
normcomp(x,y) = normalize(x - dot(x,y)*y)
# find the dihedral angle at a vertice `o`
dihedral(a,o,b) = acos(dot(normalize(cross(o,a)),normalize(cross(o,b))))
# the vertices of the triangle in the xy-plane
A2 = Float64[.1,.0,-2]
B2 = Float64[2,-.1,-2]
C2 = Float64[1.5,.9,-2]
yakir12 / Question.m
Created Jul 28, 2015
Random 3D points uniformly distributed on an ellipse shaped window of a sphere
View Question.m
close all
clear all
n = 1000;
z = rand(n,1)*2-1;
t = rand(n,1)*2*pi;
x = sqrt(1. - z.*z).*cos(t);
y = sqrt(1. - z.*z).*sin(t);
You can’t perform that action at this time.