#2607 Add vertical dragging to well targets

This commit is contained in:
Jacob Støren
2018-08-21 16:37:03 +02:00
parent 37cb3e0ab7
commit 2284d98bcc
2 changed files with 28 additions and 8 deletions

View File

@@ -322,14 +322,35 @@ void RicPointTangentManipulatorPartMgr::updateManipulatorFromRay(const cvf::Ray*
{
if (!isManipulatorActive()) return;
cvf::Plane plane;
plane.setFromPointAndNormal(m_origin, cvf::Vec3d::Z_AXIS);
cvf::Vec3d newIntersection;
newMouseRay->planeIntersect(plane, &newIntersection);
if ( m_handleIds[m_currentHandleIndex] == HORIZONTAL_PLANE )
{
cvf::Plane plane;
plane.setFromPointAndNormal(m_origin, cvf::Vec3d::Z_AXIS);
cvf::Vec3d newIntersection;
newMouseRay->planeIntersect(plane, &newIntersection);
cvf::Vec3d newOrigin = m_originOnStartManipulation + (newIntersection - m_initialPickPoint);
cvf::Vec3d newOrigin = m_originOnStartManipulation + (newIntersection - m_initialPickPoint);
m_origin = newOrigin;
m_origin = newOrigin;
}
else if ( m_handleIds[m_currentHandleIndex] == VERTICAL_AXIS )
{
cvf::Plane plane;
cvf::Vec3d planeNormal = (newMouseRay->direction() ^ cvf::Vec3d::Z_AXIS) ^ cvf::Vec3d::Z_AXIS;
double length = planeNormal.length();
if (length < 1e-5) return;
planeNormal /= length;
plane.setFromPointAndNormal(m_initialPickPoint, planeNormal );
cvf::Vec3d newIntersection;
newMouseRay->planeIntersect(plane, &newIntersection);
cvf::Vec3d newOrigin = m_originOnStartManipulation;
newOrigin.z() += (newIntersection.z() - m_initialPickPoint.z());
m_origin = newOrigin;
}
//m_tangent = newTangent;
clearAllGeometryAndParts();

View File

@@ -149,11 +149,11 @@ private:
const cvf::Color4f& color,
const cvf::String& partName);
private:
size_t m_currentHandleIndex;
std::vector< HandleType > m_handleIds; // These arrays have the same length
cvf::Collection<cvf::Part> m_handleParts; // These arrays have the same length
cvf::Collection<cvf::Part> m_activeDragModeParts;
cvf::Vec3d m_origin;
cvf::Vec3d m_tangent;
double m_handleSize;
@@ -162,7 +162,6 @@ private:
cvf::Vec3d m_tangentOnStartManipulation;
cvf::Vec3d m_originOnStartManipulation;
size_t m_currentHandleIndex;
};