Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::FillAdaptive::Octree Struct Reference
+ Collaboration diagram for Slic3r::FillAdaptive::Octree:

Public Member Functions

 Octree (const Vec3d &origin, const std::vector< CubeProperties > &cubes_properties)
 
void insert_triangle (const Vec3d &a, const Vec3d &b, const Vec3d &c, Cube *current_cube, const BoundingBoxf3 &current_bbox, int depth)
 

Public Attributes

boost::object_pool< Cubepool
 
Cuberoot_cube { nullptr }
 
Vec3d origin
 
std::vector< CubePropertiescubes_properties
 

Detailed Description

Constructor & Destructor Documentation

◆ Octree()

Slic3r::FillAdaptive::Octree::Octree ( const Vec3d origin,
const std::vector< CubeProperties > &  cubes_properties 
)
inline
std::vector< CubeProperties > cubes_properties
Definition FillAdaptive.cpp:264
boost::object_pool< Cube > pool
Definition FillAdaptive.cpp:261
Vec3d origin
Definition FillAdaptive.cpp:263
Cube * root_cube
Definition FillAdaptive.cpp:262

Member Function Documentation

◆ insert_triangle()

void Slic3r::FillAdaptive::Octree::insert_triangle ( const Vec3d a,
const Vec3d b,
const Vec3d c,
Cube current_cube,
const BoundingBoxf3 current_bbox,
int  depth 
)
1516{
1517 assert(current_cube);
1518 assert(depth > 0);
1519
1520 --depth;
1521
1522 // Squared radius of a sphere around the child cube.
1523 // const double r2_cube = Slic3r::sqr(0.5 * this->cubes_properties[depth].height + EPSILON);
1524
1525 for (size_t i = 0; i < 8; ++ i) {
1526 const Vec3d &child_center_dir = child_centers[i];
1527 // Calculate a slightly expanded bounding box of a child cube to cope with triangles touching a cube wall and other numeric errors.
1528 // We will rather densify the octree a bit more than necessary instead of missing a triangle.
1529 BoundingBoxf3 bbox;
1530 for (int k = 0; k < 3; ++ k) {
1531 if (child_center_dir[k] == -1.) {
1532 bbox.min[k] = current_bbox.min[k];
1533 bbox.max[k] = current_cube->center[k] + EPSILON;
1534 } else {
1535 bbox.min[k] = current_cube->center[k] - EPSILON;
1536 bbox.max[k] = current_bbox.max[k];
1537 }
1538 }
1539 Vec3d child_center = current_cube->center + (child_center_dir * (this->cubes_properties[depth].edge_length / 2.));
1540 //if (dist2_to_triangle(a, b, c, child_center) < r2_cube) {
1541 // dist2_to_triangle and r2_cube are commented out too.
1542 if (triangle_AABB_intersects(a, b, c, bbox)) {
1543 if (! current_cube->children[i])
1544 current_cube->children[i] = this->pool.construct(child_center);
1545 if (depth > 0)
1546 this->insert_triangle(a, b, c, current_cube->children[i], bbox, depth);
1547 }
1548 }
1549}
static constexpr double EPSILON
Definition libslic3r.h:51
static const std::array< Vec3d, 8 > child_centers
Definition FillAdaptive.cpp:225
bool triangle_AABB_intersects(const Vector &a, const Vector &b, const Vector &c, const BoundingBoxBase< Vector > &aabb)
Definition FillAdaptive.cpp:42
Eigen::Matrix< double, 3, 1, Eigen::DontAlign > Vec3d
Definition Point.hpp:52
void insert_triangle(const Vec3d &a, const Vec3d &b, const Vec3d &c, Cube *current_cube, const BoundingBoxf3 &current_bbox, int depth)
Definition FillAdaptive.cpp:1515

References Slic3r::FillAdaptive::Cube::center, Slic3r::FillAdaptive::child_centers, Slic3r::FillAdaptive::Cube::children, EPSILON, Slic3r::BoundingBoxBase< PointType, APointsType >::max, Slic3r::BoundingBoxBase< PointType, APointsType >::min, and Slic3r::FillAdaptive::triangle_AABB_intersects().

Referenced by Slic3r::FillAdaptive::build_octree().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ cubes_properties

std::vector<CubeProperties> Slic3r::FillAdaptive::Octree::cubes_properties

◆ origin

Vec3d Slic3r::FillAdaptive::Octree::origin

◆ pool

boost::object_pool<Cube> Slic3r::FillAdaptive::Octree::pool

◆ root_cube

Cube* Slic3r::FillAdaptive::Octree::root_cube { nullptr }

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