Appearance
Query: HalfEdge
Half-edge queries — walk and read a single BREP half-edge. A HalfEdgeHandle is minted by walking from a brep/face/edge/vertex handle; it is session-ephemeral and goes stale on undo/redo/re-topologize. Accessed via snaptrude.core.geom.query.halfedge.
The kind token is all-lowercase "halfedge" (no camelCase namespaces). Traversals (getNext/getPrev/getFlip) return null on a boundary or a malformed chain rather than throwing — reads never throw.
Every method takes a single positional HalfEdgeHandle argument.
Functions
getNext(halfEdge)
Get the next half-edge around the face loop.
- Parameters:
halfEdge:HalfEdgeHandle— The half-edge to walk from
- Returns:
HalfEdgeHandle | null— The next half-edge, ornullon a malformed chain - Throws:
HandleInvalidErrorifhalfEdgeis invalid, stale, or foreign
ts
const { face, halfedge } = snaptrude.core.geom.query;
// Walk the outer loop of a face
const start = await face.getHalfEdge(someFace);
let he = start;
do {
const vertex = await halfedge.getVertex(he);
// ...use vertex...
he = await halfedge.getNext(he);
} while (he !== null && he !== start);getPrev(halfEdge)
Get the previous half-edge around the face loop.
- Parameters:
halfEdge:HalfEdgeHandle— The half-edge to walk from
- Returns:
HalfEdgeHandle | null— The previous half-edge, ornullon a malformed chain - Throws:
HandleInvalidErrorifhalfEdgeis invalid, stale, or foreign
getFlip(halfEdge)
Get the flip (opposite) half-edge of the shared edge.
- Parameters:
halfEdge:HalfEdgeHandle— The half-edge to flip
- Returns:
HalfEdgeHandle | null— The flip half-edge, ornullon a boundary - Throws:
HandleInvalidErrorifhalfEdgeis invalid, stale, or foreign
getVertex(halfEdge)
Get the tail vertex of a half-edge.
- Parameters:
halfEdge:HalfEdgeHandle— The half-edge to read
- Returns:
VertexHandle— The tail vertex - Throws:
HandleInvalidErrorifhalfEdgeis invalid, stale, or foreign
getEdge(halfEdge)
Get the edge of a half-edge.
- Parameters:
halfEdge:HalfEdgeHandle— The half-edge to read
- Returns:
EdgeHandle— The owning edge - Throws:
HandleInvalidErrorifhalfEdgeis invalid, stale, or foreign
getFace(halfEdge)
Get the face of a half-edge.
- Parameters:
halfEdge:HalfEdgeHandle— The half-edge to read
- Returns:
FaceHandle— The owning face - Throws:
HandleInvalidErrorifhalfEdgeis invalid, stale, or foreign
isOnBoundary(halfEdge)
Test whether a half-edge lies on the brep boundary (has no flip).
- Parameters:
halfEdge:HalfEdgeHandle— The half-edge to test
- Returns:
boolean—trueif on the boundary, otherwisefalse - Throws:
HandleInvalidErrorifhalfEdgeis invalid, stale, or foreign
isForward(halfEdge)
Test whether a half-edge is the forward (primary) half-edge of its edge — i.e. edge.getHalfEdge() === thisHalfEdge.
- Parameters:
halfEdge:HalfEdgeHandle— The half-edge to test
- Returns:
boolean—trueif forward, otherwisefalse - Throws:
HandleInvalidErrorifhalfEdgeis invalid, stale, or foreign
ts
const { halfedge } = snaptrude.core.geom.query;
const onBoundary = await halfedge.isOnBoundary(he);
const forward = await halfedge.isForward(he);Errors
Failed calls reject with a typed PluginError — see Error Handling. Conditions specific to this namespace:
| Code | Thrown by | When | details |
|---|---|---|---|
HANDLE_INVALID | all methods | The half-edge handle is invalid, foreign, or stale (undo/redo/re-topologize invalidates it) | — |
Beyond handle resolution these reads never throw — getNext/getPrev/getFlip return null on a boundary or malformed chain, as noted above.