mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-16 08:55:57 +08:00
Cut: fixed clipping plane when it is not horizonal
This commit is contained in:
parent
af03bed094
commit
9917b8e58b
@ -130,9 +130,9 @@ void GLGizmoCut3D::update_clipper()
|
|||||||
{
|
{
|
||||||
const Vec3d& angles = m_rotation_gizmo.get_rotation();
|
const Vec3d& angles = m_rotation_gizmo.get_rotation();
|
||||||
Matrix3d m;
|
Matrix3d m;
|
||||||
m = Eigen::AngleAxisd(angles[X], Vec3d::UnitX())
|
m = Eigen::AngleAxisd(angles[Z], Vec3d::UnitZ())
|
||||||
* Eigen::AngleAxisd(angles[Y], Vec3d::UnitY())
|
* Eigen::AngleAxisd(angles[Y], Vec3d::UnitY())
|
||||||
* Eigen::AngleAxisd(angles[Z], Vec3d::UnitZ());
|
* Eigen::AngleAxisd(angles[X], Vec3d::UnitX());
|
||||||
|
|
||||||
Vec3d plane_center = m_move_gizmo.get_center();
|
Vec3d plane_center = m_move_gizmo.get_center();
|
||||||
BoundingBoxf3 box = m_move_gizmo.bounding_box();
|
BoundingBoxf3 box = m_move_gizmo.bounding_box();
|
||||||
|
@ -458,17 +458,12 @@ void ObjectClipper::set_position_by_ratio(double pos, bool keep_normal)
|
|||||||
|
|
||||||
void ObjectClipper::set_range_and_pos(const Vec3d& origin, const Vec3d& end, double pos)
|
void ObjectClipper::set_range_and_pos(const Vec3d& origin, const Vec3d& end, double pos)
|
||||||
{
|
{
|
||||||
std::cout << "origin:\t"<< origin.x() << "\t" << origin.y() << "\t"<< origin.z() << "\n";
|
|
||||||
std::cout << "end:\t" << end.x() << "\t" << end.y() << "\t"<< end.z() << "\n";
|
|
||||||
|
|
||||||
Vec3d normal = end-origin;
|
Vec3d normal = end-origin;
|
||||||
double norm = normal.norm();
|
double norm = normal.norm();
|
||||||
pos = std::clamp(pos, 0.0001, norm);
|
pos = std::clamp(pos, 0.0001, norm);
|
||||||
|
normal.normalize();
|
||||||
std::cout << "NORM:\t" << norm << "\tPOS:\t" << pos << "\n\n";
|
m_clp.reset(new ClippingPlane(normal, normal.dot(origin)+pos));
|
||||||
|
m_clp_ratio = pos;
|
||||||
m_clp.reset(new ClippingPlane(normal, pos));
|
|
||||||
m_clp_ratio = pos/norm;
|
|
||||||
get_pool()->get_canvas()->set_as_dirty();
|
get_pool()->get_canvas()->set_as_dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user