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::OBJ< T > Class Template Reference

Class for storing contents of Wavefront OBJ files. More...

#include <EBGeometry_OBJ.hpp>

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

Public Member Functions

 OBJ () noexcept=default
 Default constructor. Initializes empty member data holder.
 
 OBJ (const std::string &a_id) noexcept
 Constructor. Initializes empty vertices and facets but sets the OBJ ID (usually the file name.
 
 OBJ (const OBJ &a_other)=default
 Copy constructor.
 
 OBJ (OBJ &&a_other) noexcept=default
 Move constructor.
 
OBJoperator= (const OBJ &a_other)=default
 Copy assignment operator.
 
OBJoperator= (OBJ &&a_other) noexcept=default
 Move assignment operator.
 
 ~OBJ () 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 polygon facet indices.
 
const std::vector< std::vector< size_t > > & getFacets () const noexcept
 Get the polygon facet indices.
 
template<typename Meta >
std::shared_ptr< EBGeometry::DCEL::MeshT< T, Meta > > convertToDCEL () const noexcept
 Turn the OBJ mesh into a DCEL mesh.
 

Protected Attributes

std::string m_id
 OBJ object ID.
 
std::vector< Vec3T< T > > m_vertexCoordinates
 Vertex coordinates.
 
std::vector< std::vector< size_t > > m_facets
 Polygon facets.
 

Detailed Description

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

Class for storing contents of Wavefront OBJ files.

This structure is simply used as conversion utility between OBJ files and various EBGeometry objects (triangle soups, DCEL meshes, etc). Only vertex ('v') and face ('f') records are retained; texture/normal indices, groups, and materials are ignored.

Template Parameters
TFloating-point precision for vertex coordinates.

Constructor & Destructor Documentation

◆ OBJ() [1/3]

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

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

Parameters
[in]a_idIdentifier for OBJ object

◆ OBJ() [2/3]

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

Copy constructor.

Parameters
[in]a_otherOther OBJ object.

◆ OBJ() [3/3]

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

Move constructor.

Parameters
[in,out]a_otherOther OBJ object.

Member Function Documentation

◆ convertToDCEL()

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

Turn the OBJ mesh into a DCEL mesh.

This call does not populate any meta-data in the DCEL mesh structures.

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

◆ getFacets() [1/2]

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

Get the polygon facet indices.

Returns
m_facets

◆ getFacets() [2/2]

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

Get the polygon facet indices.

Returns
m_facets

◆ getID() [1/2]

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

Get the identifier for this object.

Returns
Const reference to the OBJ object identifier.

◆ getID() [2/2]

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

Get the identifier for this object.

Returns
Reference to the OBJ object identifier.

◆ getVertexCoordinates() [1/2]

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

Get the vertex coordinates.

Returns
m_vertexCoordinates

◆ getVertexCoordinates() [2/2]

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

Get the vertex coordinates.

Returns
m_vertexCoordinates

◆ operator=() [1/2]

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

Copy assignment operator.

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

◆ operator=() [2/2]

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

Move assignment operator.

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

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