Click or drag to resize

Mesh Class

Represents a geometry type that is defined by vertices and faces.

This is often called a face-vertex mesh.

Inheritance Hierarchy

Namespace:  Rhino.Geometry
Assembly:  RhinoCommon (in RhinoCommon.dll)
Syntax
[SerializableAttribute]
public class Mesh : GeometryBase

The Mesh type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleMesh
Initializes a new empty mesh.
Protected methodMesh(SerializationInfo, StreamingContext)
Protected constructor for internal use.
Top
Properties
  NameDescription
Public propertyComponentStates
Gets access to the vertex hidden/visibility collection in this mesh. This is a runtime property and it is not saved in the 3dm file.
Public propertyDisjointMeshCount
Gets the number of disjoint (topologically unconnected) pieces in this mesh.
Public propertyDisposed
Indicates if this object has been disposed or the document it originally belonged to has been disposed.
(Inherited from CommonObject.)
Public propertyFaceNormals
Gets access to the face normal collection in this mesh.
Public propertyCode exampleFaces
Gets access to the mesh face list.
Public propertyHasBrepForm
Returns true if the Brep.TryConvertBrep function will be successful for this object
(Inherited from GeometryBase.)
Public propertyHasCachedTextureCoordinates
Will return true if SetCachedTextureCoordinates has been called; otherwise will return false.
Public propertyHasUserData
Gets true if this class has any custom information attached to it through UserData.
(Inherited from CommonObject.)
Public propertyIsClosed
Gets a value indicating whether a mesh is considered to be closed (solid). A mesh is considered solid when every mesh edge borders two or more faces.
Public propertyIsDeformable
true if object can be accurately modified with "squishy" transformations like projections, shears, and non-uniform scaling.
(Inherited from GeometryBase.)
Public propertyIsDocumentControlled
If true this object may not be modified. Any properties or functions that attempt to modify this object when it is set to "IsReadOnly" will throw a NotSupportedException.
(Inherited from GeometryBase.)
Public propertyIsValid
Tests an object to see if it is valid.
(Inherited from CommonObject.)
Public propertyNgons
Gets access to the mesh ngon list.

Ngons represent groups of Faces (triangles + quads).

Faces are used to tessellate an Ngon internally.

When a triangle or quad is referenced in the Ngon list, it is no longer visualized and conceived as a single entity, but takes part of the Ngon.

If you need to get access to both Ngons and the faces that are not referenced by Ngons, that is, all polygons that are visible in the mesh, then use the GetNgonAndFacesEnumerable helper method.

Public propertyCode exampleNormals
Gets access to the vertex normal collection in this mesh.
Public propertyObjectType
Useful for switch statements that need to differentiate between basic object types like points, curves, surfaces, and so on.
(Inherited from GeometryBase.)
Public propertyPartitionCount
Number of partition information chunks stored on this mesh based on the last call to CreatePartitions
Public propertyTextureCoordinates
Gets access to the vertex texture coordinate collection in this mesh.
Public propertyTopologyEdges
Gets the MeshTopologyEdgeList object associated with this mesh.

This object stores edge connectivity.

Public propertyTopologyVertices
Gets the MeshTopologyVertexList object associated with this mesh.

This object stores vertex connectivity and the indices of vertices that were unified while computing the edge topology.

Public propertyUserData
List of custom information that is attached to this class.
(Inherited from CommonObject.)
Public propertyUserDictionary
Dictionary of custom information attached to this class. The dictionary is actually user data provided as an easy to use sharable set of information.
(Inherited from CommonObject.)
Public propertyUserStringCount
Gets the amount of user strings.
(Inherited from GeometryBase.)
Public propertyVertexColors
Gets access to the (optional) vertex color collection in this mesh.
Public propertyCode exampleVertices
Gets access to the vertices set of this mesh.
Top
Methods
  NameDescription
