FormIt C++ API  v23.0.0 (2023.0.0)
WSM::FacetsBodyData Struct Reference

Description

Contains data for constructing a Body from facets.

Used in APILoadFromFacets(), which contains common functionality for loading data from several formats.

#include <FacetsBodyData.h>

Public Member Functions

 FacetsBodyData (const 1::vector< WSM::Point3d > &aPoints, const 1::vector< 1::vector< size_t >> &aPolygonIndices, const 1::vector< size_t > &aPolygonSmoothingIds, const 1::vector< WSM::Color > &aColors, const 1::vector< size_t > &aPolygonColorIndices, const 1::vector< WSM::Color > &aPointColors={}, const 1::vector< 1::pair< 1::string, 1::string >> &stringAttributesData={})
 
 FacetsBodyData ()
 Constructor. More...
 
 ~FacetsBodyData ()
 Destructor. More...
 
bool isEmpty ()
 isEmpty function. More...
 
void ScaleBy (double dFactor)
 Scale all points by the given scaling factor. More...
 

Public Attributes

::vector< WSM::Point3dm_points
 Geometry coordinates of all the vertices which the body contains. More...
 
::vector< 1::vector< size_t > > m_polygonIndices
 The zero-based indices of points which form each facet of the body. More...
 
::vector< size_t > m_polygonSmoothingIds
 Smoothing ID for each polygon in the m_polygonIndices list. More...
 
::vector< WSM::Colorm_colors
 Color table (the r,g,b,a components correspond to one byte each in size_t and are encoded in the same way as in WSM). More...
 
::vector< size_t > m_polygonColorIndices
 Color index for each polygon in m_polygonIndices list. More...
 
::vector< WSM::Colorm_pointColors
 Colors on vertices of the body. More...
 
::vector< 1::pair< 1::string, 1::string > > m_stringAttributesData
 String attributes data as (key, value) that are attached to each created body or mesh. More...
 

Constructor & Destructor Documentation

WSM::FacetsBodyData::FacetsBodyData ( const 1::vector< WSM::Point3d > &  aPoints,
const 1::vector< 1::vector< size_t >> &  aPolygonIndices,
const 1::vector< size_t > &  aPolygonSmoothingIds,
const 1::vector< WSM::Color > &  aColors,
const 1::vector< size_t > &  aPolygonColorIndices,
const 1::vector< WSM::Color > &  aPointColors = {},
const 1::vector< 1::pair< 1::string, 1::string >> &  stringAttributesData = {} 
)
inline
WSM::FacetsBodyData::FacetsBodyData ( )
inline

Constructor.

WSM::FacetsBodyData::~FacetsBodyData ( )
inline

Destructor.

Member Function Documentation

bool WSM::FacetsBodyData::isEmpty ( )
inline

isEmpty function.

void WSM::FacetsBodyData::ScaleBy ( double  dFactor)
inline

Scale all points by the given scaling factor.

Parameters
[in]dFactor

Member Data Documentation

::vector<WSM::Color> WSM::FacetsBodyData::m_colors

Color table (the r,g,b,a components correspond to one byte each in size_t and are encoded in the same way as in WSM).

Will be indexed by m_polygonColorIndices. May be empty, in which case no materials will be generated. If m_colors is not empty, a material with the given color will be generated if it does not already exist.

::vector<WSM::Color> WSM::FacetsBodyData::m_pointColors

Colors on vertices of the body.

Vector is either empty when color by vertex is not given or has the same size as m_points.

::vector<WSM::Point3d> WSM::FacetsBodyData::m_points

Geometry coordinates of all the vertices which the body contains.

::vector<size_t> WSM::FacetsBodyData::m_polygonColorIndices

Color index for each polygon in m_polygonIndices list.

May be empty, in which case no material attribute will be assigned to the faces. An index with value of WSM::INVALID_SIZE means that the face will also not be assigned a material. The size of the m_polygonColorIndices vector should be equal to the size of the m_polygonIndices vector.

::vector<1::vector<size_t> > WSM::FacetsBodyData::m_polygonIndices

The zero-based indices of points which form each facet of the body.

Each index is a Point3d object stored at appropriate place in the m_points vector. Facets are usually triangles, but here, polygons may be specified. That means one can pass vector of any length as an element of the m_polygonIndices list. If a non-planar polygon is passed, it will need further triangulation. m_polygonIndices should not contain indices greater than the largest allowed index for the m_points array. If m_polygonIndices is empty, then FacetsBodyData stores a wire body created by joining consecutive points in m_points.

::vector<size_t> WSM::FacetsBodyData::m_polygonSmoothingIds

Smoothing ID for each polygon in the m_polygonIndices list.

Indicates smoothing group ID for polygons. All facets with the same, non-zero smoothing ID will result in faces that will be rendered smooth (have their common edges marked as smooth). A smoothing ID with zero value means that the smoothing is determined by the angle between two adjacent facets. A value of WSM::INVALID_SIZE means that the facet should not be marked for smoothing. The size of the m_polygonSmoothingIds vector should be equal to the size of the m_polygonIndices vector.

::vector<1::pair<1::string, 1::string> > WSM::FacetsBodyData::m_stringAttributesData

String attributes data as (key, value) that are attached to each created body or mesh.


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