ENH: Cut optimization, support for custom connectors

Change-Id: I65163314374fb74f0b16df47dacae82caa6fab0d
(cherry picked from commit 7bacc2c2a89be471f6fee51dd07a42222a28b55a)
This commit is contained in:
zhimin.zeng 2023-03-14 10:42:42 +08:00 committed by Lane.Wei
parent 9f71a8c5dd
commit cd4cddfca4
51 changed files with 3663 additions and 466 deletions

View file

@ -94,6 +94,9 @@ public:
// be set in world coords.
void render_cut();
bool is_projection_inside_cut(const Vec3d &point) const;
bool has_valid_contour() const;
private:
void recalculate_triangles();
@ -105,6 +108,18 @@ private:
std::vector<Vec2f> m_triangles2d;
GLIndexedVertexArray m_vertex_array;
bool m_triangles_valid = false;
struct CutIsland
{
ExPolygon expoly;
BoundingBox expoly_bb;
};
struct ClipResult
{
std::vector<CutIsland> cut_islands;
Transform3d trafo; // this rotates the cut into world coords
};
std::optional<ClipResult> m_result; // the cut plane
};
@ -121,6 +136,9 @@ public:
{
}
static void line_from_mouse_pos_static(const Vec2d &mouse_pos, const Transform3d &trafo,
const Camera &camera, Vec3d &point, Vec3d &direction);
void line_from_mouse_pos(const Vec2d& mouse_pos, const Transform3d& trafo, const Camera& camera,
Vec3d& point, Vec3d& direction) const;