MeshExtensionMethods

public static class MeshExtensionMethods

Methods

public static double Area(this MeshFace face, Mesh mesh, out Polyline boundary)
face (MeshFace)
mesh (Mesh)
boundary (out Polyline)
public static double Area(this MeshFace face, Mesh mesh)
face (MeshFace)
mesh (Mesh)

Boundary

#Example
public static Polyline Boundary(this MeshFace face, Mesh mesh)
face (MeshFace)
mesh (Mesh)

EdgeRange

#Example
public static (double shortest, double longest) EdgeRange(this MeshFace face, Mesh mesh)
face (MeshFace)
mesh (Mesh)

EdgeTouchesVertex

#Example
public static bool EdgeTouchesVertex(this Mesh mesh, int edgeIndex, int vertexIndex)
Test whether a specific topological edge involves a specific vertex. This test checks whether any of the faces using this edge also use the vertex in question.
mesh (Mesh)Mesh containing edges and vertices.
edgeIndex (int)Index of topological edge.
vertexIndex (int)Index of regular vertex.

FindEdge

#Example
public static int FindEdge(this Mesh mesh, int vertexA, int vertexB)
Try and find the edge index which connects vertices A and B.
mesh (Mesh)Mesh.
vertexA (int)First vertex index.
vertexB (int)Second vertex index.
Index of edge connecting A and B or -1.

FindNeighbours

#Example
public static bool FindNeighbours(this MeshFace face, int vertex, out int before, out int after)
Find the vertices, if any, that come before and after a given vertex around the face. This method assumes the face is valid.
face (MeshFace)
vertex (int)
before (out int)
after (out int)
True if vertices were found, false if otherwise.

Shade360

#Example
public static void Shade360(this Mesh mesh, Vector3f light, float lit = 0.3, float shade = 0.3)
Apply a full shading to all the vertices of a mesh. This requires vertices already having false colours.
mesh (Mesh)Mesh to shade.
light (Vector3f)Direction *towards* the light source.
lit (float = 0.3)Amount of lightening towards light.
shade (float = 0.3)Amount of darkening away from light.

ShadeFlat

#Example
public static void ShadeFlat(this Mesh mesh, params Color[] palette)
Apply a flat shading to all the faces of a mesh. This involves unwelding *all* edges.
mesh (Mesh)Mesh to colour.
palette (params Color[])Palette of colours to apply randomly.

ShadeGooch

#Example
public static void ShadeGooch(this Mesh mesh, Vector3f light, Color warm, Color cold)
Apply a gooch shading to all the vertices of a mesh. This requires vertices already having false colours.
mesh (Mesh)Mesh to shade.
light (Vector3f)Direction *towards* the light sourc.
warm (Color)Warm gooch colour for tinting of lit areas.
cold (Color)Cool gooch colour for tinting of shaded areas.

ShadeGooch

#Example
public static void ShadeGooch(this Mesh mesh, Vector3f light)
Apply a gooch shading to all the vertices of a mesh. This requires vertices already having false colours.
mesh (Mesh)Mesh to shade.
light (Vector3f)Direction *towards* the lght source.

ShadeLambertian

#Example
public static void ShadeLambertian(this Mesh mesh, Vector3f light, float lit = 0.3, float shade = -0.3)
Apply a lamberian smooth shading to all the vertices of a mesh. This requires vertices already having false colours.
mesh (Mesh)Mesh to shade.
light (Vector3f)Direction *towards* the light source.
lit (float = 0.3)Amount of lighting to apply to fully lit vertices.
shade (float = -0.3)Amount of darkening to apply to fully shaded vertices.

Touches

#Example
public static bool Touches(this MeshFace face, int vertex)
Test whether any of the face corners equals the vertex index.
face (MeshFace)
vertex (int)