aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Geometry/Hyperplane.h
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-08-03 17:20:45 +0200
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-08-03 17:20:45 +0200
commit523cdedf58a95c02c73ede59fe9d22c5799a9df5 (patch)
tree1b065691c6d0521480ebd0acc8f207c8630895ec /Eigen/src/Geometry/Hyperplane.h
parent912da9fade7a02086747d086e0634cab0d6ff4b6 (diff)
make the dot product linear in the second variable, not the first variable
Diffstat (limited to 'Eigen/src/Geometry/Hyperplane.h')
-rw-r--r--Eigen/src/Geometry/Hyperplane.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/Eigen/src/Geometry/Hyperplane.h b/Eigen/src/Geometry/Hyperplane.h
index 6fd9cee7e..ab65ca2ae 100644
--- a/Eigen/src/Geometry/Hyperplane.h
+++ b/Eigen/src/Geometry/Hyperplane.h
@@ -71,7 +71,7 @@ public:
: m_coeffs(n.size()+1)
{
normal() = n;
- offset() = -e.dot(n);
+ offset() = -n.dot(e);
}
/** Constructs a plane from its normal \a n and distance to the origin \a d
@@ -92,7 +92,7 @@ public:
{
Hyperplane result(p0.size());
result.normal() = (p1 - p0).unitOrthogonal();
- result.offset() = -result.normal().dot(p0);
+ result.offset() = -p0.dot(result.normal());
return result;
}
@@ -104,7 +104,7 @@ public:
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(VectorType, 3)
Hyperplane result(p0.size());
result.normal() = (p2 - p0).cross(p1 - p0).normalized();
- result.offset() = -result.normal().dot(p0);
+ result.offset() = -p0.dot(result.normal());
return result;
}
@@ -116,7 +116,7 @@ public:
explicit Hyperplane(const ParametrizedLine<Scalar, AmbientDimAtCompileTime>& parametrized)
{
normal() = parametrized.direction().unitOrthogonal();
- offset() = -normal().dot(parametrized.origin());
+ offset() = -parametrized.origin().dot(normal());
}
~Hyperplane() {}
@@ -133,7 +133,7 @@ public:
/** \returns the signed distance between the plane \c *this and a point \a p.
* \sa absDistance()
*/
- inline Scalar signedDistance(const VectorType& p) const { return p.dot(normal()) + offset(); }
+ inline Scalar signedDistance(const VectorType& p) const { return normal().dot(p) + offset(); }
/** \returns the absolute distance between the plane \c *this and a point \a p.
* \sa signedDistance()
@@ -231,7 +231,7 @@ public:
TransformTraits traits = Affine)
{
transform(t.linear(), traits);
- offset() -= t.translation().dot(normal());
+ offset() -= normal().dot(t.translation());
return *this;
}