OrcaSlicer latest
OrcaSlicer
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< Cube > pool
Cube * root_cube { nullptr }
Vec3d origin
std::vector< CubeProperties > cubes_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:292
boost::object_pool< Cube > pool
Definition FillAdaptive.cpp:289
Vec3d origin
Definition FillAdaptive.cpp:291
Cube * root_cube
Definition FillAdaptive.cpp:290

References cubes_properties, origin, pool, and root_cube.

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 )
2068{
2069 assert(current_cube);
2070 assert(depth > 0);
2071
2072 --depth;
2073
2074 // Squared radius of a sphere around the child cube.
2075 // const double r2_cube = Slic3r::sqr(0.5 * this->cubes_properties[depth].height + EPSILON);
2076
2077 for (size_t i = 0; i < 8; ++ i) {
2078 const Vec3d &child_center_dir = child_centers[i];
2079 // Calculate a slightly expanded bounding box of a child cube to cope with triangles touching a cube wall and other numeric errors.
2080 // We will rather densify the octree a bit more than necessary instead of missing a triangle.
2081 BoundingBoxf3 bbox;
2082 for (int k = 0; k < 3; ++ k) {
2083 if (child_center_dir[k] == -1.) {
2084 bbox.min[k] = current_bbox.min[k];
2085 bbox.max[k] = current_cube->center[k] + EPSILON;
2086 } else {
2087 bbox.min[k] = current_cube->center[k] - EPSILON;
2088 bbox.max[k] = current_bbox.max[k];
2089 }
2090 }
2091 Vec3d child_center = current_cube->center + (child_center_dir * (this->cubes_properties[depth].edge_length / 2.));
2092 //if (dist2_to_triangle(a, b, c, child_center) < r2_cube) {
2093 // dist2_to_triangle and r2_cube are commented out too.
2094 if (triangle_AABB_intersects(a, b, c, bbox)) {
2095 if (! current_cube->children[i])
2096 current_cube->children[i] = this->pool.construct(child_center);
2097 if (depth > 0)
2098 this->insert_triangle(a, b, c, current_cube->children[i], bbox, depth);
2099 }
2100 }
2101}
#define EPSILON
Definition ColorUtils.cpp:64
static const std::array< Vec3d, 8 > child_centers
Definition FillAdaptive.cpp:253
bool triangle_AABB_intersects(const Vector &a, const Vector &b, const Vector &c, const BoundingBoxBase< Vector > &aabb)
Definition FillAdaptive.cpp:70
Eigen::Matrix< double, 3, 1, Eigen::DontAlign > Vec3d
Definition Point.hpp:68
void insert_triangle(const Vec3d &a, const Vec3d &b, const Vec3d &c, Cube *current_cube, const BoundingBoxf3 &current_bbox, int depth)
Definition FillAdaptive.cpp:2067

References Slic3r::FillAdaptive::Cube::center, Slic3r::FillAdaptive::child_centers, Slic3r::FillAdaptive::Cube::children, cubes_properties, EPSILON, insert_triangle(), Slic3r::BoundingBoxBase< PointType, std::vector< PointType > >::max, Slic3r::BoundingBoxBase< PointType, std::vector< PointType > >::min, pool, and Slic3r::FillAdaptive::triangle_AABB_intersects().

Referenced by Slic3r::FillAdaptive::build_octree(), and insert_triangle().

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

Referenced by Octree().

◆ pool

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

Referenced by Octree(), and insert_triangle().

◆ root_cube

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

Referenced by Octree(), and Slic3r::FillAdaptive::build_octree().


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