Voronoi diagram/J/Delaunay triangulation: Difference between revisions

m
updated a lying comment.
m (updated a lying comment.)
 
(One intermediate revision by the same user not shown)
Line 112:
demo_delaunay=: [: plot_tria_mesh [: triangulate ?.random_points
 
NB. return theboxed nubVoronoi ofpolygons thedetermined listfrom ofDelaunay segments connectingmesh.
NB. circle centers for adjacent delaunay triangles.
voronoi=: 3 : 0 NB. voronoi nodes NB. 2 dimensional
'E N'=. 1 triangulate y
Line 137 ⟶ 136:
crossproduct=: 1 |. ([ * 1 |. ]) - ] * 1 |. [ NB. j forum
wind=: {:@:crossproduct&(,&0) NB. positive if CCL
smallest_by_coordinate=: 4 : '(#~ (= <./)@:(x&{"1)) y'
 
convex_hull=: 3 : 0 NB. Graham Scan y are the points
y=. ~. y NB. Implements Robert Sedgewick pseudo-code
N=. # y
start=. <, > smallest_by_coordinate&.>/ 0 ; 1 ; y
if. start -.@:e. y do. start=. start ,@:(=&({:"1) # ]) y end.
y=. y -. start
y=. y ([ /: angle@:-"1) start
Anonymous user