libslic3r
Library for generating gcode from 3d models
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
Slic3r::TriangleMesh Class Reference

#include <TriangleMesh.hpp>

Public Member Functions

 TriangleMesh ()
 
template<typename Vertex_Cont , typename Facet_Cont >
 TriangleMesh (const Vertex_Cont &vertices, const Facet_Cont &facets)
 
 TriangleMesh (const TriangleMesh &other)
 
TriangleMeshoperator= (const TriangleMesh &other)
 copy assignment More...
 
TriangleMeshoperator= (TriangleMesh &&other)
 Move assignment. More...
 
 TriangleMesh (TriangleMesh &&other)
 
void swap (TriangleMesh &other)
 
 ~TriangleMesh ()
 
void ReadSTLFile (const std::string &input_file)
 
void write_ascii (const std::string &output_file)
 
void write_binary (const std::string &output_file)
 
void repair ()
 
void check_topology ()
 
float volume ()
 
bool is_manifold () const
 
void WriteOBJFile (const std::string &output_file)
 
void scale (float factor)
 
void scale (const Pointf3 &versor)
 
void translate (float x, float y, float z)
 Translate the mesh to a new location. More...
 
void translate (Pointf3 vec)
 Translate the mesh to a new location. More...
 
void rotate (float angle, const Axis &axis)
 
void rotate_x (float angle)
 
void rotate_y (float angle)
 
void rotate_z (float angle)
 
void mirror (const Axis &axis)
 
void mirror_x ()
 
void mirror_y ()
 
void mirror_z ()
 
void align_to_origin ()
 
void center_around_origin ()
 
void rotate (double angle, const Point &center)
 Rotate angle around a specified point. More...
 
void rotate (double angle, Point *center)
 
TriangleMeshPtrs split () const
 
TriangleMeshPtrs cut_by_grid (const Pointf &grid) const
 
void merge (const TriangleMesh &mesh)
 
ExPolygons horizontal_projection () const
 
Polygon convex_hull ()
 
BoundingBoxf3 bounding_box () const
 
void reset_repair_stats ()
 
bool needed_repair () const
 
size_t facets_count () const
 
void extrude_tin (float offset)
 
void require_shared_vertices ()
 
void reverse_normals ()
 
Pointf3s vertices ()
 Return a copy of the vertex array defining this mesh. More...
 
Point3s facets ()
 Return a copy of the facet array defining this mesh. More...
 
Pointf3s normals () const
 Return a copy of the normals array defining this mesh. More...
 
Pointf3 size () const
 Return the size of the mesh in coordinates. More...
 
Pointf3 center () const
 Return the center of the related bounding box. More...
 
std::vector< ExPolygonsslice (const std::vector< double > &z)
 Slice this mesh at the provided Z levels and return the vector. More...
 
mesh_stats stats () const
 Contains general statistics from underlying mesh structure. More...
 
BoundingBoxf3 bb3 () const
 
void cut (Axis axis, double z, TriangleMesh *upper, TriangleMesh *lower)
 Perform a cut of the mesh and put the output in upper and lower. More...
 

Static Public Member Functions

static TriangleMesh make_cube (double x, double y, double z)
 Generate a mesh representing a cube with dimensions (x, y, z), with one corner at (0,0,0). More...
 
static TriangleMesh make_cylinder (double r, double h, double fa=(2 *PI/360))
 
static TriangleMesh make_sphere (double rho, double fa=(2 *PI/360))
 

Public Attributes

stl_file stl
 
bool repaired
 Whether or not this mesh has been repaired. More...
 

Friends

class TriangleMeshSlicer< X >
 
class TriangleMeshSlicer< Y >
 
class TriangleMeshSlicer< Z >
 

Constructor & Destructor Documentation

◆ TriangleMesh() [1/4]

Slic3r::TriangleMesh::TriangleMesh ( )

◆ TriangleMesh() [2/4]

template<typename Vertex_Cont , typename Facet_Cont >
Slic3r::TriangleMesh::TriangleMesh ( const Vertex_Cont &  vertices,
const Facet_Cont &  facets 
)
inline

Templated constructor to adapt containers that offer .data() and .size() First argument is a container (either vector or array) of Pointf3 for the vertex data. Second argument is container of facets (currently Point3).

◆ TriangleMesh() [3/4]

Slic3r::TriangleMesh::TriangleMesh ( const TriangleMesh other)

◆ TriangleMesh() [4/4]

Slic3r::TriangleMesh::TriangleMesh ( TriangleMesh &&  other)

◆ ~TriangleMesh()

Slic3r::TriangleMesh::~TriangleMesh ( )

Member Function Documentation

◆ align_to_origin()

void Slic3r::TriangleMesh::align_to_origin ( )

◆ bb3()

BoundingBoxf3 Slic3r::TriangleMesh::bb3 ( ) const

◆ bounding_box()

BoundingBoxf3 Slic3r::TriangleMesh::bounding_box ( ) const

◆ center()

Pointf3 Slic3r::TriangleMesh::center ( ) const

Return the center of the related bounding box.

◆ center_around_origin()

void Slic3r::TriangleMesh::center_around_origin ( )

◆ check_topology()

void Slic3r::TriangleMesh::check_topology ( )

◆ convex_hull()

Polygon Slic3r::TriangleMesh::convex_hull ( )

◆ cut()

void Slic3r::TriangleMesh::cut ( Axis  axis,
double  z,
TriangleMesh upper,
TriangleMesh lower 
)

Perform a cut of the mesh and put the output in upper and lower.

◆ cut_by_grid()

TriangleMeshPtrs Slic3r::TriangleMesh::cut_by_grid ( const Pointf grid) const

◆ extrude_tin()

void Slic3r::TriangleMesh::extrude_tin ( float  offset)

