[TD] extend Base::Vector3D
This commit is contained in:
@@ -227,6 +227,25 @@ bool Vector3<float_type>::IsEqual(const Vector3<float_type>& rclPnt, float_type
|
||||
return Distance(*this, rclPnt) <= tol;
|
||||
}
|
||||
|
||||
template<class float_type>
|
||||
bool Vector3<float_type>::IsParallel(const Vector3<float_type>& rclPnt, float_type tol) const
|
||||
{
|
||||
Vector3<float_type> v1 = *this;
|
||||
Vector3<float_type> v2 = rclPnt;
|
||||
double dot = abs(v1 * v2);
|
||||
double mag = v1.Length() * v2.Length();
|
||||
return (abs(dot - mag) < tol);
|
||||
}
|
||||
|
||||
template<class float_type>
|
||||
bool Vector3<float_type>::IsNormal(const Vector3<float_type>& rclPnt, float_type tol) const
|
||||
{
|
||||
Vector3<float_type> v1 = *this;
|
||||
Vector3<float_type> v2 = rclPnt;
|
||||
double dot = abs(v1 * v2);
|
||||
return (dot < tol);
|
||||
}
|
||||
|
||||
template<class float_type>
|
||||
Vector3<float_type>& Vector3<float_type>::ProjectToPlane(const Vector3<float_type>& rclBase,
|
||||
const Vector3<float_type>& rclNorm)
|
||||
|
||||
@@ -210,6 +210,10 @@ public:
|
||||
* equal.
|
||||
*/
|
||||
bool IsEqual(const Vector3& rclPnt, float_type tol) const;
|
||||
/// Returns true if two vectors are parallel within the tol
|
||||
bool IsParallel(const Vector3& rclPnt, float_type tol) const;
|
||||
/// Returns true if two vectors are normal within the tol
|
||||
bool IsNormal(const Vector3& rclPnt, float_type tol) const;
|
||||
/// Projects this point onto the plane given by the base \a rclBase and the normal \a rclNorm.
|
||||
Vector3& ProjectToPlane(const Vector3& rclBase, const Vector3& rclNorm);
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user