svg_path/csg

ArrangementGraph-based operations on SVG paths.

Binary operations interpret both operands with one fill rule. The unary monotone_contours operation instead preserves the complete signed integer winding field and therefore takes no fill rule.

Types

The stage at which classified boundary topology became inconsistent.

pub type BoundaryTopologyFailure {
  SectorMismatch
  TraceFailed
}

Constructors

  • SectorMismatch

    A boundary ray did not have the required filled-sector successor.

  • TraceFailed

    Linked boundary edges did not form a complete closed cycle.

A CSG output together with the exact arrangement used to derive it.

Returning the build makes normalization and graph refinement visible to the caller: the result path follows the arrangement’s geometry rather than silently claiming the original input geometry as its source of truth.

pub type CsgResult {
  CsgResult(
    path: svg_path.Path,
    build: arrangement_graph.ArrangementGraphBuild,
  )
}

Constructors

  • Arguments

    path

    The reconstructed result path for the requested operation.

    build

    The arrangement graph and source-ordered normalized input paths used to classify and reconstruct path.

pub type Error {
  ArrangementError(arrangement_graph.Error)
  PathError(svg_path.Error)
  InternalBoundaryTopologyError(
    vertex: Int,
    reason: BoundaryTopologyFailure,
  )
}

Constructors

  • ArrangementError(arrangement_graph.Error)

    Arrangement construction or validation failed.

  • PathError(svg_path.Error)

    An underlying path operation failed.

  • InternalBoundaryTopologyError(
      vertex: Int,
      reason: BoundaryTopologyFailure,
    )

    Boundary classification produced topology that could not be reconstructed. This indicates an internal consistency failure rather than invalid caller syntax.

Numeric options used while constructing and classifying an arrangement.

pub type Options {
  Options(tolerance: Float, minimum_chord: Float)
}

Constructors

  • Options(tolerance: Float, minimum_chord: Float)

Values

pub fn default_options() -> Options

Return default ArrangementGraph CSG options.

pub fn difference(
  left: svg_path.Path,
  minus right: svg_path.Path,
  using fill_rule: svg_path.FillRule,
) -> Result(CsgResult, Error)

Return left minus right under using.

pub fn difference_with(
  left: svg_path.Path,
  minus right: svg_path.Path,
  using fill_rule: svg_path.FillRule,
  options options: Options,
) -> Result(CsgResult, Error)

Return left minus right using explicit arrangement options.

pub fn intersection(
  left: svg_path.Path,
  right: svg_path.Path,
  using fill_rule: svg_path.FillRule,
) -> Result(CsgResult, Error)

Return the Boolean intersection of two paths under using.

pub fn intersection_with(
  left: svg_path.Path,
  right: svg_path.Path,
  using fill_rule: svg_path.FillRule,
  options options: Options,
) -> Result(CsgResult, Error)

Return the Boolean intersection using explicit arrangement options.

pub fn monotone_contours(
  path: svg_path.Path,
) -> Result(CsgResult, Error)

Return nested or disjoint unit-level contours with the same signed winding field as path.

pub fn monotone_contours_with(
  path: svg_path.Path,
  options options: Options,
) -> Result(CsgResult, Error)

Return monotone contours using explicit arrangement options.

pub fn symmetric_difference(
  left: svg_path.Path,
  right: svg_path.Path,
  using fill_rule: svg_path.FillRule,
) -> Result(CsgResult, Error)

Return the Boolean symmetric difference of two paths under using.

pub fn symmetric_difference_with(
  left: svg_path.Path,
  right: svg_path.Path,
  using fill_rule: svg_path.FillRule,
  options options: Options,
) -> Result(CsgResult, Error)

Return the Boolean symmetric difference using explicit arrangement options.

pub fn union(
  left: svg_path.Path,
  right: svg_path.Path,
  using fill_rule: svg_path.FillRule,
) -> Result(CsgResult, Error)

Return the Boolean union of two paths under using.

pub fn union_with(
  left: svg_path.Path,
  right: svg_path.Path,
  using fill_rule: svg_path.FillRule,
  options options: Options,
) -> Result(CsgResult, Error)

Return the Boolean union using explicit arrangement options.

Search Document