MPM-Geomechanics
Material Point Method for simulating geo-materials under large deformation conditions
Loading...
Searching...
No Matches
STLReader Class Reference

Class to read STL files. More...

#include <STLReader.h>

Public Member Functions

bool read (const std::string &filename)
 Read the STL file.
 
const std::vector< Triangle > & getTriangles () const
 Get the triangles of the STL mesh.
 
void removeTrianglesOutsideLimits (const Vector3d &min, const Vector3d &max)
 Remove triangles that have all vertices outside the specified bounding box.
 
void recalculateNormals ()
 Recalculate the normals of the triangles.
 
bool writeSTL (const std::string &output_filename) const
 Write the STL file.
 
void STLResultsFlagSet (bool flag)
 Set flag to write STL results with normals.
 
bool STLResultsFlagGet ()
 Get flag to write STL results with normals.
 

Private Member Functions

bool readASCII (std::ifstream &file)
 Read the ASCII STL file.
 
bool readBinary (std::ifstream &file)
 Read the binary STL file.
 

Private Attributes

std::vector< Triangletriangles
 Vector containing the triangles.
 
bool write_stl_results = false
 Flag to write STL results with normals.
 

Detailed Description

Class to read STL files.

Member Function Documentation

◆ getTriangles()

const std::vector< Triangle > & STLReader::getTriangles ( ) const

Get the triangles of the STL mesh.

Returns
Vector containing the triangles

◆ read()

bool STLReader::read ( const std::string &  filename)

Read the STL file.

◆ readASCII()

bool STLReader::readASCII ( std::ifstream &  file)
private

Read the ASCII STL file.

◆ readBinary()

bool STLReader::readBinary ( std::ifstream &  file)
private

Read the binary STL file.

◆ recalculateNormals()

void STLReader::recalculateNormals ( )

Recalculate the normals of the triangles.

This function recalculates the normals of the triangles based on their vertices.

◆ removeTrianglesOutsideLimits()

void STLReader::removeTrianglesOutsideLimits ( const Vector3d &  min,
const Vector3d &  max 
)

Remove triangles that have all vertices outside the specified bounding box.

Parameters
minBounding box minimum (x_min, y_min, z_min)
maxBounding box maximum (x_max, y_max, z_max)

◆ STLResultsFlagGet()

bool STLReader::STLResultsFlagGet ( )
inline

Get flag to write STL results with normals.

◆ STLResultsFlagSet()

void STLReader::STLResultsFlagSet ( bool  flag)
inline

Set flag to write STL results with normals.

◆ writeSTL()

bool STLReader::writeSTL ( const std::string &  output_filename) const

Write the STL file.

Parameters
output_filenameThe name of the output STL file

Member Data Documentation

◆ triangles

std::vector<Triangle> STLReader::triangles
private

Vector containing the triangles.

◆ write_stl_results

bool STLReader::write_stl_results = false
private

Flag to write STL results with normals.


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