resqpy.olio.triangulation.dt
- resqpy.olio.triangulation.dt(p, algorithm='scipy', plot_fn=None, progress_fn=None, container_size_factor=100.0, return_hull=False)[source]
Returns the Delaunay Triangulation of 2D point set p.
- Parameters:
p (
numpy float arrayofshape (N,2) – the x,y coordinates of the pointsalgorithm (
string, optional) – selects which algorithm to use; current options: [‘simple’, ‘scipy’]; if None, the current best algorithm is selectedplot_fn (
functionofform f(p,t), optional) – if present, this function is called each time the algorithm feels it is worth refreshing a plot of the progress; p is a copy of the point set, depending on the algorithm with 3 extra points added to form an enveloping triangleprogress_fn (
functionofform f(x), optional) – if present, this function is called at regulat intervals by the algorithm, passing increasing values in the range 0.0 to 1.0 as xcontainer_size_factor (
float, default100.0) – the larger this number, the more likely the resulting triangulation is to be convex; reduce to 1.0 to allow slight concavitiesreturn_hull (
boolean, defaultFalse) – if True, a pair is returned with the second item being a clockwise ordered list of indices into p identifying the points on the boundary of the returned triangulation
- Returns:
- numpy int array of shape (M, 3) - being the indices into the first axis of p of the 3 points
per triangle in the Delaunay Triangulation - and if return_hull is True, another int array of shape (B,) - being indices into p of the clockwise ordered points on the boundary of the triangulation
Notes
the plot_fn, progress_fn and container_size_factor arguments are only used by the ‘simple’ algorithm; if points p are 3D, the projection onto the xy plane is used for the triangulation