The main mesh type, stored as vertices and triangles. Contains methods to compute normals, curvatures, apparent ridges, etc.

Constructor

new()

New empty mesh

Variables

@:value([])Dt1q1:Array<Float> = []

"D_{t_1} q_1 - the derivative of max view-dependent curvature in the principal max view-dependent curvature direction." -- RTSC

@:value([])adjacentFaces:Array<Array<Int>> = []

neighboring faces for each vertex

bsphere:BSphere

bounding sphere of the mesh

bvh:BVHTree

bounding volume hierarchy

@:value([])cornerAreas:Array<Vec3> = []

corner area of each vertex

@:value([])curv1:Array<Float> = []

curvature on the first principle direction, per-vertex

@:value([])curv2:Array<Float> = []

curvature on the second principle direction, pre-vertex

@:value([])faces:Array<Face> = []

faces as array of triangles

featureSize:Float

"Used to make thresholds dimensionless" -- RTSC

@:value([])ndotv:Array<Float> = []

cosine of angle between normal and view direction

@:value([])normals:Array<Vec3> = []

vertex normals as array of vectors

@:value([])pdir1:Array<Vec3> = []

first principle curvature direction, per-vertex

@:value([])pdir2:Array<Vec3> = []

second principle curvature direction, per-vertex

@:value([])pointAreas:Array<Float> = []

point area of each vertex

@:value([])t1q1:Array<Vec3> = []

t1 and q1 as defined in the paper, packed into single Vec3 for each vertex

@:value([])vertices:Array<Vec3> = []

vertices as array of 3D points

Methods

apparentRidges(eye:Vec3, thresh:Float):Array<Ridge>

Find apparent ridges (3D) Use Render.apparentRidges() instead for 2D projections.

Parameters:

eye

view position

thresh

threshold value

Returns:

an array of ridges

See also:

computeAdjacentFaces():Void

Find the faces touching each vertex

computeBSphere():Void

"Compute an approximate bounding sphere" -- Trimesh2

computeBVH():Void

Compute the bounding volume hierarchy of the mesh using default parameters. A simple wrapper around BVHTree class's more customizable constructor

computeBVHTrivial():Void

Generate a "trivial" BVH (bounding volume hierarchy), containing all the faces at the root node. This is a placeholder in situations where BVH is not actually necessary

Parameters:

eye

view position

thresh

threshold value

computeCurvatures():Void

"Compute principal curvatures and directions" -- Trimesh2

computeFeatureSize():Void

"Compute a 'feature size' for the mesh: computed as 1% of the reciprocal of the 10-th percentile curvature" -- RTSC

computeNormals():Void

"Compute per-vertex normals Uses average of per-face normals, weighted according to: Max, N. 'Weights for Computing Vertex Normals from Facet Normals,' Journal of Graphics Tools, Vol. 4, No. 2, 1999." -- Trimesh2

computePointAreas():Void

"Compute the area 'belonging' to each vertex or each corner of a triangle (defined as Voronoi area restricted to the 1-ring of a vertex, or to the triangle)." -- Trimesh2

getFaceEdges(f:Face):Vector<Vec3>

Get the three edges from a face

Parameters:

face

the face

Returns:

3 vectors representing direction and length of each edge

@:value({ verb : false, doBVH : true })precompute(doBVH:Bool = true, verb:Bool = false):Void

Call necessary pre-computations of mesh properties for computing apparent ridges, in this order: normals, point-areas, adjacent-faces, curvatures, bounding sphere, feature size, bounding volume hierarchy. Alternatively, you can call the computeXxxxx() methods directly for a more customized set of things to compute, but since some of them depend on another so be careful of the order.

Parameters:

doBVH

whether to compute the bounding volume hiarchy, only necessary for hiding occluded ridges

verb

verbose: log progress

@:value({ tolerance : 2 })visible(eye:Vec3, p:Vec3, tolerance:Float = 2):Bool

Check if a point in space is not occluded by the mesh

Parameters:

eye

view position

p

the point in question

tolerance

a multiplier to the "epsilon", allowing only barely occluded points to pass the test. The epsilon is also a function of the mesh size (bsphere) and detail (number of faces)

Returns:

true if visible, false if invisible