From b85a292ce06475d560bfa1195b63a8bfe211f22d Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 11 Jul 2012 14:15:27 -0500 Subject: Add 0.2.7 release of qwtplot3d for future TQt3 conversion and use --- lib/tqwtplot3d/src/qwt3d_movements.cpp | 106 +++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 lib/tqwtplot3d/src/qwt3d_movements.cpp (limited to 'lib/tqwtplot3d/src/qwt3d_movements.cpp') diff --git a/lib/tqwtplot3d/src/qwt3d_movements.cpp b/lib/tqwtplot3d/src/qwt3d_movements.cpp new file mode 100644 index 0000000..73ff9b1 --- /dev/null +++ b/lib/tqwtplot3d/src/qwt3d_movements.cpp @@ -0,0 +1,106 @@ +#if defined(_MSC_VER) /* MSVC Compiler */ +#pragma warning ( disable : 4305 ) +#pragma warning ( disable : 4786 ) +#endif + +#include +#include "qwt3d_plot.h" + +using namespace Qwt3D; + + +/** + Set the rotation angle of the object. If you look along the respective axis towards ascending values, + the rotation is performed in mathematical \e negative sense + \param xVal angle in \e degree to rotate around the X axis + \param yVal angle in \e degree to rotate around the Y axis + \param zVal angle in \e degree to rotate around the Z axis +*/ +void Plot3D::setRotation( double xVal, double yVal, double zVal ) +{ + if (xRot_ == xVal && yRot_ == yVal && zRot_ == zVal) + return; + + xRot_ = xVal; + yRot_ = yVal; + zRot_ = zVal; + + updateGL(); + emit rotationChanged(xVal, yVal, zVal); +} + +/** + Set the shift in object (world) coordinates. + \param xVal shift along (world) X axis + \param yVal shift along (world) Y axis + \param zVal shift along (world) Z axis + \see setViewportShift() +*/ +void Plot3D::setShift( double xVal, double yVal, double zVal ) +{ + if (xShift_ == xVal && yShift_ == yVal && zShift_ == zVal) + return; + + xShift_ = xVal; + yShift_ = yVal; + zShift_ = zVal; + updateGL(); + emit shiftChanged(xVal, yVal, zVal); +} + +/** + Performs shifting along screen axes. + The shift moves points inside a sphere, + which encloses the unscaled and unzoomed data + by multiples of the spheres diameter + + \param xVal shift along (view) X axis + \param yVal shift along (view) Y axis + \see setShift() +*/ +void Plot3D::setViewportShift( double xVal, double yVal ) +{ + if (xVPShift_ == xVal && yVPShift_ == yVal) + return; + + xVPShift_ = xVal; + yVPShift_ = yVal; + + updateGL(); + emit vieportShiftChanged(xVPShift_, yVPShift_); +} + +/** + Set the scale in object (world) coordinates. + \param xVal scaling for X values + \param yVal scaling for Y values + \param zVal scaling for Z values + + A respective value of 1 represents no scaling; +*/ +void Plot3D::setScale( double xVal, double yVal, double zVal ) +{ + if (xScale_ == xVal && yScale_ == yVal && zScale_ == zVal) + return; + + xScale_ = (xVal < DBL_EPSILON ) ? DBL_EPSILON : xVal; + yScale_ = (yVal < DBL_EPSILON ) ? DBL_EPSILON : yVal; + zScale_ = (zVal < DBL_EPSILON ) ? DBL_EPSILON : zVal; + + updateGL(); + emit scaleChanged(xVal, yVal, zVal); +} + +/** + Set the (zoom in addition to scale). + \param val zoom value (value == 1 indicates no zooming) +*/ +void Plot3D::setZoom( double val ) +{ + if (zoom_ == val) + return; + + zoom_ = (val < DBL_EPSILON ) ? DBL_EPSILON : val; + updateGL(); + emit zoomChanged(val); +} -- cgit v1.2.3