Struct cdt::Triangulation [−][src]
pub struct Triangulation { /* fields omitted */ }
Expand description
This struct
contains all of the data needed to generate a (constrained)
Delaunay triangulation of a set of input points and edges. It is a
low-level API; consider using the module-level functions if you don’t
need total control.
Implementations
Builds a complete triangulation from the given points
Errors
This may return Error::EmptyInput
, Error::InvalidInput
, or
Error::CannotInitialize
if the input is invalid.
Builds a complete triangulation from the given points and edges. The points are a flat array of positions in 2D spaces; edges are undirected and expressed as indexes into the points list.
Errors
This may return Error::EmptyInput
, Error::InvalidInput
,
Error::InvalidEdge
, or Error::CannotInitialize
if the input is
invalid.
pub fn build_from_contours<V>(
points: &[(f64, f64)],
contours: &[V]
) -> Result<Triangulation, Error> where
&'b V: IntoIterator<Item = &'b usize>,
pub fn build_from_contours<V>(
points: &[(f64, f64)],
contours: &[V]
) -> Result<Triangulation, Error> where
&'b V: IntoIterator<Item = &'b usize>,
Builds a complete triangulation from the given points and contours (which are represented as indexes into the points array).
Errors
This may return Error::EmptyInput
, Error::InvalidInput
,
Error::InvalidEdge
, Error::OpenContour
or
Error::CannotInitialize
if the input is invalid.
Constructs a new triangulation of the given points. The points are a
flat array of positions in 2D spaces; edges are undirected and expressed
as indexes into the points
list.
The triangulation is not actually run in this constructor; use
Triangulation::step
or Triangulation::run
to triangulate,
or Triangulation::build_with_edges
to get a complete triangulation
right away.
Errors
This may return Error::EmptyInput
, Error::InvalidInput
,
Error::InvalidEdge
, or Error::CannotInitialize
if the input is
invalid.
Constructs a new unconstrained triangulation
The triangulation is not actually run in this constructor; use
Triangulation::step
or Triangulation::run
to triangulate,
or Triangulation::build
to get a complete triangulation right away.
Errors
This may return Error::EmptyInput
, Error::InvalidInput
, or
Error::CannotInitialize
if the input is invalid.
pub fn new_from_contours<'a, V>(
pts: &[(f64, f64)],
contours: &[V]
) -> Result<Triangulation, Error> where
&'b V: IntoIterator<Item = &'b usize>,
pub fn new_from_contours<'a, V>(
pts: &[(f64, f64)],
contours: &[V]
) -> Result<Triangulation, Error> where
&'b V: IntoIterator<Item = &'b usize>,
Triangulates a set of contours, given as indexed paths into the point
list. Each contour must be closed (i.e. the last point in the contour
must equal the first point), otherwise Error::OpenContour
will be
returned.
The triangulation is not actually run in this constructor; use
Triangulation::step
or Triangulation::run
to triangulate,
or Triangulation::build_from_contours
to get a complete
triangulation right away.
Errors
This may return Error::EmptyInput
, Error::InvalidInput
,
Error::InvalidEdge
, Error::OpenContour
or
Error::CannotInitialize
if the input is invalid.
Runs the triangulation algorithm until completion
Errors
This may return Error::PointOnFixedEdge
, Error::NoMorePoints
,
or Error::CrossingFixedEdge
if those error conditions are met.
Checks that invariants of the algorithm are maintained. This is a slow operation and should only be used for debugging.
Panics
Panics if invariants are not correct
Advances the triangulation by one step.
Errors
This may return Error::PointOnFixedEdge
, Error::NoMorePoints
,
or Error::CrossingFixedEdge
if those error conditions are met.
Returns all of the resulting triangles, as indexes into the original
points
array from the constructor.
Checks whether the given point is inside or outside the triangulation. This is extremely inefficient, and should only be used for debugging or unit tests.
Writes the current state of the triangulation to an SVG file, without debug visualizations.
Writes the current state of the triangulation to an SVG file, including the upper hull as a debugging visualization.
Auto Trait Implementations
impl RefUnwindSafe for Triangulation
impl !Send for Triangulation
impl !Sync for Triangulation
impl Unpin for Triangulation
impl UnwindSafe for Triangulation