opensurgsim
|
Common part of implementation of PlyReaderDelegate for MassSpringRepresentations. More...
#include <MassSpringPlyReaderDelegate.h>
Classes | |
struct | ElementData |
Internal data to receive the element (nodeId) data. More... | |
struct | MassData |
Mass data containing 3 translational dofs and mass. More... | |
struct | SpringData |
Internal data to receive the spring (stretching and bending) data. More... | |
Public Member Functions | |
MassSpringPlyReaderDelegate () | |
Default constructor. | |
MassSpringPlyReaderDelegate (std::shared_ptr< MassSpringModel > mesh) | |
Constructor. | |
![]() | |
virtual | ~PlyReaderDelegate () |
Virtual destructor. | |
Protected Member Functions | |
bool | registerDelegate (SurgSim::DataStructures::PlyReader *reader) override |
Registers the delegate with the reader. More... | |
bool | fileIsAcceptable (const SurgSim::DataStructures::PlyReader &reader) override |
Check whether the file in the reader can be used with this delegate, this gives the delegate a chance to make sure that all the elements and properties that are required are available in the file encapsulated by the reader. | |
virtual void | endParseFile () |
Callback for end of PlyReader::parseFile. | |
virtual void * | beginVertices (const std::string &elementName, size_t vertexCount) |
Callback function, begin the processing of vertices. More... | |
virtual void | processVertex (const std::string &elementName) |
Callback function to process one vertex. More... | |
virtual void | endVertices (const std::string &elementName) |
Callback function to finalize processing of vertices. More... | |
void * | beginElements (const std::string &elementName, size_t elementCount) |
Callback function, begin the processing of Elements. More... | |
virtual void | processElement (const std::string &elementName) |
Callback function to process one Element. More... | |
void | endElements (const std::string &elementName) |
Callback function to finalize processing of Elements. More... | |
void * | beginSprings (const std::string &elementName, size_t elementCount) |
Callback function, begin the processing of Springs. More... | |
virtual void | processSpring (const std::string &elementName) |
Callback function to process one Spring. More... | |
void | endSprings (const std::string &elementName) |
Callback function to finalize processing of Springs. More... | |
void * | beginBoundaryConditions (const std::string &elementName, size_t boundaryConditionCount) |
Callback function, begin the processing of boundary conditions. More... | |
virtual void | processBoundaryCondition (const std::string &elementName) |
Callback function to process one boundary condition. More... | |
void * | beginRadius (const std::string &elementName, size_t radiusCount) |
Callback function, begin the processing of radius. More... | |
void | endRadius (const std::string &elementName) |
Callback function, end the processing of radius. More... | |
void * | beginThickness (const std::string &elementName, size_t thicknessCount) |
Callback function, begin the processing of thickness. More... | |
void | endThickness (const std::string &elementName) |
Callback function, end the processing of thickness. More... | |
Protected Attributes | |
struct SurgSim::Physics::MassSpringPlyReaderDelegate::MassData | m_massData |
bool | m_hasBoundaryConditions = false |
Flag indicating if the associated file has boundary conditions. | |
unsigned int | m_boundaryConditionData = 0 |
Internal data to receive the "boundary_condition" element. | |
bool | m_has1dElement = false |
Flag indicating if the associated file has 1d elements. | |
bool | m_has2dElement = false |
Flag indicating if the associated file has 2d elements. | |
bool | m_has3dElement = false |
Flag indicating if the associated file has 3d elements. | |
struct SurgSim::Physics::MassSpringPlyReaderDelegate::ElementData | m_elementData |
struct SurgSim::Physics::MassSpringPlyReaderDelegate::SpringData | m_springData |
bool | m_hasRadius = false |
Flag indicating if the associated file has a radius. | |
double | m_radius = std::numeric_limits<double>::signaling_NaN() |
Radius information, if any. | |
bool | m_hasThickness = false |
Flag indicating if the associated file has a thickness. | |
double | m_thickness = std::numeric_limits<double>::signaling_NaN() |
Thickness information, if any. | |
std::shared_ptr< MassSpringModel > | m_mesh |
MassSpringModel to contain the ply file information. | |
Common part of implementation of PlyReaderDelegate for MassSpringRepresentations.
In order for the same ply file to load with TriangleMeshPlyReaderDelegate (e.g., to create the graphics for a SegmentMesh or to match the shape in a CollisionRep), there must be elements named (for example) 1d_element, that have appropriate vertex_indices. See MassSpringRepresentation::saveMassSpringModel() or MassSpring::saveMassSpringModel() to create a valid ply file.
Example file that can also be loaded into a SegmentMesh; the third spring resists bending about the middle vertex: ply format ascii 1.0 element vertex 3 property double x property double y property double z property double mass element 1d_element 2 property list uint uint vertex_indices element spring 3 property list uint uint vertex_indices property double stiffness property double damping element boundary_condition 0 property uint vertex_index element radius 1 property double value end_header -0.02 -0.04 -0.001 0.001 -0.01 -0.03 -0.00075 0.002 0.0 0.0 0.0 0.002 2 0 1 2 1 2 2 0 1 5 10 2 1 2 5 10 2 0 2 3 10 0.001
This PlyReaderDelegate can load 1d_element, 2d_element, or 3d_element, passing the vectors of nodes to the MassSpringModel. Similarly, it can load radius or thickness.
|
protected |
Callback function, begin the processing of boundary conditions.
elementName | Name of the element. |
boundaryConditionCount | Number of boundary conditions. |
|
protected |
Callback function, begin the processing of Elements.
elementName | Name of the element. |
elementCount | Number of elements. |
|
protected |
Callback function, begin the processing of radius.
elementName | Name of the element. |
radiusCount | Number of radii. |
|
protected |
Callback function, begin the processing of Springs.
elementName | Name of the element. |
elementCount | Number of elements. |
|
protected |
Callback function, begin the processing of thickness.
elementName | Name of the element. |
thicknessCount | Number of radii. |
|
protectedvirtual |
Callback function, begin the processing of vertices.
elementName | Name of the element. |
vertexCount | Number of vertices. |
|
protected |
Callback function to finalize processing of Elements.
elementName | Name of the element. |
|
protected |
Callback function, end the processing of radius.
elementName | Name of the element. |
|
protected |
Callback function to finalize processing of Springs.
elementName | Name of the element. |
|
protected |
Callback function, end the processing of thickness.
elementName | Name of the element. |
|
protectedvirtual |
Callback function to finalize processing of vertices.
elementName | Name of the element. |
|
protectedvirtual |
Callback function to process one boundary condition.
elementName | Name of the element. |
|
protectedvirtual |
Callback function to process one Element.
elementName | Name of the element. |
|
protectedvirtual |
Callback function to process one Spring.
elementName | Name of the element. |
|
protectedvirtual |
Callback function to process one vertex.
elementName | Name of the element. |
|
overrideprotectedvirtual |
Registers the delegate with the reader.
[out] | reader | The reader that should be used by the delegate. |
Implements SurgSim::DataStructures::PlyReaderDelegate.