Skip to content
On this page

class GeometryData

GeometryData represents a geometric structure consisting of point data (Vertices) and topological data (Triangles). GeometryData may represent a whole geometric object, but can also be used by streaming data filters, and in this way, only represents a part of the object. Different fields in the Vertices and Triangles fields data objects will contain point data and topological data. The standard naming convention used in the filters/renderers are as follows: (Case sensitive naming, other fields may also be present) 'Coords' Positional coordinates of a vertex, expressed with a 3-component real field (XYZ). 'TexCoords0' - 'TexCoords255' Texture coordinates of a vertex, expressed with a 2 components real field. By convention, the existing fields must be sequential, and must start with 'TexCoord0'. 'Normals' Normal vector for the vertex, expressed with a 3-component real field, a normalized (XYZ) vector. 'VertexIds' The id of the current vertex in the primitive. This field is present even if the vertex data is directly specified in the primitive data, to specify topology. The field is of type rid. 'MaterialIds' The material of the primitive. The field is of type rid. The 'Coords' and 'VertexIds' fields always exist in the object, but the other fields are optional. Also, there can exist user fields.

Properties

PropertyDescription
NameThe name of the GeometryData object. (Inherited from Object)
TriangleCountThe number of triangles in the geometry. The number of corners is always set to (TriangleCount*3), so there is no specific method to set the number of corners.
VertexCountThe number of vertices in the geometry.

Methods

MethodDescription
AddBaseTypeCustomFieldAdds an empty custom field. To be able to add a field, it must have a name that does not conflict with the existing custom fields.
AddBaseTypeUserCornerFieldAdds an empty user-specified corner field.
AddBaseTypeUserTriangleFieldAdds an empty user-specified triangle field.
AddBaseTypeUserVertexFieldAdds a user-specified vertex field. To be able to add a field, it must have a name that does not conflict with the existing vertex fields.
AddBoneWeightsAdds the BoneWeights and BoneIds fields in the vertices. The BoneWeights and BoneIds fields are added and removed in unison, and should always be the same tuple size. (Field names: "BoneWeights" & "BoneIds", Tuple size: varying , Stored as: Vertex attribute)
AddColorsThe vertex colors in the input channel from the corners the geometry. The valid id range of the channel parameter is 0-255, which equals fields 'Colors0' - 'Colors255' (Field name: 'Color0'-'Color255' which is stored as attribute per corner)
AddCustomFieldAdds a custom field. To be able to add a field, it must have a name that does not conflict with the existing custom fields.
AddGroupIdsAdds the GroupIds field in the triangles. (Field name: "GroupIds", Tuple size: 1 , Stored as: triangle attribute)
AddMaterialIdsAdds the MaterialIds field in the triangles. (Field name: "MaterialIds", Tuple size: 1 , Stored as: triangle attribute)
AddNamedColorsAdds a named Color field in the corners. (Field name: "Colors0" - "Colors255", Tuple size: 4 , Stored as: Corner attribute)
AddNamedTexCoordsAdds a named TexCoords field in the corners. (Field name: "TexCoords0" - "TexCoords255", Tuple size: 2 , Stored as: Corner attribute)
AddNormalsAdds the Normals field in the corners. (Field name: "Normals" , Tuple size: 3 , Stored as: Corner attribute)
AddObserverAdds a user-defined observer object to the interface, that will receive events from the interface. (Inherited from Object)
AddQuadFlagsAdds the QuadFlags field in the triangles. Quad flags are used to map sequential triangles to quads for the quad reduction processor using the values SG_QUADFLAG_FIRST, SG_QUADFLAG_SECOND to denote triangles in a quad, and SG_QUADFLAG_TRIANGLE to denote true triangles. (Field name: "QuadFlags" , Tuple size: 1 , Stored as: Triangle attribute)
AddTangentsAdds Tangents and Bitangents fields in the corners. The valid id range of the level parameter is 0-255. (Field names: "Tangents0" - "Tangents255" & "Bitangents0" - "Bitangents255", Tuple size: 3 , Stored as: Corner attribute)
AddTexCoordsAdds a TexCoords field in the corners. The valid id range of the level parameter is 0-255, which equals fields 'TexCoords0' - 'TexCoords255' (Field name: "TexCoords0" - "TexCoords255", Tuple size: 2 , Stored as: Corner attribute)
AddTrianglesAddTriangles increases the triangle count by the specified value.
AddUserCornerFieldAdds a user-specified corner field. To be able to add a field, it must have a name that does not conflict with the existing corner fields.
AddUserTriangleFieldAdds a user-specified triangle field. To be able to add a field, it must have a name that does not conflict with the existing triangle fields.
AddUserVertexFieldAdds a user-specified vertex field. To be able to add a field, it must have a name that does not conflict with the existing vertex fields.
AddVertexLocksAdds the VertexLocks field for the vertices. If the value for a vertex is true, then the vertex should be locked, and not be removed in the collapse-process. (Field name: "VertexLocks", Tuple size: 1 , Stored as: Vertex attribute)
AddVertexWeightsAdds the VertexWeights field for the vertices. The weights are used to determine how important it is to keep the vertices when the geometry is reduced. 1 means the weight won't change the importance, values closer to 0 means it will be less important, values > 1 means the vertex is more important and less probable to be removed. (Field name: "VertexWeights", Tuple size: 1 , Stored as: Vertex attribute)
AddVerticesIncreases the vertex count by the specified value.
AppendGeometryAppends the geometry data to this geometry. This geometry will contain all triangles and vertices of both geometries. The VertexIds that are copied from the source are remapped to point at the vertices, which are appended to the end of the current vertices. Any field in the appended geometry that does not exist in this geometry will be added, with the tuples that are added set to 0. The method will fail if the source geometry has identically named fields, but with different tuple sizes or base types.
CalculateExtentsCalculate the extents by checking the coordinates of all vertices in the geometry. Set only_triangles to true to test only vertices that are indexed by a triangle. This is a slower test, and the bounding box may not encompass all vertices' positions. the new extents are found by calling GetInf() and GetSup() afterwards.
ChangeWindingChange winding.
CleanupInvalidTrianglesFinds triangles that contain the same vertex more than once, and invalidates them, ie. sets all the vertex id references to -1. These triangles can be culled using Compact().
CleanupNanValuesFinds all Nan (1.#IND, 1.#INF etc) values in the real/float/double arrays in the GeometryData, and sets them to 0.0 just to make sure all numbers in the GeometryData are legit. Should not be needed if all the data loaded into the GeometryData object is ok to begin with.
CompactRemoves invalid triangles and vertices not referenced by any triangle. If any vertices are removed, the triangles will be remapped to the new compacted vertex field.
ConvertHandednessConverts the handedness of the triangle winding, coords, normals and texture coordinates of the geometry from left-handed to right-handed coordinate systems and vice versa. Simplygon generally uses right-handed coordinates, so this conversion needs to be done before processing any left-handed geometry.
CopyCombine3CornersCombines three corners via barycentric coordinates. alpha_3 = 1-(alpha_1 + alpha_2) dest = src_1*alpha_1 + src_2*alpha_2 + src_3*alpha_3.
CopyCombine3TrianglesCombines the fields of three triangles via barycentric coordinates. alpha_3 = 1-(alpha_1 + alpha_2) dest = src_1*alpha_1 + src_2*alpha_2 + src_3*alpha_3.
CopyCombine3VerticesCombines the fields of three vertices via barycentric coordinates. alpha_3 = 1-(alpha_1 + alpha_2) dest = src_1*alpha_1 + src_2*alpha_2 + src_3*alpha_3.
CopyCombineCornersCombines the fields of two corners by linear interpolation into the destination corner.
CopyCombineTrianglesCombines the fields of two triangles by linear interpolation into the destination triangle.
CopyCombineVerticesCombines the fields of two vertices by linear interpolation into the destination vertex.
CopyCornerCopies all fields in the specified corner in the source geometry to the destination corner in this geometry .
CopyTriangleCopies all fields in the specified triangle in the source geometry to the destination triangle in this geometry.
CopyVertexCopies all fields in the specified vertex in the source geometry to the destination vertex in this geometry.
CreateAABBReturns an axis aligned bounding box GeometryData of this geometry.
DeduplicateVerticesRemoves redundant duplication of vertex data, so any vertices containing the exact same information are merged, and the triangle VertexIds field will be remapped to the new values.
DeepCopyCopies the field setup and data from another object into this object. To only copy the setup, set copy_data to false.
DetectEdgeNeighborsDetect triangle edge neighbors. Neighbor ids are stored in the "SgEdgeNeighbors" Corner field.
ExpandVerticesExpands the Vertices field data so that there exists one vertex for each of the three corners of each triangle in the geometry. The vertices will be organized identical to the Corners field. The triangles will be remapped to use the new vertices correctly. Expanding the vertex field is required to be able to extract a range of the geometry, and to be able to stream it. Note! This will lead to increased memory requirement, as vertex data is not shared among neighboring triangles. It also removes the connectivity information of the triangles, and effectively detaches all triangles from one another. This call may replace fields in the Vertices field data. Re-query any previously cached field pointer after the call. All user fields are copied as well.
ExtentsContainCoordsTests if the extents of the geometry fully contain all vertex coordinates. Note! ExtentsContainCoords() checks all vertices in the geometry, regardless to whether the vertex is referenced by any triangle. Use Compact() to remove any non-referenced vertex before calling ExtentsContainCoords.
ExtractRangeExtracts a range of triangles with their vertices from the geometry. ExpandVertices() must first be called for the extraction to succeed. ExtractGeometry() can be used to stream geometries in chunks. If writing to a stream, the extracted geometry is guaranteed to have the same setup as the original. Any previous data in the destination will be deleted.
ExtractTrianglesExtracts specified triangles from the geometry. The destination geometry will contain the triangles and vertices. The vertices in the destination will be expanded so that there exists one vertex for each of the three corners of each triangle in the geometry.
FindEdgeIdsFromVertexPairsEach tuple in the "vertex_pairs" array contains the start-vertex and end-vertex of a half-edge in the geometry. If a half-edge is found from a tuple in the "vertex_pairs" array, the edge-id of that half-edge will be stored in the edge_ids array. Do note: the half-edges are directed, so if you want all half-edges that contains 2 vertices, you need to add the tuple twice.
FindNamedColorsIndexReturns the level index of the colors field with the name returns -1 if not found.
FindNamedTexCoordsIndexReturns the level index of the texcoord field with the name returns -1 if not found.
GetAttributeTessellationGet the attribute tessellation data object of the geometry
GetBitangentsGets a Bitangents field in the corners. The valid id range of the level parameter is 0-255. (Field name: "Bitangents0" - "Bitangents255", Tuple size: 3 , Stored as: Corner attribute)
GetBoneIdsThe BoneIds fields in the vertices. (Field name: "BoneIds", Tuple size: varying , Stored as: Vertex attribute)
GetBoneWeightsThe BoneWeights field in the vertices. (Field name: "BoneWeights", Tuple size: varying , Stored as: Vertex attribute)
GetClassGet the name of the GeometryData class. (Inherited from Object)
GetColorsGets a Color field in the corners. The valid id range of the level parameter is 0-255, which equals fields 'Colors0' - 'Colors255' (Field name: "Colors0" - "Colors255", Tuple size: 4 , Stored as: Corner attribute)
GetCoordsThe Coords field in the vertices. (Field name: "Coords", Tuple size: 3 , Stored as: Vertex attribute)
GetCornersRetrieves the IFieldData object that contains the corner fields.
GetCustomFieldGets a custom field.
GetExtentsGet the extents object in the geometry.
GetGroupIdsThe GroupIds field in the triangles. (Field name: "GroupIds", Tuple size: 1 , Stored as: triangle attribute)
GetInfThe inferior (minimum) extent of the geometry.
GetMaterialIdsThe MaterialIds field in the triangles. (Field name: "MaterialIds", Tuple size: 1 , Stored as: triangle attribute)
GetNamedColorsGets a Color field, using the alternative name instead of the index.
GetNamedOrIndexedBitangentsGets a bitangents field, first trying to match the name of the field (GetAlternativeName) and if no field is found, tries to convert the input string to an index of the field. If no field is found, null is returned.
GetNamedOrIndexedColorsGets a colors field, first trying to match the name of the field (GetAlternativeName) and if no field is found, tries to convert the input string to an index of the field. If no field is found, null is returned.
GetNamedOrIndexedTangentsGets a tangents field, first trying to match the name of the field (GetAlternativeName) and if no field is found, tries to convert the input string to an index of the field. If no field is found, null is returned.
GetNamedOrIndexedTexCoordsGets a TexCoords field, first trying to match the name of the field (GetAlternativeName) and if no field is found, tries to convert the input string to an index of the field. If no field is found, null is returned.
GetNamedTexCoordsGets a TexCoords field, using the alternative name instead of the index.
GetNormalsThe Normals field in the corners. (Field name: "Normals" , Tuple size: 3 , Stored as: Corner attribute)
GetQuadFlagsGet the QuadFlags triangle field. Quad flags are used to map sequential triangles to quads for the quad reduction processor using the values SG_QUADFLAG_FIRST, SG_QUADFLAG_SECOND to denote triangles in a quad, and SG_QUADFLAG_TRIANGLE to denote true triangles. (Field name: "QuadFlags" , Tuple size: 1 , Stored as: Triangle attribute)
GetSupThe superior (maximum) extent of the geometry.
GetTangentsGets a Tangents field in the corners. The valid id range of the level parameter is 0-255. (Field name: "Tangents0" - "Tangents255", Tuple size: 3 , Stored as: Corner attribute)
GetTexCoordsGets a TexCoords field in the corners. The valid id range of the level parameter is 0-255, which equals fields 'TexCoords0' - 'TexCoords255' (Field name: "TexCoords0" - "TexCoords255", Tuple size: 2 , Stored as: Corner attribute).
GetTrianglesRetrieves the IFieldData object that contains the triangle fields.
GetUserCornerFieldGets a user-specified corner field.
GetUserTriangleFieldGets a user-specified triangle field.
GetUserVertexFieldGets a user-specified vertex field.
GetVertexIdsThe VertexIds field in the corners.
GetVertexLocksThe VertexLocks field for the vertices. If the value for a vertex is true, then the vertex should be locked, and not be removed in the collapse-process. (Field name: "VertexLocks", Tuple size: 1 , Stored as: Vertex attribute)
GetVertexWeightsThe VertexWeights field for the vertices. The weights are used to determine how important it is to keep the vertices when the geometry is reduced. 1 means the weight won't change the importance, values closer to 0 means it will be less important, values > 1 means the vertex is more important and less probable to be removed. (Field name: "VertexWeights", Tuple size: 1 , Stored as: Vertex attribute)
GetVerticesRetrieves the IFieldData object that contains the vertex fields.
HasAttributeTessellationReturns true if the geometry data has an attribute tessellation data object.
IsAReturns true if GeometryData is a or is a descendant of the class named as the type parameter. (Inherited from Object)
IsNullReturns true if the GeometryData object is invalid. (Inherited from Object)
IsSameObjectAsReturns true if the GeometryData object is valid. (Inherited from Object)
NewCopyCreates another geometry data object with the same field setup. To also copy the data to the new object, set copy_data to true.
NewPackedCopyCreates a "packed" PackedGeometryData object, where all fields in the Corner field data object is moved to the vertex field data object. Please note that the vertex field data object will be enlarged to accommodate for data in a vertex shared by multiple triangles, where the corner data differs between the triangles. The method will fail if a Corner field is named the same as an existing Vertices field, please make sure to remove any such field before calling the method.
NonNullReturns true if the GeometryData object is valid. (Inherited from Object)
PrintInfoPrints the content/info of the GeometryData object to the log. (Inherited from Object)
RemoveAttributeTessellationRemoves attribute tessellation data from the geometry data. Note that this removes all data, including the tessellation levels of each base triangle, as well as any allocated attribute field.
RemoveBoneWeightsRemoves the BoneWeights and BoneIds fields in the vertices. The BoneWeights and BoneIds fields are added and removed in unison, and should always be the same tuple size. (Field names: "BoneWeights" & "BoneIds", Tuple size: varying , Stored as: Vertex attribute)
RemoveColorsRemoves a Color field in the corners. The valid id range of the level parameter is 0-255, which equals fields 'Colors0' - 'Colors255' (Field name: "Colors0" - "Colors255", Tuple size: 4 , Stored as: Corner attribute)
RemoveCustomFieldRemoves a custom field.
RemoveGroupIdsRemoves the GroupIds field in the triangles. (Field name: "GroupIds", Tuple size: 1 , Stored as: triangle attribute)
RemoveMaterialIdsRemoves the MaterialIds field in the triangles. (Field name: "MaterialIds", Tuple size: 1 , Stored as: triangle attribute)
RemoveNamedColorsRemoves a named Color field in the corners. (Field name: "Colors0" - "Colors255", Tuple size: 4 , Stored as: Corner attribute)
RemoveNamedTexCoordsRemoves a named TexCoords field in the corners. 'TexCoords0' - 'TexCoords255' (Field name: "TexCoords0" - "TexCoords255", Tuple size: 2 , Stored as: Corner attribute)
RemoveNormalsRemoves the Normals field in the corners. (Field name: "Normals" , Tuple size: 3 , Stored as: Corner attribute)
RemoveObserverRemoves a previously added observer object. (Inherited from Object)
RemoveQuadFlagsRemoves the QuadFlags field in the triangles. Quad flags are used to map sequential triangles to quads for the quad reduction processor using the values SG_QUADFLAG_FIRST, SG_QUADFLAG_SECOND to denote triangles in a quad, and SG_QUADFLAG_TRIANGLE to denote true triangles. (Field name: "QuadFlags" , Tuple size: 1 , Stored as: Triangle attribute)
RemoveTangentsRemoves Tangents and Bitangents fields in the corners. The valid id range of the level parameter is 0-255. (Field names: "Tangents0" - "Tangents255" & "Bitangents0" - "Bitangents255", Tuple size: 3 , Stored as: Corner attribute)
RemoveTexCoordsRemoves a TexCoords field in the corners. The valid id range of the level parameter is 0-255, which equals fields 'TexCoords0' - 'TexCoords255' (Field name: "TexCoords0" - "TexCoords255", Tuple size: 2 , Stored as: Corner attribute)
RemoveUserCornerFieldRemoves a user-specified corner field.
RemoveUserTriangleFieldRemoves a user-specified triangle field.
RemoveUserVertexFieldRemoves a user-specified vertex field.
RemoveVertexLocksRemoves the VertexLocks field for the vertices. If the value for a vertex is true, then the vertex should be locked, and not be removed in the collapse-process. (Field name: "VertexLocks", Tuple size: 1 , Stored as: Vertex attribute)
RemoveVertexWeightsRemoves the VertexWeights field for the vertices. The weights are used to determine how important it is to keep the vertices when the geometry is reduced. 1 means the weight won't change the importance, values closer to 0 means it will be less important, values > 1 means the vertex is more important and less probable to be removed. (Field name: "VertexWeights", Tuple size: 1 , Stored as: Vertex attribute)
RepairQuadFlagsRepair ill-defined quadrilaterals in the GeometryData by decomposing them to triangles. Only the QuadFlags field is (potentially) modified, all other fields are guaranteed to remain unmodified.
SetInfThe inferior (minimum) extent of the geometry.
SetSupThe superior (maximum) extent of the geometry.
TransformTransforms the geometry using the supplied matrix transformation. The fields that are modified are the Coords field of Vertices, as well as the Normals and all Tangent and Bi-tangent fields of the Corners.
ValidateQuadFlagsValidates the sanity of the QuadFlags field and the underlying triangle- and corner-structures used to implicitly define quadrilaterals. If validation fails, further details can be found in the log.
WeldWelds all vertices in the geometry that are closer than the welding threshold. Non-referenced vertices will not be removed, only the vertex indices will be remapped. Call Compact() to clean up the geometry and free up memory.

Static methods

MethodDescription
IsClassAReturns true if the class is a or is a descendant of the class named as the type parameter. (Inherited from Object)
SafeCastSafeCast makes sure the input object is of a class that can be cast into spGeometryData, and if this is the case, returns the object cast into spGeometryData. (Inherited from Object)

Properties details

Name

The name of the GeometryData object. (Inherited from Object)

TriangleCount

The number of triangles in the geometry. The number of corners is always set to (TriangleCount*3), so there is no specific method to set the number of corners.

VertexCount

The number of vertices in the geometry.

Methods details

AddBaseTypeCustomField

Adds an empty custom field. To be able to add a field, it must have a name that does not conflict with the existing custom fields.

AddBaseTypeUserCornerField

Adds an empty user-specified corner field.

AddBaseTypeUserTriangleField

Adds an empty user-specified triangle field.

AddBaseTypeUserVertexField

Adds a user-specified vertex field. To be able to add a field, it must have a name that does not conflict with the existing vertex fields.

AddBoneWeights

Adds the BoneWeights and BoneIds fields in the vertices. The BoneWeights and BoneIds fields are added and removed in unison, and should always be the same tuple size. (Field names: "BoneWeights" & "BoneIds", Tuple size: varying , Stored as: Vertex attribute)

AddColors

The vertex colors in the input channel from the corners the geometry. The valid id range of the channel parameter is 0-255, which equals fields 'Colors0' - 'Colors255' (Field name: 'Color0'-'Color255' which is stored as attribute per corner)

AddCustomField

Adds a custom field. To be able to add a field, it must have a name that does not conflict with the existing custom fields.

AddGroupIds

Adds the GroupIds field in the triangles. (Field name: "GroupIds", Tuple size: 1 , Stored as: triangle attribute)

AddMaterialIds

Adds the MaterialIds field in the triangles. (Field name: "MaterialIds", Tuple size: 1 , Stored as: triangle attribute)

AddNamedColors

Adds a named Color field in the corners. (Field name: "Colors0" - "Colors255", Tuple size: 4 , Stored as: Corner attribute)

AddNamedTexCoords

Adds a named TexCoords field in the corners. (Field name: "TexCoords0" - "TexCoords255", Tuple size: 2 , Stored as: Corner attribute)

AddNormals

Adds the Normals field in the corners. (Field name: "Normals" , Tuple size: 3 , Stored as: Corner attribute)

AddObserver

Adds a user-defined observer object to the interface, that will receive events from the interface. (Inherited from Object)

AddQuadFlags

Adds the QuadFlags field in the triangles. Quad flags are used to map sequential triangles to quads for the quad reduction processor using the values SG_QUADFLAG_FIRST, SG_QUADFLAG_SECOND to denote triangles in a quad, and SG_QUADFLAG_TRIANGLE to denote true triangles. (Field name: "QuadFlags" , Tuple size: 1 , Stored as: Triangle attribute)

AddTangents

Adds Tangents and Bitangents fields in the corners. The valid id range of the level parameter is 0-255. (Field names: "Tangents0" - "Tangents255" & "Bitangents0" - "Bitangents255", Tuple size: 3 , Stored as: Corner attribute)

AddTexCoords

Adds a TexCoords field in the corners. The valid id range of the level parameter is 0-255, which equals fields 'TexCoords0' - 'TexCoords255' (Field name: "TexCoords0" - "TexCoords255", Tuple size: 2 , Stored as: Corner attribute)

AddTriangles

AddTriangles increases the triangle count by the specified value.

AddUserCornerField

Adds a user-specified corner field. To be able to add a field, it must have a name that does not conflict with the existing corner fields.

AddUserTriangleField

Adds a user-specified triangle field. To be able to add a field, it must have a name that does not conflict with the existing triangle fields.

AddUserVertexField

Adds a user-specified vertex field. To be able to add a field, it must have a name that does not conflict with the existing vertex fields.

AddVertexLocks

Adds the VertexLocks field for the vertices. If the value for a vertex is true, then the vertex should be locked, and not be removed in the collapse-process. (Field name: "VertexLocks", Tuple size: 1 , Stored as: Vertex attribute)

AddVertexWeights

Adds the VertexWeights field for the vertices. The weights are used to determine how important it is to keep the vertices when the geometry is reduced. 1 means the weight won't change the importance, values closer to 0 means it will be less important, values > 1 means the vertex is more important and less probable to be removed. (Field name: "VertexWeights", Tuple size: 1 , Stored as: Vertex attribute)

AddVertices

Increases the vertex count by the specified value.

AppendGeometry

Appends the geometry data to this geometry. This geometry will contain all triangles and vertices of both geometries. The VertexIds that are copied from the source are remapped to point at the vertices, which are appended to the end of the current vertices. Any field in the appended geometry that does not exist in this geometry will be added, with the tuples that are added set to 0. The method will fail if the source geometry has identically named fields, but with different tuple sizes or base types.

CalculateExtents

Calculate the extents by checking the coordinates of all vertices in the geometry. Set only_triangles to true to test only vertices that are indexed by a triangle. This is a slower test, and the bounding box may not encompass all vertices' positions. the new extents are found by calling GetInf() and GetSup() afterwards.

ChangeWinding

Change winding.

CleanupInvalidTriangles

Finds triangles that contain the same vertex more than once, and invalidates them, ie. sets all the vertex id references to -1. These triangles can be culled using Compact().

CleanupNanValues

Finds all Nan (1.#IND, 1.#INF etc) values in the real/float/double arrays in the GeometryData, and sets them to 0.0 just to make sure all numbers in the GeometryData are legit. Should not be needed if all the data loaded into the GeometryData object is ok to begin with.

Compact

Removes invalid triangles and vertices not referenced by any triangle. If any vertices are removed, the triangles will be remapped to the new compacted vertex field.

ConvertHandedness

Converts the handedness of the triangle winding, coords, normals and texture coordinates of the geometry from left-handed to right-handed coordinate systems and vice versa. Simplygon generally uses right-handed coordinates, so this conversion needs to be done before processing any left-handed geometry.

CopyCombine3Corners

Combines three corners via barycentric coordinates. alpha_3 = 1-(alpha_1 + alpha_2) dest = src_1*alpha_1 + src_2*alpha_2 + src_3*alpha_3.

CopyCombine3Triangles

Combines the fields of three triangles via barycentric coordinates. alpha_3 = 1-(alpha_1 + alpha_2) dest = src_1*alpha_1 + src_2*alpha_2 + src_3*alpha_3.

CopyCombine3Vertices

Combines the fields of three vertices via barycentric coordinates. alpha_3 = 1-(alpha_1 + alpha_2) dest = src_1*alpha_1 + src_2*alpha_2 + src_3*alpha_3.

CopyCombineCorners

Combines the fields of two corners by linear interpolation into the destination corner.

CopyCombineTriangles

Combines the fields of two triangles by linear interpolation into the destination triangle.

CopyCombineVertices

Combines the fields of two vertices by linear interpolation into the destination vertex.

CopyCorner

Copies all fields in the specified corner in the source geometry to the destination corner in this geometry .

CopyTriangle

Copies all fields in the specified triangle in the source geometry to the destination triangle in this geometry.

CopyVertex

Copies all fields in the specified vertex in the source geometry to the destination vertex in this geometry.

CreateAABB

Returns an axis aligned bounding box GeometryData of this geometry.

DeduplicateVertices

Removes redundant duplication of vertex data, so any vertices containing the exact same information are merged, and the triangle VertexIds field will be remapped to the new values.

DeepCopy

Copies the field setup and data from another object into this object. To only copy the setup, set copy_data to false.

DetectEdgeNeighbors

Detect triangle edge neighbors. Neighbor ids are stored in the "SgEdgeNeighbors" Corner field.

ExpandVertices

Expands the Vertices field data so that there exists one vertex for each of the three corners of each triangle in the geometry. The vertices will be organized identical to the Corners field. The triangles will be remapped to use the new vertices correctly. Expanding the vertex field is required to be able to extract a range of the geometry, and to be able to stream it. Note! This will lead to increased memory requirement, as vertex data is not shared among neighboring triangles. It also removes the connectivity information of the triangles, and effectively detaches all triangles from one another. This call may replace fields in the Vertices field data. Re-query any previously cached field pointer after the call. All user fields are copied as well.

ExtentsContainCoords

Tests if the extents of the geometry fully contain all vertex coordinates. Note! ExtentsContainCoords() checks all vertices in the geometry, regardless to whether the vertex is referenced by any triangle. Use Compact() to remove any non-referenced vertex before calling ExtentsContainCoords.

ExtractRange

Extracts a range of triangles with their vertices from the geometry. ExpandVertices() must first be called for the extraction to succeed. ExtractGeometry() can be used to stream geometries in chunks. If writing to a stream, the extracted geometry is guaranteed to have the same setup as the original. Any previous data in the destination will be deleted.

ExtractTriangles

Extracts specified triangles from the geometry. The destination geometry will contain the triangles and vertices. The vertices in the destination will be expanded so that there exists one vertex for each of the three corners of each triangle in the geometry.

FindEdgeIdsFromVertexPairs

Each tuple in the "vertex_pairs" array contains the start-vertex and end-vertex of a half-edge in the geometry. If a half-edge is found from a tuple in the "vertex_pairs" array, the edge-id of that half-edge will be stored in the edge_ids array. Do note: the half-edges are directed, so if you want all half-edges that contains 2 vertices, you need to add the tuple twice.

FindNamedColorsIndex

Returns the level index of the colors field with the name returns -1 if not found.

FindNamedTexCoordsIndex

Returns the level index of the texcoord field with the name returns -1 if not found.

GetAttributeTessellation

Get the attribute tessellation data object of the geometry

GetBitangents

Gets a Bitangents field in the corners. The valid id range of the level parameter is 0-255. (Field name: "Bitangents0" - "Bitangents255", Tuple size: 3 , Stored as: Corner attribute)

GetBoneIds

The BoneIds fields in the vertices. (Field name: "BoneIds", Tuple size: varying , Stored as: Vertex attribute)

GetBoneWeights

The BoneWeights field in the vertices. (Field name: "BoneWeights", Tuple size: varying , Stored as: Vertex attribute)

GetClass

Get the name of the GeometryData class. (Inherited from Object)

GetColors

Gets a Color field in the corners. The valid id range of the level parameter is 0-255, which equals fields 'Colors0' - 'Colors255' (Field name: "Colors0" - "Colors255", Tuple size: 4 , Stored as: Corner attribute)

GetCoords

The Coords field in the vertices. (Field name: "Coords", Tuple size: 3 , Stored as: Vertex attribute)

GetCorners

Retrieves the IFieldData object that contains the corner fields.

GetCustomField

Gets a custom field.

GetExtents

Get the extents object in the geometry.

GetGroupIds

The GroupIds field in the triangles. (Field name: "GroupIds", Tuple size: 1 , Stored as: triangle attribute)

GetInf

The inferior (minimum) extent of the geometry.

GetMaterialIds

The MaterialIds field in the triangles. (Field name: "MaterialIds", Tuple size: 1 , Stored as: triangle attribute)

GetNamedColors

Gets a Color field, using the alternative name instead of the index.

GetNamedOrIndexedBitangents

Gets a bitangents field, first trying to match the name of the field (GetAlternativeName) and if no field is found, tries to convert the input string to an index of the field. If no field is found, null is returned.

GetNamedOrIndexedColors

Gets a colors field, first trying to match the name of the field (GetAlternativeName) and if no field is found, tries to convert the input string to an index of the field. If no field is found, null is returned.

GetNamedOrIndexedTangents

Gets a tangents field, first trying to match the name of the field (GetAlternativeName) and if no field is found, tries to convert the input string to an index of the field. If no field is found, null is returned.

GetNamedOrIndexedTexCoords

Gets a TexCoords field, first trying to match the name of the field (GetAlternativeName) and if no field is found, tries to convert the input string to an index of the field. If no field is found, null is returned.

GetNamedTexCoords

Gets a TexCoords field, using the alternative name instead of the index.

GetNormals

The Normals field in the corners. (Field name: "Normals" , Tuple size: 3 , Stored as: Corner attribute)

GetQuadFlags

Get the QuadFlags triangle field. Quad flags are used to map sequential triangles to quads for the quad reduction processor using the values SG_QUADFLAG_FIRST, SG_QUADFLAG_SECOND to denote triangles in a quad, and SG_QUADFLAG_TRIANGLE to denote true triangles. (Field name: "QuadFlags" , Tuple size: 1 , Stored as: Triangle attribute)

GetSup

The superior (maximum) extent of the geometry.

GetTangents

Gets a Tangents field in the corners. The valid id range of the level parameter is 0-255. (Field name: "Tangents0" - "Tangents255", Tuple size: 3 , Stored as: Corner attribute)

GetTexCoords

Gets a TexCoords field in the corners. The valid id range of the level parameter is 0-255, which equals fields 'TexCoords0' - 'TexCoords255' (Field name: "TexCoords0" - "TexCoords255", Tuple size: 2 , Stored as: Corner attribute).

GetTriangles

Retrieves the IFieldData object that contains the triangle fields.

GetUserCornerField

Gets a user-specified corner field.

GetUserTriangleField

Gets a user-specified triangle field.

GetUserVertexField

Gets a user-specified vertex field.

GetVertexIds

The VertexIds field in the corners.

GetVertexLocks

The VertexLocks field for the vertices. If the value for a vertex is true, then the vertex should be locked, and not be removed in the collapse-process. (Field name: "VertexLocks", Tuple size: 1 , Stored as: Vertex attribute)

GetVertexWeights

The VertexWeights field for the vertices. The weights are used to determine how important it is to keep the vertices when the geometry is reduced. 1 means the weight won't change the importance, values closer to 0 means it will be less important, values > 1 means the vertex is more important and less probable to be removed. (Field name: "VertexWeights", Tuple size: 1 , Stored as: Vertex attribute)

GetVertices

Retrieves the IFieldData object that contains the vertex fields.

HasAttributeTessellation

Returns true if the geometry data has an attribute tessellation data object.

IsA

Returns true if GeometryData is a or is a descendant of the class named as the type parameter. (Inherited from Object)

IsNull

Returns true if the GeometryData object is invalid. (Inherited from Object)

IsSameObjectAs

Returns true if the GeometryData object is valid. (Inherited from Object)

NewCopy

Creates another geometry data object with the same field setup. To also copy the data to the new object, set copy_data to true.

NewPackedCopy

Creates a "packed" PackedGeometryData object, where all fields in the Corner field data object is moved to the vertex field data object. Please note that the vertex field data object will be enlarged to accommodate for data in a vertex shared by multiple triangles, where the corner data differs between the triangles. The method will fail if a Corner field is named the same as an existing Vertices field, please make sure to remove any such field before calling the method.

NonNull

Returns true if the GeometryData object is valid. (Inherited from Object)

PrintInfo

Prints the content/info of the GeometryData object to the log. (Inherited from Object)

RemoveAttributeTessellation

Removes attribute tessellation data from the geometry data. Note that this removes all data, including the tessellation levels of each base triangle, as well as any allocated attribute field.

RemoveBoneWeights

Removes the BoneWeights and BoneIds fields in the vertices. The BoneWeights and BoneIds fields are added and removed in unison, and should always be the same tuple size. (Field names: "BoneWeights" & "BoneIds", Tuple size: varying , Stored as: Vertex attribute)

RemoveColors

Removes a Color field in the corners. The valid id range of the level parameter is 0-255, which equals fields 'Colors0' - 'Colors255' (Field name: "Colors0" - "Colors255", Tuple size: 4 , Stored as: Corner attribute)

RemoveCustomField

Removes a custom field.

RemoveGroupIds

Removes the GroupIds field in the triangles. (Field name: "GroupIds", Tuple size: 1 , Stored as: triangle attribute)

RemoveMaterialIds

Removes the MaterialIds field in the triangles. (Field name: "MaterialIds", Tuple size: 1 , Stored as: triangle attribute)

RemoveNamedColors

Removes a named Color field in the corners. (Field name: "Colors0" - "Colors255", Tuple size: 4 , Stored as: Corner attribute)

RemoveNamedTexCoords

Removes a named TexCoords field in the corners. 'TexCoords0' - 'TexCoords255' (Field name: "TexCoords0" - "TexCoords255", Tuple size: 2 , Stored as: Corner attribute)

RemoveNormals

Removes the Normals field in the corners. (Field name: "Normals" , Tuple size: 3 , Stored as: Corner attribute)

RemoveObserver

Removes a previously added observer object. (Inherited from Object)

RemoveQuadFlags

Removes the QuadFlags field in the triangles. Quad flags are used to map sequential triangles to quads for the quad reduction processor using the values SG_QUADFLAG_FIRST, SG_QUADFLAG_SECOND to denote triangles in a quad, and SG_QUADFLAG_TRIANGLE to denote true triangles. (Field name: "QuadFlags" , Tuple size: 1 , Stored as: Triangle attribute)

RemoveTangents

Removes Tangents and Bitangents fields in the corners. The valid id range of the level parameter is 0-255. (Field names: "Tangents0" - "Tangents255" & "Bitangents0" - "Bitangents255", Tuple size: 3 , Stored as: Corner attribute)

RemoveTexCoords

Removes a TexCoords field in the corners. The valid id range of the level parameter is 0-255, which equals fields 'TexCoords0' - 'TexCoords255' (Field name: "TexCoords0" - "TexCoords255", Tuple size: 2 , Stored as: Corner attribute)

RemoveUserCornerField

Removes a user-specified corner field.

RemoveUserTriangleField

Removes a user-specified triangle field.

RemoveUserVertexField

Removes a user-specified vertex field.

RemoveVertexLocks

Removes the VertexLocks field for the vertices. If the value for a vertex is true, then the vertex should be locked, and not be removed in the collapse-process. (Field name: "VertexLocks", Tuple size: 1 , Stored as: Vertex attribute)

RemoveVertexWeights

Removes the VertexWeights field for the vertices. The weights are used to determine how important it is to keep the vertices when the geometry is reduced. 1 means the weight won't change the importance, values closer to 0 means it will be less important, values > 1 means the vertex is more important and less probable to be removed. (Field name: "VertexWeights", Tuple size: 1 , Stored as: Vertex attribute)

RepairQuadFlags

Repair ill-defined quadrilaterals in the GeometryData by decomposing them to triangles. Only the QuadFlags field is (potentially) modified, all other fields are guaranteed to remain unmodified.

SetInf

The inferior (minimum) extent of the geometry.

SetSup

The superior (maximum) extent of the geometry.

Transform

Transforms the geometry using the supplied matrix transformation. The fields that are modified are the Coords field of Vertices, as well as the Normals and all Tangent and Bi-tangent fields of the Corners.

ValidateQuadFlags

Validates the sanity of the QuadFlags field and the underlying triangle- and corner-structures used to implicitly define quadrilaterals. If validation fails, further details can be found in the log.

Weld

Welds all vertices in the geometry that are closer than the welding threshold. Non-referenced vertices will not be removed, only the vertex indices will be remapped. Call Compact() to clean up the geometry and free up memory.

Static methods details

IsClassA

Returns true if the class is a or is a descendant of the class named as the type parameter. (Inherited from Object)

SafeCast

SafeCast makes sure the input object is of a class that can be cast into spGeometryData, and if this is the case, returns the object cast into spGeometryData. (Inherited from Object)