Public methodCode exampleAppend
Appends a copy of another mesh to this one and updates indices of appended mesh parts.
Public methodClearSurfaceData
Removes surface parameters, curvature parameters and surface statistics from the mesh.
Public methodClearTextureData
Removes all texture coordinate information from this mesh.
Public methodClosestMeshPoint
Gets the point on the mesh that is closest to a given test point. Similar to the ClosestPoint function except this returns a MeshPoint class which includes extra information beyond just the location of the closest point.
Public methodClosestPoint(Point3d)
Gets the point on the mesh that is closest to a given test point.
Public methodClosestPoint(Point3d, Point3d, Double)
Gets the point on the mesh that is closest to a given test point.
Public methodClosestPoint(Point3d, Point3d, Vector3d, Double)
Gets the point on the mesh that is closest to a given test point.
Public methodCollapseFacesByArea
Collapses multiple mesh faces, with areas less than LessThanArea and greater than GreaterThanArea, based on the principles found in Stan Melax's mesh reduction PDF, see http://pomax.nihongoresources.com/downloads/PolygonReduction.pdf
Public methodCollapseFacesByByAspectRatio
Collapses a multiple mesh faces, determined by face aspect ratio, based on criteria found in Stan Melax's polygon reduction, see http://pomax.nihongoresources.com/downloads/PolygonReduction.pdf
Public methodCollapseFacesByEdgeLength
Collapses multiple mesh faces, with greater/less than edge length, based on the principles found in Stan Melax's mesh reduction PDF, see http://pomax.nihongoresources.com/downloads/PolygonReduction.pdf
Public methodColorAt(MeshPoint)
Evaluate a mesh color at a set of barycentric coordinates.
Public methodColorAt(Int32, Double, Double, Double, Double)
Evaluate a mesh normal at a set of barycentric coordinates. Barycentric coordinates must be assigned in accordance with the rules as defined by MeshPoint.T.
Public methodCode exampleCompact
Removes any unreferenced objects from arrays, reindexes as needed and shrinks arrays to minimum required size.
Public methodComponentIndex
If this piece of geometry is a component in something larger, like a BrepEdge in a Brep, then this function returns the component index.
(Inherited from GeometryBase.)
Public methodComputeAutoCreaseInformation
Do not use this method. Length: top.Mesh.Vertices.Count
Public methodStatic memberComputeThickness(IEnumerableMesh, Double)
Compute thickness metrics for this mesh.
Public methodStatic memberComputeThickness(IEnumerableMesh, Double, CancellationToken)
Compute thickness metrics for this mesh.
Public methodStatic memberComputeThickness(IEnumerableMesh, Double, Double, CancellationToken)
Compute thickness metrics for this mesh.
Protected methodConstructConstObject
Assigns a parent object and a subobject index to this.
(Inherited from CommonObject.)
Public methodCopyFrom
Copies mesh values into this mesh from another mesh.
Public methodStatic memberCreateBooleanDifference
Computes the solid difference of two sets of Meshes.
Public methodStatic memberCreateBooleanIntersection
Computes the solid intersection of two sets of meshes.
Public methodStatic memberCreateBooleanSplit
Splits a set of meshes with another set.
Public methodStatic memberCreateBooleanUnion
Computes the solid union of a set of meshes.
Public methodStatic memberCreateContourCurves(Mesh, Plane)
Constructs contour curves for a mesh, sectioned at a plane.
Public methodStatic memberCode exampleCreateContourCurves(Mesh, Point3d, Point3d, Double)
Constructs contour curves for a mesh, sectioned along a linear axis.
Public methodStatic memberCreateFromBox(BoundingBox, Int32, Int32, Int32)
Constructs new mesh that matches a bounding box.
Public methodStatic memberCreateFromBox(Box, Int32, Int32, Int32)
Constructs new mesh that matches an aligned box.
Public methodStatic memberCreateFromBox(IEnumerablePoint3d, Int32, Int32, Int32)
Constructs new mesh from 8 corner points.
Public methodStatic memberCode exampleCreateFromBrep(Brep)
Constructs a mesh from a brep.
Public methodStatic memberCode exampleCreateFromBrep(Brep, MeshingParameters)
Constructs a mesh from a brep.
Public methodStatic memberCreateFromClosedPolyline
Attempts to create a Mesh that is a triangulation of a closed polyline.
Public methodStatic memberCreateFromCone
Constructs a mesh cone
Public methodStatic memberCreateFromCurvePipe
Constructs a new mesh pipe from a curve.
Public methodStatic memberCreateFromCylinder
Constructs a mesh cylinder
Public methodStatic memberCreateFromLines
Creates a mesh by analizing the edge structure that could result from the extraction of edges from an original mesh.
Public methodStatic memberCreateFromPlanarBoundary(Curve, MeshingParameters)
Do not use this overload. Use version that takes a tolerance parameter instead.
Public methodStatic memberCreateFromPlanarBoundary(Curve, MeshingParameters, Double)
Attempts to construct a mesh from a closed planar curve.RhinoMakePlanarMeshes
Public methodStatic memberCreateFromPlane
Constructs a planar mesh grid.
Public methodStatic memberCreateFromSphere
Constructs a mesh sphere.
Public methodStatic memberCreateFromTessellation
Attempts to create a mesh that is a triangulation of a list of points, projected on a plane, including its holes and fixed edges.
Public methodStatic memberCreateIcoSphere
Constructs a icospherical mesh. A mesh icosphere differs from a standard UV mesh sphere in that it's vertices are evenly distributed. A mesh icosphere starts from an icosahedron (a regular polyhedron with 20 equilateral triangles). It is then refined by splitting each triangle into 4 smaller triangles. This splitting can be done several times.
Public methodCreatePartitions
In ancient times (or modern smartphone times), some rendering engines were only able to process small batches of triangles and the CreatePartitions() function was provided to partition the mesh into subsets of vertices and faces that those rendering engines could handle.
Public methodStatic memberCreatePatch
Construct a mesh patch from a variety of input geometry.
Public methodStatic memberCreateQuadSphere
Constructs a quad mesh sphere. A quad mesh sphere differs from a standard UV mesh sphere in that it's vertices are evenly distributed. A quad mesh sphere starts from a cube (a regular polyhedron with 6 square sides). It is then refined by splitting each quad into 4 smaller quads. This splitting can be done several times.
Public methodStatic memberCreateRefinedCatmullClarkMesh
Instantiates a new mesh that represents a Catmull-Clark subdivision of the mesh.
Public methodStatic memberCreateRefinedLoopMesh
Instantiates a new mesh that represents a Loop subdivision of the mesh.
Public methodDestroyPartition
Destroys mesh partition.
Public methodDestroyTopology
Removes topology data, forcing all topology information to be recomputed.
Public methodDestroyTree
Destroys the mesh vertex access tree.
Public methodDispose
Actively reclaims unmanaged resources that this instance uses.
(Inherited from CommonObject.)
Protected methodDispose(Boolean)
For derived class implementers.