◆ facets()

Point3s Slic3r::TriangleMesh::facets ( )

Return a copy of the facet array defining this mesh.

◆ facets_count()

size_t Slic3r::TriangleMesh::facets_count ( ) const

◆ horizontal_projection()

ExPolygons Slic3r::TriangleMesh::horizontal_projection ( ) const

◆ is_manifold()

bool Slic3r::TriangleMesh::is_manifold ( ) const

◆ make_cube()

TriangleMesh Slic3r::TriangleMesh::make_cube ( double  x,
double  y,
double  z 
)
static

Generate a mesh representing a cube with dimensions (x, y, z), with one corner at (0,0,0).

◆ make_cylinder()

TriangleMesh Slic3r::TriangleMesh::make_cylinder ( double  r,
double  h,
double  fa = (2*PI/360) 
)
static

Generate a mesh representing a cylinder of radius r and height h, with the base at (0,0,0). param[in] r Radius param[in] h Height param[in] fa Facet angle. A smaller angle produces more facets. Default value is 2pi / 360.

◆ make_sphere()

TriangleMesh Slic3r::TriangleMesh::make_sphere ( double  rho,
double  fa = (2*PI/360) 
)
static

Generate a mesh representing a sphere of radius rho, centered about (0,0,0). param[in] rho Distance from center to the shell of the sphere. param[in] fa Facet angle. A smaller angle produces more facets. Default value is 2pi / 360.

◆ merge()

void Slic3r::TriangleMesh::merge ( const TriangleMesh mesh)

◆ mirror()

void Slic3r::TriangleMesh::mirror ( const Axis axis)

◆ mirror_x()

void Slic3r::TriangleMesh::mirror_x ( )

◆ mirror_y()

void Slic3r::TriangleMesh::mirror_y ( )

◆ mirror_z()

void Slic3r::TriangleMesh::mirror_z ( )

◆ needed_repair()

bool Slic3r::TriangleMesh::needed_repair ( ) const

◆ normals()

Pointf3s Slic3r::TriangleMesh::normals ( ) const

Return a copy of the normals array defining this mesh.

◆ operator=() [1/2]

TriangleMesh & Slic3r::TriangleMesh::operator= ( const TriangleMesh other)

copy assignment

◆ operator=() [2/2]

TriangleMesh & Slic3r::TriangleMesh::operator= ( TriangleMesh &&  other)

Move assignment.

◆ ReadSTLFile()

void Slic3r::TriangleMesh::ReadSTLFile ( const std::string &  input_file)

◆ repair()

void Slic3r::TriangleMesh::repair ( )

◆ require_shared_vertices()

void Slic3r::TriangleMesh::require_shared_vertices ( )

◆ reset_repair_stats()

void Slic3r::TriangleMesh::reset_repair_stats ( )

◆ reverse_normals()

void Slic3r::TriangleMesh::reverse_normals ( )

◆ rotate() [1/3]

void Slic3r::TriangleMesh::rotate ( float  angle,
const Axis axis 
)

◆ rotate() [2/3]

void Slic3r::TriangleMesh::rotate ( double  angle,
const Point center 
)

Rotate angle around a specified point.

◆ rotate() [3/3]

void Slic3r::TriangleMesh::rotate ( double  angle,
Point center 
)

◆ rotate_x()

void Slic3r::TriangleMesh::rotate_x ( float  angle)

◆ rotate_y()

void Slic3r::TriangleMesh::rotate_y ( float  angle)

◆ rotate_z()

void Slic3r::TriangleMesh::rotate_z ( float  angle)

◆ scale() [1/2]

void Slic3r::TriangleMesh::scale ( float  factor)

◆ scale() [2/2]

void Slic3r::TriangleMesh::scale ( const Pointf3 versor)

◆ size()

Pointf3 Slic3r::TriangleMesh::size ( ) const

Return the size of the mesh in coordinates.

◆ slice()

std::vector< ExPolygons > Slic3r::TriangleMesh::slice ( const std::vector< double > &  z)

Slice this mesh at the provided Z levels and return the vector.

◆ split()

TriangleMeshPtrs Slic3r::TriangleMesh::split ( ) const

◆ stats()

mesh_stats Slic3r::TriangleMesh::stats ( ) const

Contains general statistics from underlying mesh structure.

◆ swap()

void Slic3r::TriangleMesh::swap ( TriangleMesh other)

◆ translate() [1/2]

void Slic3r::TriangleMesh::translate ( float  x,
float  y,
float  z 
)

Translate the mesh to a new location.

◆ translate() [2/2]

void Slic3r::TriangleMesh::translate ( Pointf3  vec)

Translate the mesh to a new location.

◆ vertices()

Pointf3s Slic3r::TriangleMesh::vertices ( )

Return a copy of the vertex array defining this mesh.

◆ volume()

float Slic3r::TriangleMesh::volume ( )

◆ write_ascii()

void Slic3r::TriangleMesh::write_ascii ( const std::string &  output_file)

◆ write_binary()

void Slic3r::TriangleMesh::write_binary ( const std::string &  output_file)

◆ WriteOBJFile()

void Slic3r::TriangleMesh::WriteOBJFile ( const std::string &  output_file)

Friends And Related Function Documentation

◆ TriangleMeshSlicer< X >

friend class TriangleMeshSlicer< X >
friend

◆ TriangleMeshSlicer< Y >

friend class TriangleMeshSlicer< Y >
friend

◆ TriangleMeshSlicer< Z >

friend class TriangleMeshSlicer< Z >
friend

Member Data Documentation

◆ repaired

bool Slic3r::TriangleMesh::repaired

Whether or not this mesh has been repaired.

◆ stl

stl_file Slic3r::TriangleMesh::stl

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