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.

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.

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 whether the triangulation is done

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.

Converts the current state of the triangulation to an SVG. When debug is true, includes the upper hull and to-be-fixed edges; otherwise, just shows points, triangles, and fixed edges from the half-edge graph.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.