EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
EBGeometry::PLY< T > Class Template Reference

Class for storing Stanford PLY meshes. More...

#include <EBGeometry_PLY.hpp>

Collaboration diagram for EBGeometry::PLY< T >:
Collaboration graph
[legend]

Public Member Functions

 PLY () noexcept=default
 Default constructor. Initializes empty member data holder.
 
 PLY (const std::string &a_id) noexcept
 Constructor. Initializes empty vertices and facets but sets the PLY ID (usually the file name.
 
 PLY (const PLY &a_other)=default
 Copy constructor.
 
 PLY (PLY &&a_other) noexcept=default
 Move constructor.
 
PLYoperator= (const PLY &a_other)=default
 Copy assignment operator.
 
PLYoperator= (PLY &&a_other) noexcept=default
 Move assignment operator.
 
 ~PLY () noexcept=default
 Destructor (does nothing).
 
std::string & getID () noexcept
 Get the identifier for this object.
 
const std::string & getID () const noexcept
 Get the identifier for this object.
 
std::vector< Vec3T< T > > & getVertexCoordinates () noexcept
 Get the vertex coordinates.
 
const std::vector< Vec3T< T > > & getVertexCoordinates () const noexcept
 Get the vertex coordinates.
 
std::vector< std::vector< size_t > > & getFacets () noexcept
 Get the face indices.
 
const std::vector< std::vector< size_t > > & getFacets () const noexcept
 Get the face indices.
 
std::vector< T > & getVertexProperties (const std::string a_property)
 Get the vertex properties.
 
const std::vector< T > & getVertexProperties (const std::string a_property) const
 Get the vertex properties.
 
std::vector< T > & getFaceProperties (const std::string a_property)
 Get the face properties.
 
const std::vector< T > & getFaceProperties (const std::string a_property) const
 Get the face properties (const overload).
 
void setVertexProperties (const std::string a_property, std::vector< T > a_data)
 Set vertex properties.
 
void setFaceProperties (const std::string a_property, std::vector< T > a_data)
 Set face properties.
 
template<typename Meta >
std::shared_ptr< EBGeometry::DCEL::MeshT< T, Meta > > convertToDCEL () const noexcept
 Turn the PLY mesh into a DCEL mesh.
 

Protected Attributes

std::string m_id
 PLY object ID.
 
std::vector< Vec3T< T > > m_vertexCoordinates
 Vertex coordinates.
 
std::vector< std::vector< size_t > > m_facets
 Faces – each entry in the outer vector contains the indices defining one face.
 
std::map< std::string, std::vector< T > > m_vertexProperties
 Vertex properties.
 
std::map< std::string, std::vector< T > > m_faceProperties
 Face properties.
 

Detailed Description

template<typename T>
class EBGeometry::PLY< T >

Class for storing Stanford PLY meshes.

Template Parameters
TFloating-point precision for vertex coordinates and scalar properties.

Constructor & Destructor Documentation

◆ PLY() [1/3]

template<typename T >
EBGeometry::PLY< T >::PLY ( const std::string &  a_id)
noexcept

Constructor. Initializes empty vertices and facets but sets the PLY ID (usually the file name.

Parameters
[in]a_idIdentifier for PLY object

◆ PLY() [2/3]

template<typename T >
EBGeometry::PLY< T >::PLY ( const PLY< T > &  a_other)
default

Copy constructor.

Parameters
[in]a_otherOther PLY object.

◆ PLY() [3/3]

template<typename T >
EBGeometry::PLY< T >::PLY ( PLY< T > &&  a_other)
defaultnoexcept

Move constructor.

Parameters
[in,out]a_otherOther PLY object.

Member Function Documentation

◆ convertToDCEL()

template<typename T >
template<typename Meta >
std::shared_ptr< EBGeometry::DCEL::MeshT< T, Meta > > EBGeometry::PLY< T >::convertToDCEL ( ) const
noexcept

Turn the PLY mesh into a DCEL mesh.

This call does not populate any meta-data in the DCEL mesh structures. If you need to also populate the meta-data on vertices and faces, you should not use this function but supply your own constructor.

Template Parameters
MetaMetadata type attached to DCEL vertices, edges, and faces.
Returns
Shared pointer to the constructed DCEL mesh.

◆ getFaceProperties() [1/2]

template<typename T >
std::vector< T > & EBGeometry::PLY< T >::getFaceProperties ( const std::string  a_property)

Get the face properties.

Parameters
[in]a_propertyWhich property to fetch
Note
Function will throw std::out_of_range if the property does not exist
Returns
m_faceProperties at provided property

◆ getFaceProperties() [2/2]

template<typename T >
const std::vector< T > & EBGeometry::PLY< T >::getFaceProperties ( const std::string  a_property) const

Get the face properties (const overload).

Parameters
[in]a_propertyWhich property to fetch.
Note
Function will throw std::out_of_range if the property does not exist.
Returns
Const reference to the face property array at the provided name.

◆ getFacets() [1/2]

template<typename T >
const std::vector< std::vector< size_t > > & EBGeometry::PLY< T >::getFacets ( ) const
noexcept

Get the face indices.

Returns
m_facets

◆ getFacets() [2/2]

template<typename T >
std::vector< std::vector< size_t > > & EBGeometry::PLY< T >::getFacets ( )
noexcept

Get the face indices.

Returns
m_facets

◆ getID() [1/2]

template<typename T >
const std::string & EBGeometry::PLY< T >::getID ( ) const
noexcept

Get the identifier for this object.

Returns
Const reference to the PLY object identifier.

◆ getID() [2/2]

template<typename T >
std::string & EBGeometry::PLY< T >::getID ( )
noexcept

Get the identifier for this object.

Returns
Reference to the PLY object identifier.

◆ getVertexCoordinates() [1/2]

template<typename T >
const std::vector< Vec3T< T > > & EBGeometry::PLY< T >::getVertexCoordinates ( ) const
noexcept

Get the vertex coordinates.

Returns
m_vertexCoordinates

◆ getVertexCoordinates() [2/2]

template<typename T >
std::vector< Vec3T< T > > & EBGeometry::PLY< T >::getVertexCoordinates ( )
noexcept

Get the vertex coordinates.

Returns
m_vertexCoordinates

◆ getVertexProperties() [1/2]

template<typename T >
std::vector< T > & EBGeometry::PLY< T >::getVertexProperties ( const std::string  a_property)

Get the vertex properties.

Parameters
[in]a_propertyWhich property to fetch
Note
Function will throw std::out_of_range if the property does not exist
Returns
m_vertexProperties at provided property

◆ getVertexProperties() [2/2]

template<typename T >
const std::vector< T > & EBGeometry::PLY< T >::getVertexProperties ( const std::string  a_property) const

Get the vertex properties.

Parameters
[in]a_propertyWhich property to fetch
Note
Function will throw std::out_of_range if the property does not exist
Returns
m_vertexProperties at provided property

◆ operator=() [1/2]

template<typename T >
PLY & EBGeometry::PLY< T >::operator= ( const PLY< T > &  a_other)
default

Copy assignment operator.

Parameters
[in]a_otherOther PLY object.
Returns
Reference to (*this).

◆ operator=() [2/2]

template<typename T >
PLY & EBGeometry::PLY< T >::operator= ( PLY< T > &&  a_other)
defaultnoexcept

Move assignment operator.

Parameters
[in,out]a_otherOther PLY object.
Returns
Reference to (*this).

◆ setFaceProperties()

template<typename T >
void EBGeometry::PLY< T >::setFaceProperties ( const std::string  a_property,
std::vector< T >  a_data 
)

Set face properties.

Parameters
[in]a_propertyProperty name
[in]a_dataProperty data

◆ setVertexProperties()

template<typename T >
void EBGeometry::PLY< T >::setVertexProperties ( const std::string  a_property,
std::vector< T >  a_data 
)

Set vertex properties.

Parameters
[in]a_propertyProperty name
[in]a_dataProperty data

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