DPG improvements
eliminate orientation matrix remove appl logic from dialog add 3D/Front buttons
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
#include "PreCompiled.h"
|
||||
#include "Tools.h"
|
||||
#include "Vector3D.h"
|
||||
|
||||
#include "Matrix.h"
|
||||
using namespace Base;
|
||||
|
||||
template <class _Precision>
|
||||
@@ -96,7 +96,7 @@ Vector3<_Precision> Vector3<_Precision>::operator - (const Vector3<_Precision>&
|
||||
cVctRes.z = z - rcVct.z;
|
||||
return cVctRes;
|
||||
}
|
||||
|
||||
|
||||
template <class _Precision>
|
||||
Vector3<_Precision> Vector3<_Precision>::operator - (void) const
|
||||
{
|
||||
@@ -131,7 +131,7 @@ Vector3<_Precision>& Vector3<_Precision>::operator *= (_Precision fScale)
|
||||
}
|
||||
|
||||
template <class _Precision>
|
||||
Vector3<_Precision>& Vector3<_Precision>::operator /= (_Precision fDiv)
|
||||
Vector3<_Precision>& Vector3<_Precision>::operator /= (_Precision fDiv)
|
||||
{
|
||||
x /= fDiv;
|
||||
y /= fDiv;
|
||||
@@ -192,9 +192,47 @@ Vector3<_Precision> Vector3<_Precision>::Cross(const Vector3<_Precision>& rcVct)
|
||||
return cVctRes;
|
||||
}
|
||||
|
||||
template <class _Precision>
|
||||
Matrix4D Vector3<_Precision>::Outer(const Vector3<_Precision>& rcVct) const
|
||||
{
|
||||
Matrix4D mat;
|
||||
mat[0][0] = x * rcVct.x;
|
||||
mat[0][1] = x * rcVct.y;
|
||||
mat[0][2] = x * rcVct.z;
|
||||
|
||||
mat[1][0] = y * rcVct.x;
|
||||
mat[1][1] = y * rcVct.y;
|
||||
mat[1][2] = y * rcVct.z;
|
||||
|
||||
mat[2][0] = z * rcVct.x;
|
||||
mat[2][1] = z * rcVct.y;
|
||||
mat[2][2] = z * rcVct.z;
|
||||
|
||||
return mat;
|
||||
}
|
||||
|
||||
template <class _Precision>
|
||||
Matrix4D Vector3<_Precision>::Hat(void) const
|
||||
{
|
||||
Matrix4D mat;
|
||||
mat[0][0] = 0.0;
|
||||
mat[0][1] = -z;
|
||||
mat[0][2] = y;
|
||||
|
||||
mat[1][0] = z;
|
||||
mat[1][1] = 0.0;
|
||||
mat[1][2] = -x;
|
||||
|
||||
mat[2][0] = -y;
|
||||
mat[2][1] = x;
|
||||
mat[2][2] = 0.0;
|
||||
|
||||
return mat;
|
||||
}
|
||||
|
||||
template <class _Precision>
|
||||
bool Vector3<_Precision>::operator != (const Vector3<_Precision>& rcVct) const
|
||||
{
|
||||
{
|
||||
return !((*this) == rcVct);
|
||||
}
|
||||
|
||||
@@ -213,7 +251,7 @@ bool Vector3<_Precision>::IsEqual(const Vector3<_Precision> &rclPnt, _Precision
|
||||
}
|
||||
|
||||
template <class _Precision>
|
||||
Vector3<_Precision>& Vector3<_Precision>::ProjectToPlane (const Vector3<_Precision> &rclBase,
|
||||
Vector3<_Precision>& Vector3<_Precision>::ProjectToPlane (const Vector3<_Precision> &rclBase,
|
||||
const Vector3<_Precision> &rclNorm)
|
||||
{
|
||||
Vector3<_Precision> clTemp(rclNorm);
|
||||
@@ -231,7 +269,7 @@ void Vector3<_Precision>::ProjectToPlane (const Vector3 &rclBase,
|
||||
}
|
||||
|
||||
template <class _Precision>
|
||||
_Precision Vector3<_Precision>::DistanceToPlane (const Vector3<_Precision> &rclBase,
|
||||
_Precision Vector3<_Precision>::DistanceToPlane (const Vector3<_Precision> &rclBase,
|
||||
const Vector3<_Precision> &rclNorm) const
|
||||
{
|
||||
return ((*this - rclBase) * rclNorm) / rclNorm.Length();
|
||||
@@ -244,7 +282,7 @@ _Precision Vector3<_Precision>::Length (void) const
|
||||
}
|
||||
|
||||
template <class _Precision>
|
||||
_Precision Vector3<_Precision>::DistanceToLine (const Vector3<_Precision> &rclBase,
|
||||
_Precision Vector3<_Precision>::DistanceToLine (const Vector3<_Precision> &rclBase,
|
||||
const Vector3<_Precision> &rclDirect) const
|
||||
{
|
||||
return (_Precision) fabs((rclDirect % Vector3(*this - rclBase)).Length() / rclDirect.Length());
|
||||
@@ -401,7 +439,7 @@ _Precision Vector3<_Precision>::GetAngle (const Vector3 &rcVect) const
|
||||
_Precision divid, fNum;
|
||||
|
||||
divid = Length() * ((Vector3<_Precision>&)rcVect).Length();
|
||||
|
||||
|
||||
if ((divid < -1e-10f) || (divid > 1e-10f)) {
|
||||
fNum = (*this * rcVect) / divid;
|
||||
if (fNum < -1)
|
||||
|
||||
@@ -73,6 +73,10 @@ struct float_traits<double> {
|
||||
static inline float_type maximum() { return DBL_MAX; }
|
||||
};
|
||||
|
||||
class Matrix4D;
|
||||
//#include <Base/Matrix.h>
|
||||
|
||||
|
||||
/** The Vector Base class. */
|
||||
template <class _Precision>
|
||||
class Vector3
|
||||
@@ -126,6 +130,11 @@ public:
|
||||
Vector3 operator % (const Vector3<_Precision>& rcVct) const;
|
||||
/// Cross product
|
||||
Vector3 Cross (const Vector3<_Precision>& rcVct) const;
|
||||
/// Outer product
|
||||
Matrix4D Outer(const Vector3<_Precision>& rcVct) const;
|
||||
/// Hat operator (skew symmetric)
|
||||
Matrix4D Hat(void) const;
|
||||
|
||||
/// Comparing for inequality
|
||||
bool operator != (const Vector3<_Precision>& rcVct) const;
|
||||
/// Comparing for equality
|
||||
@@ -159,8 +168,8 @@ public:
|
||||
Vector3 & Normalize (void);
|
||||
/// Get angle between both vectors. The returned value lies in the interval [0,pi].
|
||||
_Precision GetAngle (const Vector3 &rcVect) const;
|
||||
/** Transforms this point to the coordinate system defined by origin \a rclBase,
|
||||
* vector \a vector rclDirX and vector \a vector rclDirY.
|
||||
/** Transforms this point to the coordinate system defined by origin \a rclBase,
|
||||
* vector \a vector rclDirX and vector \a vector rclDirY.
|
||||
* \note \a rclDirX must be perpendicular to \a rclDirY, i.e. \a rclDirX * \a rclDirY = 0..
|
||||
*/
|
||||
void TransformToCoordinateSystem (const Vector3 &rclBase, const Vector3 &rclDirX, const Vector3 &rclDirY);
|
||||
@@ -183,7 +192,7 @@ public:
|
||||
/// Projects this point onto the line given by the base \a rclPoint and the direction \a rclLine.
|
||||
/**
|
||||
* Projects a point \a rclPoint onto the line defined by the origin and the direction \a rclLine.
|
||||
* The result is a vector from \a rclPoint to the point on the line. The length of this vector
|
||||
* The result is a vector from \a rclPoint to the point on the line. The length of this vector
|
||||
* is the distance from \a rclPoint to the line.
|
||||
* Note: The resulting vector does not depend on the current vector.
|
||||
*/
|
||||
@@ -286,4 +295,3 @@ inline _Vec1 convertTo(const _Vec2& v)
|
||||
} // namespace Base
|
||||
|
||||
#endif // BASE_VECTOR3D_H
|
||||
|
||||
|
||||
Reference in New Issue
Block a user