AGX Dynamics 2.40.0.0
Loading...
Searching...
No Matches
agxUtil::SphereSkeletoniser Class Reference

A class capable of producing a sphere-skeleton from a trimesh through more granular operations. More...

#include <SphereMeshSkeletonisation.h>

Public Types

enum  UpscalingMethod { JOINT , EDGE , BOTH }
 

Public Member Functions

AGXPHYSICS_EXPORT SphereSkeletoniser (const agx::Vec3Vector &vertices, const agx::UInt32Vector &indices)
 Initialise a skeletoniser which will work on a given mesh.
 
AGXPHYSICS_EXPORT void addJoint (UpscalingMethod method=UpscalingMethod::BOTH)
 Shorthand for upscaling a by a single joint.
 
AGXPHYSICS_EXPORT void applyAverageRadius ()
 Applies the average radius of the remaining vertices to all the vertices.
 
AGXPHYSICS_EXPORT void applyRadius (agx::Real radius)
 Applies the radius as the radius of the remaining vertices.
 
AGXPHYSICS_EXPORT bool collapseNext ()
 Collapses the next optimal choice of edge.
 
AGXPHYSICS_EXPORT void collapseUntilSkeleton ()
 Collapses the mesh until a skeletal structure is reached.
 
AGXPHYSICS_EXPORT void consolidateSkeleton (SphereSkeleton &skeleton, double radiusFactor=2)
 Performs a pass over the nodes in the skeleton in the skeletoniser's current structure and attempts to collapse any nodes which sit below the given threshold in distance.
 
AGXPHYSICS_EXPORT double currentSkeletonResolution ()
 
AGXPHYSICS_EXPORT SphereSkeleton getSkeleton ()
 Constructs a sphere-skeleton from the current "meso-skeleton".
 
AGXPHYSICS_EXPORT agx::Vec3Vector getSurfacePoints (agx::UInt32 id)
 Returns a new vector containing all of the original vertices associated with the skeletoniser vertex with id id.
 
AGXPHYSICS_EXPORT bool isUpscalePossible (agx::UInt32 splitVertex)
 Checks if upscaling is possible on the given vertex.
 
AGXPHYSICS_EXPORT bool isUpscalePossible (agx::UInt32 v0, agx::UInt32 v1)
 Checks if upscaling is possible on the given edge.
 
AGXPHYSICS_EXPORT agx::Size remainingEdges ()
 
AGXPHYSICS_EXPORT agx::Size remainingTriangles ()
 
AGXPHYSICS_EXPORT agx::Size remainingVertices ()
 
AGXPHYSICS_EXPORT void removeVertex (const agx::Size indexToRemove, const bool cut=false)
 Removes the joint with the given index from the skeletoniser.
 
AGXPHYSICS_EXPORT void setFaceDevalueFactor (agx::Real devalueFactor)
 Sets the measure of much the skeletoniser prioritises collapsing faces.
 
AGXPHYSICS_EXPORT bool upscaleEdge (agx::UInt32 v0, agx::UInt32 v1, SphereSkeleton *skeletonFilter=nullptr)
 Create a new vertex in the meso-skeleton from the combined regions of an edge.
 
AGXPHYSICS_EXPORT bool upscaleJoint (agx::UInt32 splitVertex, SphereSkeleton *skeletonFilter=nullptr)
 
AGXPHYSICS_EXPORT void upscaleSkeleton (agx::Size targetNumJoints, UpscalingMethod method=UpscalingMethod::BOTH, SphereSkeleton *skeletonFilter=nullptr)
 Performs a pass over all edges in the current structure and attempts to upscale each edge.
 

Detailed Description

A class capable of producing a sphere-skeleton from a trimesh through more granular operations.

Definition at line 184 of file SphereMeshSkeletonisation.h.

Member Enumeration Documentation

◆ UpscalingMethod

Enumerator
JOINT 
EDGE 
BOTH 

Definition at line 235 of file SphereMeshSkeletonisation.h.

Constructor & Destructor Documentation

◆ SphereSkeletoniser()

AGXPHYSICS_EXPORT agxUtil::SphereSkeletoniser::SphereSkeletoniser ( const agx::Vec3Vector vertices,
const agx::UInt32Vector indices 
)

Initialise a skeletoniser which will work on a given mesh.

Parameters
verticesThe vertices of the mesh
indicesThe indices of the mesh (always 3 per triangle, see agxCollide/Trimesh.h)

Member Function Documentation

◆ addJoint()

AGXPHYSICS_EXPORT void agxUtil::SphereSkeletoniser::addJoint ( UpscalingMethod  method = UpscalingMethod::BOTH)

Shorthand for upscaling a by a single joint.

Parameters
methodThe means of upscaling. Can be per joint, per edge, or a combination of both.

◆ applyAverageRadius()

AGXPHYSICS_EXPORT void agxUtil::SphereSkeletoniser::applyAverageRadius ( )

Applies the average radius of the remaining vertices to all the vertices.

◆ applyRadius()

AGXPHYSICS_EXPORT void agxUtil::SphereSkeletoniser::applyRadius ( agx::Real  radius)

Applies the radius as the radius of the remaining vertices.

Parameters
radiusThe radius to apply

◆ collapseNext()

AGXPHYSICS_EXPORT bool agxUtil::SphereSkeletoniser::collapseNext ( )

Collapses the next optimal choice of edge.

Returns
True if an edge could be collapsed

◆ collapseUntilSkeleton()

AGXPHYSICS_EXPORT void agxUtil::SphereSkeletoniser::collapseUntilSkeleton ( )

Collapses the mesh until a skeletal structure is reached.

◆ consolidateSkeleton()

