Struct ConvexHullBuilder
Syntax
public struct ConvexHullBuilder : IDisposable
Constructors
ConvexHullBuilder(Int32, Int32, Allocator)
Create using internal storage.
Declaration
public ConvexHullBuilder(int verticesCapacity, int trianglesCapacity, Allocator allocator = null)
Parameters
Type |
Name |
Description |
System.Int32 |
verticesCapacity |
|
System.Int32 |
trianglesCapacity |
|
Allocator |
allocator |
|
ConvexHullBuilder(ConvexHullBuilder.Vertex*, Int32, ConvexHullBuilder.Triangle*, Int32)
Create using external storage.
Declaration
public ConvexHullBuilder(ConvexHullBuilder.Vertex*vertices, int verticesCapacity, ConvexHullBuilder.Triangle*triangles, int triangleCapacity)
Parameters
Fields
Triangles
Declaration
public ElementPool<ConvexHullBuilder.Triangle> Triangles
Field Value
Vertices
Declaration
public ElementPool<ConvexHullBuilder.Vertex> Vertices
Field Value
Properties
Dimension
Declaration
public int Dimension { get; }
Property Value
Type |
Description |
System.Int32 |
|
IntegerSpaceAabb
Declaration
public Aabb IntegerSpaceAabb { get; set; }
Property Value
NumFaces
Declaration
public int NumFaces { get; }
Property Value
Type |
Description |
System.Int32 |
|
NumFaceVertices
Declaration
public int NumFaceVertices { get; }
Property Value
Type |
Description |
System.Int32 |
|
ProjectionPlane
Declaration
public Plane ProjectionPlane { get; }
Property Value
Methods
AddPoint(float3, UInt32)
Add a point the the convex hull.
Declaration
public bool AddPoint(float3 point, uint userData = 0U)
Parameters
Type |
Name |
Description |
float3 |
point |
Point to insert.
|
System.UInt32 |
userData |
User data attached to the new vertex if insertion succeeds.
|
Returns
Type |
Description |
System.Boolean |
true if the insertion succeeded, false otherwise.
|
ApexVertex(ConvexHullBuilder.Edge)
Declaration
public int ApexVertex(ConvexHullBuilder.Edge edge)
Parameters
Returns
Type |
Description |
System.Int32 |
|
BuildFaceIndices(Single)
Set the face index for each triangle.
Triangles lying in the same plane will have the same face index.
Declaration
public void BuildFaceIndices(float maxAngle = 0.0174532924F)
Parameters
Type |
Name |
Description |
System.Single |
maxAngle |
|
ComputeAabb()
Returns the AABB of the convex hull.
Declaration
public Aabb ComputeAabb()
Returns
ComputeCentroid()
Returns the centroid of the convex hull.
Declaration
public float3 ComputeCentroid()
Returns
ComputeMassProperties()
Declaration
public ConvexHullBuilder.MassProperties ComputeMassProperties()
Returns
ComputePlane(Int32, Boolean)
Declaration
public Plane ComputePlane(int triangleIndex, bool fromIntCoordinates = true)
Parameters
Type |
Name |
Description |
System.Int32 |
triangleIndex |
|
System.Boolean |
fromIntCoordinates |
|
Returns
ComputeSupportingVertex(float3)
Returns the supporting vertex index in a given direction.
Declaration
public int ComputeSupportingVertex(float3 direction)
Parameters
Type |
Name |
Description |
float3 |
direction |
|
Returns
Type |
Description |
System.Int32 |
|
ComputeVertexNormal(Int32)
Declaration
public float3 ComputeVertexNormal(int vertex)
Parameters
Type |
Name |
Description |
System.Int32 |
vertex |
|
Returns
ComputeVertexNormal(ConvexHullBuilder.Edge)
Declaration
public float3 ComputeVertexNormal(ConvexHullBuilder.Edge edge)
Parameters
Returns
CopyFrom(ConvexHullBuilder)
Copy the content of another convex hull into this one.
Declaration
public void CopyFrom(ConvexHullBuilder other)
Parameters
Dispose()
Dispose internal convex hull storages if any.
Declaration
EndVertex(ConvexHullBuilder.Edge)
Declaration
public int EndVertex(ConvexHullBuilder.Edge edge)
Parameters
Returns
Type |
Description |
System.Int32 |
|
GetFirstFace()
Returns (the first edge of) the first face.
Declaration
public ConvexHullBuilder.FaceEdge GetFirstFace()
Returns
GetFirstFace(Int32)
Returns the first face edge from a given face index.
Declaration
public ConvexHullBuilder.FaceEdge GetFirstFace(int faceIndex)
Parameters
Type |
Name |
Description |
System.Int32 |
faceIndex |
|
Returns
GetFirstPrimaryEdge()
Declaration
public ConvexHullBuilder.Edge GetFirstPrimaryEdge()
Returns
GetLinkedEdge(ConvexHullBuilder.Edge)
Returns an edge's linked edge on the neighboring triangle.
Declaration
public ConvexHullBuilder.Edge GetLinkedEdge(ConvexHullBuilder.Edge edge)
Parameters
Returns
GetNextFace(ConvexHullBuilder.FaceEdge)
Returns (the first edge of) the next face.
Declaration
public ConvexHullBuilder.FaceEdge GetNextFace(ConvexHullBuilder.FaceEdge fe)
Parameters
Returns
GetNextFaceEdge(ConvexHullBuilder.FaceEdge)
Returns the next edge within a face.
Declaration
public ConvexHullBuilder.FaceEdge GetNextFaceEdge(ConvexHullBuilder.FaceEdge fe)
Parameters
Returns
GetNextPrimaryEdge(ConvexHullBuilder.Edge)
Declaration
public ConvexHullBuilder.Edge GetNextPrimaryEdge(ConvexHullBuilder.Edge edge)
Parameters
Returns
GetVertexEdge(Int32)
Returns one of the triangle edges starting from a given vertex.
Note: May be one of the inner edges of a face.
Declaration
public ConvexHullBuilder.Edge GetVertexEdge(int vertexIndex)
Parameters
Type |
Name |
Description |
System.Int32 |
vertexIndex |
|
Returns
OffsetVertices(Single, Single)
Offset vertices with respect to the surface by a given amount while minimizing distortions.
Declaration
public void OffsetVertices(float surfaceOffset, float minRadius = 0F)
Parameters
Type |
Name |
Description |
System.Single |
surfaceOffset |
a positive value will move vertices outward while a negative value will push them toward the inside
|
System.Single |
minRadius |
Prevent vertices to be shrunk too much
|
RemoveRedundantVertices(Single)
Remove redundant (colinear, coplanar) vertices from a 3D convex hull.
Declaration
public void RemoveRedundantVertices(float minCosAngle = 0.999F)
Parameters
Type |
Name |
Description |
System.Single |
minCosAngle |
Assume that edges that form a angle smaller than this value are flat
|
Reset(Boolean)
Declaration
public void Reset(bool keepIntegerSpaceAabb = false)
Parameters
Type |
Name |
Description |
System.Boolean |
keepIntegerSpaceAabb |
|
SimplifyFaces(Single, Int32, Int32, Single)
Declaration
public void SimplifyFaces(float minError, int maxFaces = 2147483647, int maxVertices = 2147483647, float minAngle = 0F)
Parameters
Type |
Name |
Description |
System.Single |
minError |
Stop refining when the error is below this number (unit: distance)
|
System.Int32 |
maxFaces |
Maximum number of faces allowed.
|
System.Int32 |
maxVertices |
Maximum number of vertices allowed
|
System.Single |
minAngle |
Do not generate face that form an angle smaller than this value with its neighbors (unit: angle in radian)
|
SimplifyVertices(Single, Int32, Single)
Declaration
public void SimplifyVertices(float maxError, int minVertices = 0, float volumeConservation = 1F)
Parameters
Type |
Name |
Description |
System.Single |
maxError |
|
System.Int32 |
minVertices |
|
System.Single |
volumeConservation |
|
SplitByPlane(Plane, out ConvexHullBuilder, out ConvexHullBuilder, UInt32)
Split this convex hull by a plane.
Declaration
public void SplitByPlane(Plane plane, out ConvexHullBuilder negHull, out ConvexHullBuilder posHull, uint isecUserData = 0U)
Parameters
StartVertex(ConvexHullBuilder.Edge)
Declaration
public int StartVertex(ConvexHullBuilder.Edge edge)
Parameters
Returns
Type |
Description |
System.Int32 |
|
Extension Methods