Skip to content

editorGlobalsMeshHalfEdge

Class: MeshHalfEdge

A cycle of MeshHalfEdges defines outlines and holes of MeshSurfaces. Its direction is defined so that, if you're looking at a surface from above (and the normal points towards you) there is always "material" on the left side when going along the outline - meaning a CCW cycle (CW cycles for holes).

As we expect meshes to be two-manifold, an edge always connects exactly two surfaces. An edge is built by two MeshHalfEdge (one per surface) which are linked by their "twin" relationship.

Hierarchy

  • MeshHalfEdge

Index

Constructors

Properties

Methods

Constructors

constructor

+ new MeshHalfEdge(point: MeshPoint, uid: string): MeshHalfEdge

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:61

Parameters:

Name Type Default
point MeshPoint -
uid string PseudoRandomString.generate(10)

Returns: MeshHalfEdge

Properties

Private next

next: MeshHalfEdge

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:59


Private previous

previous: MeshHalfEdge

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:58


Private startPoint

startPoint: MeshPoint

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:56


Private surface

surface: MeshSurface

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:60


Private twin

twin: MeshHalfEdge

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:57


Private uid

uid: string

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:61

Methods

computeNormal

computeNormal(): Vector3‹›

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:289

Returns: Vector3‹›

the normal of the edge, in mesh-local coordinates. The normal lies in the surface's plane and is perpendicular to the edge's direction. It points "outwards" (to the "right" when walking along the cycle), away from the "material".


debugEdge

debugEdge(): string

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:387

Return a string with start and end point of this edge. For convenience here to directly call on the instance.

Returns: string


distanceToPoint

distanceToPoint(point: ReadonlyVector3): number

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:328

Parameters:

Name Type Description
point ReadonlyVector3 The point to get the distance to in mesh coordinates.

Returns: number


equals

equals(otherEdge: MeshHalfEdge, epsilon: number): boolean

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:309

Parameters:

Name Type Default Description
otherEdge MeshHalfEdge - -
epsilon number Config.get("modelLimits.maximumPositionEqualityDistance", null) the epsilon for which two vectors are considered the same

Returns: boolean

whether this and another edge have the same start and end point position


equalsUid

equalsUid(otherEdge: MeshHalfEdge): boolean

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:68

Parameters:

Name Type
otherEdge MeshHalfEdge

Returns: boolean


getCenter

getCenter(target: Vector3‹›): Vector3

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:297

Parameters:

Name Type Default Description
target Vector3‹› new Vector3() to avoid creating a new Vector3

Returns: Vector3

the middle of the startPoint of this edge and the startPoint of the next edge.


getDelta

getDelta(): Vector3

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:267

Start - end, not normalized.

Returns: Vector3


getDirection

getDirection(): Vector3

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:257

Returns: Vector3

the direction vector of the half edge, in mesh-local coordinates. It's normalized. Returns null if this edge is degenerated.


getEndPoint

getEndPoint(): MeshPoint | null

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:87

Returns: MeshPoint | null


getInterpolatedPosition

getInterpolatedPosition(alpha: number): Vector3

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:376

Parameters:

Name Type Description
alpha number Interpolation factor between 0: start Position 1: end Position

Returns: Vector3


getLength

getLength(): number

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:277

Returns: number

the length of the edge. If the edge has no next edge, return null.


getNext

getNext(): MeshHalfEdge

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:183

Returns: MeshHalfEdge

the next half edge in the cycle


getPoints

getPoints(): [MeshPoint, MeshPoint]

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:380

Returns: [MeshPoint, MeshPoint]


getPrevious

getPrevious(): MeshHalfEdge

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:147

Returns: MeshHalfEdge

the previous half edge in the cycle


getStartPoint

getStartPoint(): MeshPoint

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:83

Returns: MeshPoint

the origin of this half edge


getSurface

getSurface(): MeshSurface

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:219

Returns: MeshSurface

the surface associated to this half edge


getTwin

getTwin(): MeshHalfEdge

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:109

Returns: MeshHalfEdge

the twin edge, which is the edge sharing start and end point with this edge, but being on the other surface and pointing into the opposite direction.


getUid

getUid(): string

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:76

Returns: string


intersectPlane

intersectPlane(plane: Plane, epsilon: any): Vector3

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:358

Parameters:

Name Type Default Description
plane Plane - Plane in mesh coordinates
epsilon any Config.get("modelLimits.maximumPositionEqualityDistance", 0) -

Returns: Vector3

The intersectionPoint between the plane and the edge in mesh coordinates or undefined, if there is no intersection


pointsEqual

pointsEqual(startPoint: ReadonlyVector3, endPoint: ReadonlyVector3, directionRelevant: boolean): boolean

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:342

Check if the points which the edge connects equal to the provided points. this only works on valid meshes (so between the two points can only be one pair of edges)

Parameters:

Name Type Default Description
startPoint ReadonlyVector3 - the origin point of the edge
endPoint ReadonlyVector3 - the point the edge is pointing to
directionRelevant boolean true if this is false it the direction of the edge does not matter for the comparision

Returns: boolean


setNext

setNext(nextEdge: MeshHalfEdge): void

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:191

Updates the edge's next edge. Will update the next edge's previous edge, so one call suffices.

Parameters:

Name Type Description
nextEdge MeshHalfEdge -

Returns: void


setPrevious

setPrevious(previousEdge: MeshHalfEdge): void

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:155

Updates the edge's previous edge. Will update the previous edge's next edge, so one call suffices.

Parameters:

Name Type Description
previousEdge MeshHalfEdge -

Returns: void


setStartPoint

setStartPoint(newStartPoint: MeshPoint): void

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:91

Parameters:

Name Type
newStartPoint MeshPoint

Returns: void


setSurface

setSurface(newSurface: MeshSurface): void

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:227

Updates the associated surface of this half edge

Parameters:

Name Type Description
newSurface MeshSurface -

Returns: void


setTwin

setTwin(twinEdge: MeshHalfEdge): void

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:117

Updates the edge's twin. Will do so on the twin as well, so only one setTwin() call suffices for both edges.

Parameters:

Name Type Description
twinEdge MeshHalfEdge the new twin

Returns: void


setUid

setUid(uid: string): void

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:72

Parameters:

Name Type
uid string

Returns: void


traceCycle

traceCycle(): MeshHalfEdge[]

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:235

Traces next() until this half edge is reached again. Throws an error if no cycle was found or an edge was found twice before returning to this starting edge.

Returns: MeshHalfEdge[]


Static fromPoints

fromPoints(points: MeshPoint[], uids?: string[]): MeshHalfEdge[]

Defined in src/model/data/Concepts/Mesh/MeshHalfEdge.ts:29

Builds a closed cycle from the given points. Uses all points, even if the resulting edges are degenerated.

Parameters:

Name Type Description
points MeshPoint[] at least 3 points that will be formed into a cycle
uids? string[] the uids to use for the constructed cycle, in the same order

Returns: MeshHalfEdge[]