This method is called with argument true when class user calls Dispose(), while with argument false when the Garbage Collector invokes the finalizer, or Finalize() method.

You must reclaim all used unmanaged resources in both cases, and can use this chance to call Dispose on disposable fields if the argument is true.

Also, you must call the base virtual method within your overriding method.

(Inherited from CommonObject.)

In Rhino for Windows, this member is overridden by Dispose(Boolean).
Public methodDuplicate (Overrides GeometryBaseDuplicate.)
Public methodDuplicateMesh
Public methodDuplicateShallow
Constructs a light copy of this object. By "light", it is meant that the same underlying data is used until something is done to attempt to change it. For example, you could have a shallow copy of a very heavy mesh object and the same underlying data will be used when doing things like inspecting the number of faces on the mesh. If you modify the location of one of the mesh vertices, the shallow copy will create a full duplicate of the underlying mesh data and the shallow copy will become a deep copy.
(Inherited from GeometryBase.)
Public methodEnsurePrivateCopy
If you want to keep a copy of this class around by holding onto it in a variable after a command completes, call EnsurePrivateCopy to make sure that this class is not tied to the document. You can call this function as many times as you want.
(Inherited from CommonObject.)
Public methodEquals (Inherited from Object.)
Public methodEvaluateMeshGeometry
If the mesh has SurfaceParameters, the surface is evaluated at these parameters and the mesh geometry is updated.
Public methodExplodeAtUnweldedEdges
Explode the mesh into submeshes where a submesh is a collection of faces that are contained within a closed loop of "unwelded" edges. Unwelded edges are edges where the faces that share the edge have unique mesh vertexes (not mesh topology vertexes) at both ends of the edge.
Public methodExtendSelectionByEdgeRidge
Suggests an extension of a selection set by using information related with topology and alignment.
Public methodExtendSelectionByFaceLoop
Suggests an extension of a face selection set by using information related with topology and alignment.
Public methodExtractNonManifoldEdges
Extracts, or removes, non-manifold mesh edges.
Public methodFileHole
Given a starting "naked" edge index, this function attempts to determine a "hole" by chaining additional naked edges together until if returns to the start index. Then it triangulates the closed polygon and either adds the faces to the mesh.
Public methodFillHoles
Attempts to determine "holes" in the mesh by chaining naked edges together. Then it triangulates the closed polygons adds the faces to the mesh.
Protected methodFinalize
Passively reclaims unmanaged resources when the class user did not explicitly call Dispose().
(Inherited from CommonObject.)
Public methodFlip
Reverses the direction of the mesh.
Public methodCode exampleGetBoundingBox(Boolean)
Boundingbox solver. Gets the world axis aligned boundingbox for the geometry.
(Inherited from GeometryBase.)
Public methodCode exampleGetBoundingBox(Plane)
Aligned Boundingbox solver. Gets the plane aligned boundingbox.
(Inherited from GeometryBase.)
Public methodGetBoundingBox(Transform)
Aligned Boundingbox solver. Gets the world axis aligned boundingbox for the transformed geometry.
(Inherited from GeometryBase.)
Public methodGetBoundingBox(Plane, Box)
Aligned Boundingbox solver. Gets the plane aligned boundingbox.
(Inherited from GeometryBase.)
Public methodGetCachedTextureCoordinates
Call this method to get cached texture coordinates for a texture mapping with the specified Id.
Public methodGetHashCode (Inherited from Object.)
Public methodGetNakedEdgePointStatus
Returns an array of bool values equal in length to the number of vertices in this mesh. Each value corresponds to a mesh vertex and is set to true if the vertex is not completely surrounded by faces.
Public methodCode exampleGetNakedEdges
Returns all edges of a mesh that are considered "naked" in the sense that the edge only has one face.
Public methodGetNgonAndFacesCount
Public methodGetNgonAndFacesEnumerable
Retrieves a complete enumerable, i.e., one that provides an iterator over every face that is present, no matter if defined as a triangle, a quad, or a strictly over-four-sided ngon.
Public methodGetObjectData
Populates a System.Runtime.Serialization.SerializationInfo with the data needed to serialize the target object.
(Inherited from CommonObject.)
Public methodGetOutlines(Plane)
Constructs the outlines of a mesh projected against a plane.
Public methodGetOutlines(RhinoViewport)
Constructs the outlines of a mesh. The projection information in the viewport is used to determine how the outlines are projected.
Public methodGetOutlines(ViewportInfo, Plane)
Constructs the outlines of a mesh.
Public methodGetPartition
Retrieves a partition. See CreatePartitions(Int32, Int32) for details.
Public methodGetType (Inherited from Object.)
Public methodGetUnsafeLock
Allows to obtain unsafe pointers to the underlying unmanaged data structures of the mesh.
Public methodGetUserString
Gets user string from this geometry.
(Inherited from GeometryBase.)
Public methodGetUserStrings
Gets a copy of all (user key string, user value string) pairs attached to this geometry.
(Inherited from GeometryBase.)
Public methodHealNakedEdges
Attempts to "heal" naked edges in a mesh based on a given distance. First attempts to move vertexes to neighboring vertexes that are within that distance away. Then it finds edges that have a closest point to the vertex within the distance and splits the edge. When it finds one it splits the edge and makes two new edges using that point.
Public methodIsManifold
Gets a value indicating whether or not the mesh is manifold. A manifold mesh does not have any edge that borders more than two faces.
Public methodIsPointInside
Determines if a point is inside a solid mesh.
Public methodIsValidWithLog
Determines if an object is valid. Also provides a report on errors if this object happens not to be valid.
(Inherited from CommonObject.)
Public methodMakeDeformable
If possible, converts the object into a form that can be accurately modified with "squishy" transformations like projections, shears, an non-uniform scaling.
(Inherited from GeometryBase.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodMemoryEstimate
Computes an estimate of the number of bytes that this object is using in memory.
(Inherited from GeometryBase.)
Protected methodNonConstOperation
For derived classes implementers.

Defines the necessary implementation to free the instance from being const.

(Inherited from CommonObject.)

In Rhino for Windows, this member is overridden by NonConstOperation.
Public methodNormalAt(MeshPoint)
Evaluate a mesh normal at a set of barycentric coordinates.
Public methodNormalAt(Int32, Double, Double, Double, Double)
Evaluate a mesh normal at a set of barycentric coordinates. Barycentric coordinates must be assigned in accordance with the rules as defined by MeshPoint.T.
Public methodOffset(Double)
Makes a new mesh with vertices offset a distance in the opposite direction of the existing vertex normals. Same as Mesh.Offset(distance, false)
Public methodOffset(Double, Boolean)
Makes a new mesh with vertices offset a distance in the opposite direction of the existing vertex normals. Optionally, based on the value of solidify, adds the input mesh and a ribbon of faces along any naked edges. If solidify is false it acts exactly as the Offset(distance) function.
Public methodOffset(Double, Boolean, Vector3d)
Makes a new mesh with vertices offset a distance along the direction parameter. Optionally, based on the value of solidify, adds the input mesh and a ribbon of faces along any naked edges. If solidify is false it acts exactly as the Offset(distance) function.
Protected methodOnSwitchToNonConst
Performs some memory cleanup if necessary
(Overrides GeometryBaseOnSwitchToNonConst.)
Public methodPointAt(MeshPoint)
Evaluate a mesh at a set of barycentric coordinates.
Public methodPointAt(Int32, Double, Double, Double, Double)
Evaluates a mesh at a set of barycentric coordinates. Barycentric coordinates must be assigned in accordance with the rules as defined by MeshPoint.T.
Public methodPullPointsToMesh
Pulls a collection of points to a mesh.
Public methodRebuildNormals
Removes mesh normals and reconstructs the face and vertex normals based on the orientation of the faces.
Public methodReduce(ReduceMeshParameters)
Reduce polygon count
Public methodReduce(Int32, Boolean, Int32, Boolean)
Reduce polygon count
Public methodReduce(Int32, Boolean, Int32, Boolean, CancellationToken, IProgressDouble, String)
Reduce polygon count
Public methodReleaseUnsafeLock
Updates the Mesh data with the information that was stored via the MeshUnsafeLock.
Public methodRotate
Rotates the object about the specified axis. A positive rotation angle results in a counter-clockwise rotation about the axis (right hand rule).
(Inherited from GeometryBase.)
Public methodScale
Scales the object by the specified factor. The scale is centered at the origin.
(Inherited from GeometryBase.)
Public methodSetCachedTextureCoordinates
Set cached texture coordinates using the specified mapping.
Public methodSetTextureCoordinates
Set texture coordinates using given mapping and applying given transform. Set lazy to false to generate texture coordinates right away.
Public methodSetUserString
Attach a user string (key,value combination) to this geometry.
(Inherited from GeometryBase.)
Public methodSmooth(Double, Boolean, Boolean, Boolean, Boolean, SmoothingCoordinateSystem)
Smooths a mesh by averaging the positions of mesh vertices in a specified region.
Public methodSmooth(Double, Boolean, Boolean, Boolean, Boolean, SmoothingCoordinateSystem, Plane)
Smooths a mesh by averaging the positions of mesh vertices in a specified region.
Public methodSolidOrientation
Determines orientation of a "solid" mesh.
Public methodSplit(Mesh)
Split a mesh with another mesh.
Public methodSplit(IEnumerableMesh)
Split a mesh with a collection of meshes.
Public methodSplit(Plane)
Split a mesh by an infinite plane.
Public methodSplitDisjointPieces
Splits up the mesh into its unconnected pieces.
Public methodToString (Inherited from Object.)
Public methodTransform
Transforms the geometry. If the input Transform has a SimilarityType of OrientationReversing, you may want to consider flipping the transformed geometry after calling this function when it makes sense. For example, you may want to call Flip() on a Brep after transforming it.
(Inherited from GeometryBase.)
Public methodTranslate(Vector3d)
Translates the object along the specified vector.
(Inherited from GeometryBase.)
Public methodTranslate(Double, Double, Double)
Translates the object along the specified vector.
(Inherited from GeometryBase.)
Public methodUnifyNormals
Attempts to fix inconsistencies in the directions of mesh faces in a mesh. This function does not modify mesh vertex normals, it rearranges the mesh face winding and face normals to make them all consistent. Note, you may want to call Mesh.Normals.ComputeNormals() to recompute vertex normals after calling this functions.
Public methodUnifyNormals(Boolean)
Attempts to fix inconsistencies in the directions of mesh faces in a mesh. This function does not modify mesh vertex normals, it rearranges the mesh face winding and face normals to make them all consistent. Note, you may want to call Mesh.Normals.ComputeNormals() to recompute vertex normals after calling this functions.
Public methodUnweld
Makes sure that faces sharing an edge and having a difference of normal greater than or equal to angleToleranceRadians have unique vertexes along that edge, adding vertices if necessary.
Public methodUnweldEdge
Adds creases to a smooth mesh by creating coincident vertices along selected edges.
Public methodVolume
Compute volume of the mesh.
Public methodWeld
Makes sure that faces sharing an edge and having a difference of normal greater than or equal to angleToleranceRadians share vertexes along that edge, vertex normals are averaged.
Public methodWithDisplacement
Constructs new mesh from the current one, with displacement applied to it.
Public methodWithEdgeSoftening
Constructs new mesh from the current one, with edge softening applied to it.
Public methodWithShutLining
Constructs new mesh from the current one, with shut lining applied to it.
Top
Version Information

Rhino for Mac

Supported in: 5.4

Rhino for Windows

Supported in: 6.4
See Also