FIX:when two dir is perpendicular to each other,scale error
(plane_normal.dot(ray_dir)) jira:STUDIO-8274 Change-Id: Ib3145ab75e18c832d20065d204aa41b75f73b673
This commit is contained in:
parent
4819949d5b
commit
fbdc9cd580
|
@ -364,10 +364,16 @@ double GLGizmoScale3D::calc_ratio(const UpdateData& data) const
|
|||
Vec3d plane_vec = mouse_dir.cross(m_starting.plane_nromal);
|
||||
plane_normal = plane_vec.cross(m_starting.plane_nromal);
|
||||
}
|
||||
|
||||
plane_normal = plane_normal.normalized();
|
||||
// finds the intersection of the mouse ray with the plane that the drag point moves
|
||||
// use ray-plane intersection see i.e. https://en.wikipedia.org/wiki/Line%E2%80%93plane_intersection
|
||||
Vec3d inters = GetIntersectionOfRayAndPlane(data.mouse_ray.a, mouse_dir, m_starting.drag_position, plane_normal.normalized());
|
||||
auto dot_value = (plane_normal.dot(mouse_dir));
|
||||
auto angle = Geometry::rad2deg(acos(dot_value));
|
||||
auto big_than_min_angle = abs(angle) < 95 && abs(angle) > 85;
|
||||
if (big_than_min_angle) {
|
||||
return 1;
|
||||
}
|
||||
Vec3d inters = GetIntersectionOfRayAndPlane(data.mouse_ray.a, mouse_dir, m_starting.drag_position, plane_normal);
|
||||
|
||||
Vec3d inters_vec = inters - m_starting.drag_position;
|
||||
|
||||
|
|
Loading…
Reference in New Issue