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 Delauney Triangulation of 2D point set p.

Parameters
  • p (numpy float array of shape (N, 2) – the x,y coordinates of the points

  • algorithm (string, optional) – selects which algorithm to use; current options: [‘simple’, ‘scipy’]; if None, the current best algorithm is selected

  • plot_fn (function of form 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 triangle

  • progress_fn (function of form 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 x

  • container_size_factor (float, default 100.0) – the larger this number, the more likely the resulting triangulation is to be convex; reduce to 1.0 to allow slight concavities

  • return_hull (boolean, default False) – 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 Delauney 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