SFCGAL  2.3.0
Classes | Functions
SFCGAL::io::OBJ Namespace Reference

OBJ file format tools. More...

Classes

struct  ObjData
 Parsed OBJ data structure. More...
 

Functions

auto parseObjData (std::istream &inOBJ) -> ObjData
 Parse OBJ data from input stream. More...
 
auto createGeometryFromObjData (const ObjData &obj_data) -> std::unique_ptr< Geometry >
 Create geometry from parsed OBJ data. More...
 
void save (const Geometry &geom, std::ostream &out)
 Saves a geometry to an OBJ format stream. More...
 
void save (const Geometry &geom, const std::string &filename)
 Saves a geometry to an OBJ file. More...
 
auto saveToString (const Geometry &geom) -> std::string
 Saves a geometry to an OBJ format string. More...
 
void saveToBuffer (const Geometry &geom, char *buffer, size_t *size)
 Saves a geometry to an OBJ format buffer (C API). More...
 
auto load (std::istream &inOBJ) -> std::unique_ptr< Geometry >
 Loads a geometry from an OBJ format stream. More...
 
auto load (const std::string &obj) -> std::unique_ptr< Geometry >
 Loads a geometry from an OBJ format string. More...
 
auto loadFromFile (const std::filesystem::path &filename) -> std::unique_ptr< Geometry >
 Loads a geometry from an OBJ file. More...
 

Detailed Description

OBJ file format tools.

Function Documentation

auto SFCGAL::io::OBJ::createGeometryFromObjData ( const ObjData &  obj_data) -> std::unique_ptr<Geometry>

Create geometry from parsed OBJ data.

Parameters
[in]obj_dataParsed OBJ data
Returns
Geometry created from OBJ data
Exceptions
SFCGAL::ExceptionIf geometry creation fails
SFCGAL_API auto SFCGAL::io::OBJ::load ( std::istream &  inOBJ) -> std::unique_ptr< Geometry >

Loads a geometry from an OBJ format stream.

Parameters
SFCGAL_API auto SFCGAL::io::OBJ::load ( const std::string &  obj) -> std::unique_ptr< Geometry >

Loads a geometry from an OBJ format string.

Parameters
[in]objThe OBJ format string
Returns
The loaded geometry
Exceptions
SFCGAL::ExceptionIf the string is invalid or contains unsupported features
SFCGAL_API auto SFCGAL::io::OBJ::loadFromFile ( const std::filesystem::path &  filename) -> std::unique_ptr< Geometry >

Loads a geometry from an OBJ file.

Parameters
[in]filenameThe name of the file to load from
Returns
The loaded geometry
Exceptions
SFCGAL::ExceptionIf the file cannot be opened or is invalid
auto SFCGAL::io::OBJ::parseObjData ( std::istream &  inOBJ) -> ObjData

Parse OBJ data from input stream.

Parameters
[in]inOBJInput stream containing OBJ data
Returns
Parsed OBJ data
Exceptions
SFCGAL::ExceptionIf parsing fails
SFCGAL_API void SFCGAL::io::OBJ::save ( const Geometry &  geom,
std::ostream &  out 
)

Saves a geometry to an OBJ format stream.

Parameters
[in]geomThe geometry to save
[out]outThe output stream
Exceptions
SFCGAL::ExceptionIf the geometry is invalid or unsupported
SFCGAL_API void SFCGAL::io::OBJ::save ( const Geometry &  geom,
const std::string &  filename 
)

Saves a geometry to an OBJ file.

Parameters
[in]geomThe geometry to save
[in]filenameThe name of the file to save to
Exceptions
SFCGAL::ExceptionIf the file cannot be opened or the geometry is invalid
SFCGAL_API void SFCGAL::io::OBJ::saveToBuffer ( const Geometry &  geom,
char *  buffer,
size_t *  size 
)

Saves a geometry to an OBJ format buffer (C API).

Parameters
[in]geomThe geometry to save
[out]bufferThe buffer to write to
[in,out]sizeOn input, the size of the buffer. On output, the number of bytes written (or required if buffer is null)
Exceptions
SFCGAL::ExceptionIf the geometry is invalid or unsupported
SFCGAL_API auto SFCGAL::io::OBJ::saveToString ( const Geometry &  geom) -> std::string

Saves a geometry to an OBJ format string.

Parameters
[in]geomThe geometry to save
Returns
The OBJ format string
Exceptions
SFCGAL::ExceptionIf the geometry is invalid or unsupported