1 #ifndef INCLUDE_AL_CURVE_HPP
2 #define INCLUDE_AL_CURVE_HPP
49 void frenet(
const V2& d1, V2& t, V2& n);
54 void frenet(
const V3& d1,
const V3& d2, V3& t, V3& n, V3& b);
58 void frenet(
const V3& p2,
const V3& p1,
const V3& p0, V3& t, V3& n, V3& b);
82 Frenet(
const Vec3& p2 = Vec3(0, -0.01, 0),
const Vec3& p1 = Vec3(0, 0, 0)) {
87 const Vec3&
point()
const {
return mp1; }
90 const Vec3&
db()
const {
return mdb; }
93 const Vec3&
df()
const {
return mdf; }
96 Vec3
d2()
const {
return mdf - mdb; }
99 void operator()(
const Vec3& p0) { next<1, 1, 1, 1, 1>(p0); }
107 template <
bool NormalizeT,
bool NormalizeN,
bool NormalizeB,
bool ComputeN,
119 if (NormalizeT)
T.normalize();
127 if (ComputeB || ComputeN) {
134 if (NormalizeN)
N.normalize();
137 if (NormalizeB)
B.normalize();
141 void init(
const Vec3& p2,
const Vec3& p1) {
162 inline void frenet(
const V2& d1, V2& t, V2& n) {
171 inline void frenet(
const V3& d1,
const V3& d2, V3& t, V3& n, V3& b) {
181 inline void frenet(
const V3& p2,
const V3& p1,
const V3& p0, V3& t, V3& n,
184 V3 d2 = (p0 - p1 * 2. + p2);
void frenet(const V2 &d1, V2 &t, V2 &n)
Compute Frenet frame (tangent, normal) from 1st difference.
void cross(Vec< 3, T > &r, const Vec< 3, T > &a, const Vec< 3, T > &b)
Sets r to cross product, a x b.
Vec3 T
Tangent vector of current frame.
Frenet(const Vec3 &p2=Vec3(0, -0.01, 0), const Vec3 &p1=Vec3(0, 0, 0))
Vec3 B
Binormal vector of current frame.
void next(const Vec3 &p0)
Compute Frenet frame one point back from input point.
const Vec3 & df() const
Get forward first difference.
Vec3 N
Normal vector of current frame.
void operator()(const Vec3 &p0)
Compute Frenet frame one point back from input point.
void init(const Vec3 &p2, const Vec3 &p1)
(Re)initialize with previous two points
Vec3 d2() const
Get (central) second difference.
const Vec3 & db() const
Get backward first difference.
const Vec3 & point() const
Get point one ahead of currently stored frame.