Vixen
dd8b0a81
csharp
public sealed class BlockoutKnife

doc 24 § P3's knife gesture: a path the pointer draws, previewed before it commits.

Read the guide page for this →

Remarks

§ P3 called the knife "the one row of the table left undone" and said what it needed: a kernel primitive — Knife — and a gesture round it. This is the gesture. It holds the points, snaps each one, previews the path, and turns the stroke into cuts; the arithmetic is all in the kernel, where a cube and an assertion can reach it.

⚠ Every point lands on a face's boundary, which is what makes the primitive usable at all. "Split this face between these two points" is only defined for points on its rim, so a click in the middle of a face has to become a click on its nearest edge. Corners and midpoints win inside a fraction of the edge's own length — § P3's "snapping to edges and midpoints" — and the fraction is relative because an absolute radius is a claim about how big the model is.

⚠ The stroke is one command and it is not applied a segment at a time. § P3: "a cut's new vertices renumber the face table, so the cut has to be a single command". Every segment becomes a KnifeCut and they all go into one call.

⚠ A segment across a face boundary produces a cut for both faces, and the kernel is the arbiter. A click on a shared edge belongs to the face on either side of it, and which one the picker happened to answer with is not something a designer chose; Knife refuses whichever of the two the segment does not actually cross, which is one rule about what is on a boundary rather than two.

Fields and properties (4)

  • public float SnapFraction

    How near a corner or a midpoint counts, as a fraction of the edge's own length.

  • public bool IsArmed

    Whether the tool is holding the pointer.

  • public IReadOnlyList<KnifePoint> Points

    The points placed so far, in order.

  • public KnifePoint? Hover

    Where the next point would go, or when the pointer is off the mesh.

Methods (6)

  • public bool Track(EditMesh mesh, in Matrix4x4 placement, Ray ray)

    Follows the pointer.

  • public bool Place()

    Places the point the pointer is over.

  • public void Cancel()

    Throws the stroke away.

  • public IReadOnlyList<KnifeCut> Cuts()

    The stroke as cuts, one per segment per face the segment could belong to.

  • public void Preview(GizmoDraw draw, in Matrix4x4 placement, Color4 placed, Color4 pending)

    Draws the stroke and the segment the pointer is dragging out of its last point.

  • public static KnifePoint? Resolve(EditMesh mesh, in Matrix4x4 placement, Ray ray, float fraction = 0.2)

    Where the pointer is on the mesh, snapped to the face's boundary.

Used by (2)

  • BlockoutKnifeTestsVixen.Editor.Blockout.Tests
  • BlockoutModeVixen.Editor.Blockout