30 #include "point_funcs.h"
31 #include "axisbox_funcs.h"
34 #include "quaternion.h"
45 _PolarToCart(d, m_elem);
54 _CartToPolar(m_elem, d);
63 _PolarToCart(d, m_elem);
73 _CartToPolar(m_elem, d);
83 _SphericalToCart(d, m_elem);
93 _CartToSpherical(m_elem, d);
102 return (*
this = p + (*
this - p).rotate(q));
106 Point<3>& Point<3>::rotatePoint(
const Quaternion& q,
const Point<3>& p)
112 Point<3> Point<3>::toLocalCoords(
const Point<3>& origin,
113 const Quaternion& rotation)
const
115 return Point().setToOrigin() + (*
this - origin).rotate(rotation.inverse());
119 Point<3> Point<3>::toParentCoords(
const Point<3>& origin,
120 const Quaternion& rotation)
const
122 return origin + (*
this - Point().setToOrigin()).rotate(rotation);
125 template class Point<3>;
126 template class Point<2>;
128 static_assert(std::is_standard_layout<Point<3>>::value,
"Point should be standard layout.");
129 static_assert(std::is_trivially_copyable<Point<3>>::value,
"Point should be trivially copyable.");
131 static_assert(std::is_standard_layout<Point<2>>::value,
"Point should be standard layout.");
132 static_assert(std::is_trivially_copyable<Point<2>>::value,
"Point should be trivially copyable.");
134 template CoordType SquaredDistance<3>(
const Point<3> &,
const Point<3> &);
135 template CoordType SquaredDistance<2>(
const Point<2> &,
const Point<2> &);
137 template Point<3> Midpoint<3>(
const Point<3> &,
const Point<3> &, CoordType);
138 template Point<2> Midpoint<2>(
const Point<2> &,
const Point<2> &, CoordType);
140 template Point<3> Barycenter<3, std::vector>(
const std::vector<Point<3> > &);
141 template Point<3> Barycenter<3, std::vector, std::list>(
const std::vector<Point<3> > &,
const std::list<CoordType> &);
143 template Point<2> Barycenter<2, std::vector>(
const std::vector<Point<2> > &);
144 template Point<2> Barycenter<2, std::vector, std::list>(
const std::vector<Point<2> > &,
const std::list<CoordType> &);
146 template Vector<3>
operator-<3>(
const Point<3> &,
const Point<3> &);
147 template Vector<2>
operator-<2>(
const Point<2> &,
const Point<2> &);
149 template Point<3>
operator-<3>(
const Point<3> &,
const Vector<3> &);
150 template Point<2>
operator-<2>(
const Point<2> &,
const Vector<2> &);
152 template Point<3>&
operator-=<3>(Point<3> &,
const Vector<3> &);
153 template Point<2>&
operator-=<2>(Point<2> &,
const Vector<2> &);
155 template Point<3>
operator+<3>(
const Vector<3> &,
const Point<3> &);
156 template Point<2>
operator+<2>(
const Vector<2> &,
const Point<2> &);
158 template Point<3>
operator+<3>(
const Point<3> &,
const Vector<3> &);
159 template Point<2>
operator+<2>(
const Point<2> &,
const Vector<2> &);
161 template Point<3>&
operator+=<3>(Point<3> &,
const Vector<3> &);
162 template Point<2>&
operator+=<2>(Point<2> &,
const Vector<2> &);
void asSpherical(CoordType &r, CoordType &theta, CoordType &phi) const
3D only: convert a vector to spherical coordinates
Point & polar(CoordType r, CoordType theta)
2D only: construct a vector from polar coordinates
Point & rotate(const RotMatrix< dim > &m, const Point &p)
Rotate about point p.
void asPolar(CoordType &r, CoordType &theta) const
2D only: convert a vector to polar coordinates
Point & spherical(CoordType r, CoordType theta, CoordType phi)
3D only: construct a vector from spherical coordinates
Generic library namespace.
double CoordType
Basic floating point type.