Skip to content

Feature: Curve-mesh intersection and cutting #6

@ZigaSajovic

Description

@ZigaSajovic

Given a sequence of points on a mesh, connecting them with straight segments doesn't produce a curve that lies on the surface. We need curves that actually follow the mesh.

Intersect module

Project a path onto the mesh surface:

// points may not be exactly on the surface due to numerics
auto surface_curve = tf::make_surface_curve(mesh.polygons(), path_points);

Points are projected onto the mesh first. New points are inserted where the path crosses mesh edges, so that every segment lies entirely within a face. A single mesh edge can have many crossings—naive approaches like scalar field cutting (how VTK does it) don't handle this.

Cut module

Once we have a surface curve, two operations:

Embed the curve into mesh topology (faces split along curve, curve becomes edges):

auto [result_mesh, labels] = tf::embedded_curve(mesh.polygons(), path_points);

Cut the mesh along the curve, classifying regions as inside/outside:

// closed curve defines inside/outside
auto [result_mesh, labels] = tf::cut_by_curve(mesh.polygons(), path_points);

// labels: 0 = outside, 1 = inside (relative to curve winding)

Similar pattern to embedded_isocurves and make_isobands.

Self-intersections

Surface curves often self-intersect after embedding. Should offer ear clipping to remove the loops—these are usually small unintended artifacts.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions