50 #ifndef ACG_QUADRIC_HH 51 #define ACG_QUADRIC_HH 57 #include "../../Math/VectorT.hh" 76 template <
class Scalar>
83 QuadricT(Scalar _a, Scalar _b, Scalar _c, Scalar _d,
84 Scalar _e, Scalar _f, Scalar _g,
87 : a(_a), b(_b), c(_c), d(_d),
95 QuadricT( Scalar _a=0.0, Scalar _b=0.0, Scalar _c=0.0, Scalar _d=0.0 )
96 : a(_a*_a), b(_a*_b), c(_a*_c), d(_a*_d),
97 e(_b*_b), f(_b*_c), g(_b*_d),
104 void clear() { a = b = c = d = e = f = g = h = i = j = 0.0; }
110 a += _q.a; b += _q.b; c += _q.c; d += _q.d;
111 e += _q.e; f += _q.f; g += _q.g;
112 h += _q.h; i += _q.i;
121 a *= _s; b *= _s; c *= _s; d *= _s;
122 e *= _s; f *= _s; g *= _s;
133 _v[0]*b + _v[1]*e + _v[2]*f + _v[3]*g,
134 _v[0]*c + _v[1]*f + _v[2]*h + _v[3]*i,
135 _v[0]*d + _v[1]*g + _v[2]*i + _v[3]*j);
142 Scalar x(_v[0]), y(_v[1]), z(_v[2]);
143 return a*x*x + 2.0*b*x*y + 2.0*c*x*z + 2.0*d*x
144 + e*y*y + 2.0*f*y*z + 2.0*g*y
153 Scalar x(_v[0]), y(_v[1]), z(_v[2]), w(_v[3]);
154 return a*x*x + 2.0*b*x*y + 2.0*c*x*z + 2.0*d*x*w
155 + e*y*y + 2.0*f*y*z + 2.0*g*y*w
181 #endif // ACG_QUADRIC_HH defined void clear()
set all entries to zero
Namespace providing different geometric functions concerning angles.
QuadricT(Scalar _a=0.0, Scalar _b=0.0, Scalar _c=0.0, Scalar _d=0.0)
constructor from given plane equation: ax+by+cz+d=0
VectorT< Scalar, 4 > operator*(const VectorT< Scalar, 4 > &_v) const
multiply 4D vector from right: Q*v
QuadricT< float > Quadricf
Quadric using floats.
QuadricT(Scalar _a, Scalar _b, Scalar _c, Scalar _d, Scalar _e, Scalar _f, Scalar _g, Scalar _h, Scalar _i, Scalar _j)
construct with upper triangle of symmetrix 4x4 matrix
Scalar operator()(const VectorT< Scalar, 4 > _v) const
evaluate quadric Q at vector v: v*Q*v
QuadricT< double > Quadricd
Quadric using double.
Scalar operator()(const VectorT< Scalar, 3 > _v) const
evaluate quadric Q at vector v: v*Q*v
QuadricT< Scalar > & operator*=(Scalar _s)
multiply by scalar
QuadricT< Scalar > & operator+=(const QuadricT< Scalar > &_q)
add quadrics