Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Mantid::DataHandling::SaveStl Class Reference

Class to contain functionality for writing out STL files for SaveShapeAndEnvironment. More...

#include <SaveStl.h>

Inheritance diagram for Mantid::DataHandling::SaveStl:
Mantid::DataHandling::MeshFileIO

Public Member Functions

 SaveStl (const std::string &filename, const std::vector< uint32_t > &triangle, std::vector< Kernel::V3D > vertices, ScaleUnits scaleType)
 
void writeStl ()
 Function to write out the full mesh to an stl binary file. More...
 
- Public Member Functions inherited from Mantid::DataHandling::MeshFileIO
Kernel::V3D createScaledV3D (double xVal, double yVal, double zVal)
 scales a 3D point according the units defined in the MeshFileIO class More...
 
ScaleUnits getScaleType ()
 
std::shared_ptr< Geometry::MeshObjectrotate (std::shared_ptr< Geometry::MeshObject > environmentMesh, double xRotation, double yRotation, double zRotation)
 Rotates the environment by a generated matrix. More...
 
std::shared_ptr< Geometry::MeshObjecttranslate (std::shared_ptr< Geometry::MeshObject > environmentMesh, const std::vector< double > &translationVector)
 translates the environment by a provided matrix More...
 

Private Member Functions

void writeHeader (Kernel::BinaryStreamWriter streamWriter)
 Function to write the header of the STL file, the header has no requirements other than it being 80 bytes long and not being a valid ascii stl header, so store creation info and scale here. More...
 
void writeTriangle (Kernel::BinaryStreamWriter streamWriter, uint32_t triangle)
 Function to write out an individual triangle with the scale removed. More...
 

Private Attributes

const std::string m_filename
 

Additional Inherited Members

- Protected Member Functions inherited from Mantid::DataHandling::MeshFileIO
 MeshFileIO (ScaleUnits scaleType)
 
 MeshFileIO (ScaleUnits scaleType, std::vector< uint32_t > triangles, std::vector< Kernel::V3D > vertices)
 
float removeScale (double value)
 
double scaleValue (double val)
 
void setScaleType (const ScaleUnits scaleType)
 
- Protected Attributes inherited from Mantid::DataHandling::MeshFileIO
ScaleUnits m_scaleType
 
std::vector< uint32_t > m_triangle
 
std::vector< Kernel::V3Dm_vertices
 

Detailed Description

Class to contain functionality for writing out STL files for SaveShapeAndEnvironment.

handles actual writing to file, creating the header, and removing the scale applied when loading.

Definition at line 30 of file SaveStl.h.

Constructor & Destructor Documentation

◆ SaveStl()

Mantid::DataHandling::SaveStl::SaveStl ( const std::string &  filename,
const std::vector< uint32_t > &  triangle,
std::vector< Kernel::V3D vertices,
ScaleUnits  scaleType 
)
inline

Definition at line 32 of file SaveStl.h.

Member Function Documentation

◆ writeHeader()

void Mantid::DataHandling::SaveStl::writeHeader ( Kernel::BinaryStreamWriter  streamWriter)
private

Function to write the header of the STL file, the header has no requirements other than it being 80 bytes long and not being a valid ascii stl header, so store creation info and scale here.

Parameters
streamWriterThe binary stream to write to.

Definition at line 52 of file SaveStl.cpp.

References Mantid::DataHandling::centimetres, Mantid::DataHandling::MeshFileIO::m_scaleType, Mantid::DataHandling::metres, and Mantid::DataHandling::millimetres.

Referenced by writeStl().

◆ writeStl()

void Mantid::DataHandling::SaveStl::writeStl ( )

Function to write out the full mesh to an stl binary file.

Handles the format of the file e.g. Header->NumberOfTriangles->Normal->Triangle->attribute->Next Normal...

Definition at line 79 of file SaveStl.cpp.

References m_filename, Mantid::DataHandling::MeshFileIO::m_triangle, writeHeader(), and writeTriangle().

Referenced by Mantid::DataHandling::SaveSampleEnvironmentAndShape::exec().

◆ writeTriangle()

void Mantid::DataHandling::SaveStl::writeTriangle ( Kernel::BinaryStreamWriter  streamWriter,
uint32_t  triangle 
)
private

Function to write out an individual triangle with the scale removed.

Parameters
streamWriterThe binary stream to write to.
trianglethe first index of the triangles in the m_triangles vector.

Definition at line 104 of file SaveStl.cpp.

References index, Mantid::DataHandling::MeshFileIO::m_triangle, Mantid::DataHandling::MeshFileIO::m_vertices, Mantid::DataHandling::MeshFileIO::removeScale(), Mantid::Kernel::V3D::X(), Mantid::Kernel::V3D::Y(), and Mantid::Kernel::V3D::Z().

Referenced by writeStl().

Member Data Documentation

◆ m_filename

const std::string Mantid::DataHandling::SaveStl::m_filename
private

Definition at line 39 of file SaveStl.h.

Referenced by writeStl().


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