Vixen
02b45cc4
csharp
public static class MeshOperations

Doc 24's geometry verbs, as functions over an EditMesh.

Read the guide page for this →

Remarks

Doc 24's P3. Extrude, inset, bevel, loop cut, bridge, weld, dissolve, subdivide, fill and flip — the inventory's Geometry table, as arithmetic rather than as gestures. The editor's half is which faces are selected and what a drag's distance is; the part that can be wrong is all here, where a cube and an assertion can reach it.

⚠ Every one of them rebuilds the face table and leaves the positions alone. A position index is what a selection holds, what an undo entry records and what a drag in flight is writing to; renumbering the positions under a running gesture is the defect doc 24's D3 is written to prevent. Faces are renumbered freely, which is exactly why a topology change drops the element selection — see MeshEdit.Reconcile.

⚠ Positions no face uses are left behind rather than compacted. Validate reports them as orphans and Compact is what removes them, run by the caller at a moment when nothing holds an index — which is after a gesture rather than inside one.

⚠ Each returns the faces it made, and none of them touches a selection. A verb that moved the selection to its own result could not be composed: "extrude, then inset the result" and "extrude, then inset what I had" are both things a designer does, and only the caller knows which.

Fields and properties (2)

  • public const float DefaultMergeTolerance

    How near two positions must be for a weld to merge them, as a fraction of the bounds.

  • public const float DefaultStitchTolerance

    How far off an edge a position may be and still be taken to be on it.

Methods (17)

  • public static IReadOnlyList<int> Extrude(EditMesh mesh, IReadOnlyCollection<int> faces, float distance, bool individually = false)

    Pulls a set of faces out along their normal, walling in the gap behind them.

  • public static IReadOnlyList<int> ExtrudeAlong(EditMesh mesh, IReadOnlyCollection<int> faces, Vector3 offset)

    Pulls a set of faces along a direction rather than along their own normal.

  • public static IReadOnlyList<int> Inset(EditMesh mesh, IReadOnlyCollection<int> faces, float amount, bool individually = false)

    Shrinks a set of faces towards their own centre, walling in the ring left behind.

  • public static IReadOnlyList<int> Bevel(EditMesh mesh, IReadOnlyCollection<int> edges, float width, int segments, out int unresolved)

    Replaces each edge with a strip of faces, cutting the corner off.

  • public static IReadOnlyList<int> LoopCut(EditMesh mesh, int edge, int cuts = 1, float slide = 0.5)

    Cuts a ring of quads in half, across the ring the edge is part of.

  • public static IReadOnlyList<int> Subdivide(EditMesh mesh, IReadOnlyCollection<int> faces, int count = 1)

    Splits each face into one face per corner, round a new middle.

  • public static IReadOnlyList<int> Bridge(EditMesh mesh, int first, int second)

    Joins two faces with a tube, removing both.

  • public static int FillHole(EditMesh mesh, int edge)

    Puts a face across a hole.

  • public static int Flip(EditMesh mesh, IReadOnlyCollection<int>? faces = null)

    Turns a set of faces inside out.

  • public static int Weld(EditMesh mesh, IReadOnlyCollection<int> positions, Vector3? at = null)

    Merges a set of positions into one.

  • public static int MergeByDistance(EditMesh mesh, float distance)

    Merges every pair of positions nearer than a distance.

  • public static int Dissolve(EditMesh mesh, IReadOnlyCollection<int> edges)

    Removes an edge and keeps the surface, merging the faces either side of it.

  • public static int Delete(EditMesh mesh, IReadOnlyCollection<int> faces)

    Removes faces, leaving a hole.

  • public static int Stitch(EditMesh mesh, float tolerance = 1E-05)

    Inserts every position that lies on an edge into the face that owns it.

  • public static int[] Compact(EditMesh mesh)

    Removes positions no face uses, and says where the rest went.

  • public static EditMesh? Detach(EditMesh mesh, IReadOnlyCollection<int> faces, bool keep = false)

    Takes a set of faces out of a mesh and returns them as a mesh of their own.

  • public static IReadOnlyList<int> Append(EditMesh mesh, EditMesh other, Matrix4x4 transform)

    Puts one mesh's geometry into another, offset by a transform.

Used by (7)

  • MeshBooleanVixen.Geometry
  • MeshOperationTestsVixen.Geometry.Tests
  • MeshPropertyTestsVixen.Geometry.Tests
  • MeshSurfaceTestsVixen.Geometry.Tests
  • BlockoutCreateVixen.Editor.Blockout
  • BlockoutGeometryVixen.Editor.Blockout
  • SceneCsgVixen.Editor.SceneView