AGXPHYSICS_EXPORT void agxUtil::SphereSkeletoniser::consolidateSkeleton ( SphereSkeleton skeleton,
double  radiusFactor = 2 
)

Performs a pass over the nodes in the skeleton in the skeletoniser's current structure and attempts to collapse any nodes which sit below the given threshold in distance.

Parameters
skeletonThe skeleton who's joints will be consolidated in the skeletoniser
radiusFactorFactor by which to multiply the average radius between two nodes considered to produce the distance threshhold.

◆ currentSkeletonResolution()

AGXPHYSICS_EXPORT double agxUtil::SphereSkeletoniser::currentSkeletonResolution ( )
Returns
The current resolution (joints per length) of the meso-skeleton contained in the skeletoniser

◆ getSkeleton()

AGXPHYSICS_EXPORT SphereSkeleton agxUtil::SphereSkeletoniser::getSkeleton ( )

Constructs a sphere-skeleton from the current "meso-skeleton".

Will ignore any faces/triangles present in the meso-skeleton to guarantee a skeletal structure.

Returns
A SphereSkeleton object containing the joints of the skeleton with adjacency data

◆ getSurfacePoints()

AGXPHYSICS_EXPORT agx::Vec3Vector agxUtil::SphereSkeletoniser::getSurfacePoints ( agx::UInt32  id)

Returns a new vector containing all of the original vertices associated with the skeletoniser vertex with id id.

Parameters
idThe id of the skeletoniser vertex
Returns
A vector of points.

◆ isUpscalePossible() [1/2]

AGXPHYSICS_EXPORT bool agxUtil::SphereSkeletoniser::isUpscalePossible ( agx::UInt32  splitVertex)

Checks if upscaling is possible on the given vertex.

Parameters
splitVertexThe vertex at which to check
Returns
True or false

◆ isUpscalePossible() [2/2]

AGXPHYSICS_EXPORT bool agxUtil::SphereSkeletoniser::isUpscalePossible ( agx::UInt32  v0,
agx::UInt32  v1 
)

Checks if upscaling is possible on the given edge.

Parameters
v0Start of edge to check
v1End of edge to check
Returns
True or false

◆ remainingEdges()

AGXPHYSICS_EXPORT agx::Size agxUtil::SphereSkeletoniser::remainingEdges ( )
Returns
The remaining edges on the possibly non-manifold "meso-skeleton" contained in the skeletoniser

◆ remainingTriangles()

AGXPHYSICS_EXPORT agx::Size agxUtil::SphereSkeletoniser::remainingTriangles ( )
Returns
The remaining triangles/faces on the possibly non-manifold "meso-skeleton" contained in the skeletoniser

◆ remainingVertices()

AGXPHYSICS_EXPORT agx::Size agxUtil::SphereSkeletoniser::remainingVertices ( )
Returns
The remaining vertices on the possibly non-manifold "meso-skeleton" contained in the skeletoniser

◆ removeVertex()

AGXPHYSICS_EXPORT void agxUtil::SphereSkeletoniser::removeVertex ( const agx::Size  indexToRemove,
const bool  cut = false 
)

Removes the joint with the given index from the skeletoniser.

Removes data and does not merge faces or regions. Collapsing or upscaling after a removal will negatively affect the results of the skeletonisation in regards to the mesh.

Parameters
indexToRemoveThe index in the joint vector at which to remove a joint.
cutTrue if the edges from the joint should be deleted. True if the edges should be assigned to the closest neighbour.

◆ setFaceDevalueFactor()

AGXPHYSICS_EXPORT void agxUtil::SphereSkeletoniser::setFaceDevalueFactor ( agx::Real  devalueFactor)

Sets the measure of much the skeletoniser prioritises collapsing faces.

Higher values means a more aggressive skeletonisation but can lead to faulty joints in complex models. Lower prioritises simplifying the original shape of the mesh which can lead to loss of quality in the resulting skeleton.

Parameters
devalueFactorThe factor to devalue collapses which do not lead to a strictly skeletal structure with. Default = 10.

◆ upscaleEdge()

AGXPHYSICS_EXPORT bool agxUtil::SphereSkeletoniser::upscaleEdge ( agx::UInt32  v0,
agx::UInt32  v1,
SphereSkeleton skeletonFilter = nullptr 
)

Create a new vertex in the meso-skeleton from the combined regions of an edge.

Parameters
v0The id of the first vertex in the edge
v1The id of the second vertex in the edge
Precondition
The meso-skeleton contained is a full skeleton with no faces left.

◆ upscaleJoint()

AGXPHYSICS_EXPORT bool agxUtil::SphereSkeletoniser::upscaleJoint ( agx::UInt32  splitVertex,
SphereSkeleton skeletonFilter = nullptr 
)
Parameters
splitVertexThe id of the vertex which will have its region split into two vertices
Precondition
The meso-skeleton contained is a full skeleton with no faces left.

◆ upscaleSkeleton()

AGXPHYSICS_EXPORT void agxUtil::SphereSkeletoniser::upscaleSkeleton ( agx::Size  targetNumJoints,
UpscalingMethod  method = UpscalingMethod::BOTH,
SphereSkeleton skeletonFilter = nullptr 
)

Performs a pass over all edges in the current structure and attempts to upscale each edge.

Parameters
targetNumJointsThe target number of nodes in the skeleton.
methodThe means of upscaling. Can be per joint, per edge, or a combination of both.
skeletonFilterOptional parameter for filtering which vertices are considered. Only edges and vertices present in skeletonFilter will be upscaled.
Precondition
The meso-skeleton contained is a full skeleton with no faces left.

The documentation for this class was generated from the following file: