Class Stl
Defined in File stl.h
Class Documentation
-
class Stl
This class represents a 3D model in STL (stereolithography) file format.
It provides functionality to load an STL file from various sources, compute its SHA-256 hash, and convert it to a Mesh object for further processing. The STL file can be in either ASCII or binary format.
Public Types
-
enum class CoordinateFrame : uint8_t
Source of the zone origin used for rendering.
BODY: Use the extrinsics matrix as the zone origin
SENSOR: Use the sensor origin as the zone origin
Values:
-
enumerator NONE = 0
No coordinate frame specified.
-
enumerator BODY = 1
Use the extrinsics matrix as the zone origin.
-
enumerator SENSOR = 2
Use the sensor origin as the zone origin.
Public Functions
-
explicit Stl(const std::string &file_path)
Constructs an Stl object from a file path.
- Parameters:
file_path[in] – The path to the STL file.
- Throws:
std::runtime_error – if the file cannot be read or is not a valid STL file.
-
explicit Stl(std::istream &file)
Constructs an Stl object from an input stream.
- Parameters:
file[in] – The input stream containing the STL file data.
- Throws:
std::runtime_error – if the stream cannot be read or is not a valid STL file.
-
explicit Stl(std::vector<uint8_t> blob)
Constructs an Stl object from a binary blob.
- Parameters:
blob[in] – The binary blob containing the STL file data.
- Throws:
std::runtime_error – if the blob is not a valid STL file.
-
std::vector<uint8_t> blob() const
Returns the binary blob containing the STL file data.
- Returns:
A vector of bytes representing the STL file data.
Public Members
-
CoordinateFrame coordinate_frame = {CoordinateFrame::NONE}
The zone origin.
-
std::string filename = {}
Original filename of the STL file.
Public Static Functions
-
static bool string_to_coordinate_frame(const std::string &str, Stl::CoordinateFrame &coordinate_frame)
Converts an CoordinateFrame enum value to its corresponding string representation.
- Parameters:
str[in] – The string to convert.
coordinate_frame[out] – The resulting CoordinateFrame enum value.
- Returns:
true if the conversion was successful, false otherwise.
-
enum class CoordinateFrame : uint8_t