Plane.hpp
Go to the documentation of this file.
1 
2 namespace GfxTL
3 {
4  template <class PointT>
6  {
7  }
8 
9  template <class PointT>
10  Plane<PointT>::Plane(const PointType& normal, const PointType& origin) : _normal(normal)
11  {
12  _d = -(_normal * origin);
13  }
14 
15  template <class PointT>
16  void
17  Plane<PointT>::Set(const PointType& origin, const PointType& normal)
18  {
19  _normal = normal;
20  _d = -(_normal * origin);
21  }
22 
23  template <class PointT>
26  {
27  return _normal * p + _d;
28  }
29 
30  template <class PointT>
31  void
33  {
34  ScalarType factor = Math<ScalarType>::Sign(_normal * n);
35  _normal *= factor;
36  _d *= factor;
37  }
38 
39  template <class PointT>
40  void
42  {
43  *s = p - SignedDistance(p) * _normal;
44  }
45 
46  template <class PointT>
47  void
49  {
50  *normal = _normal;
51  }
52 
53  template <class PointT>
54  void
56  {
57  _normal = normal;
58  }
59 
60  template <class PointT>
61  typename Plane<PointT>::PointType&
63  {
64  return _normal;
65  }
66 
67  template <class PointT>
68  const typename Plane<PointT>::PointType&
69  Plane<PointT>::Normal() const
70  {
71  return _normal;
72  }
73 
74  template <class PointT>
75  void
77  {
78  _d = -(_normal * o);
79  }
80 
81  template <class PointT>
83  Plane<PointT>::Intersect(const PointType& p, const PointType& r) const
84  {
85  return -SignedDistance(p) / (_normal * r);
86  }
87 }; // namespace GfxTL
GfxTL::Plane::ScalarType
PointType::ScalarType ScalarType
Definition: Plane.h:18
GfxTL::Plane::PointType
PointT PointType
Definition: Plane.h:17
GfxTL::Plane::Orient
void Orient(const PointType &n)
Definition: Plane.hpp:32
GfxTL::Plane::Intersect
ScalarType Intersect(const PointType &p, const PointType &r) const
Definition: Plane.hpp:83
GfxTL::Plane::Origin
void Origin(const PointType &o)
Definition: Plane.hpp:76
GfxTL::Math::Sign
static ScalarT Sign(ScalarT s)
Definition: MathHelper.h:25
GfxTL::Plane::Set
void Set(const PointType &origin, const PointType &normal)
Definition: Plane.hpp:17
GfxTL::Plane::Project
void Project(const PointType &p, PointType *s) const
Definition: Plane.hpp:41
GfxTL
Definition: AABox.h:9
GfxTL::Plane::Plane
Plane()
Definition: Plane.hpp:5
GfxTL::Plane::Normal
PointType & Normal()
Definition: Plane.hpp:62
GfxTL::Plane::SignedDistance
ScalarType SignedDistance(const PointType &p) const
Definition: Plane.hpp:25
armarx::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:33