59 #ifndef ACG_QUADRIC_HH
60 #define ACG_QUADRIC_HH
66 #include "../../Math/VectorT.hh"
85 template <
class Scalar>
92 QuadricT(Scalar _a, Scalar _b, Scalar _c, Scalar _d,
93 Scalar _e, Scalar _f, Scalar _g,
96 : a(_a), b(_b), c(_c), d(_d),
104 QuadricT( Scalar _a=0.0, Scalar _b=0.0, Scalar _c=0.0, Scalar _d=0.0 )
105 : a(_a*_a), b(_a*_b), c(_a*_c), d(_a*_d),
106 e(_b*_b), f(_b*_c), g(_b*_d),
113 void clear() { a = b = c = d = e = f = g = h = i = j = 0.0; }
119 a += _q.a; b += _q.b; c += _q.c; d += _q.d;
120 e += _q.e; f += _q.f; g += _q.g;
121 h += _q.h; i += _q.i;
130 a *= _s; b *= _s; c *= _s; d *= _s;
131 e *= _s; f *= _s; g *= _s;
142 _v[0]*b + _v[1]*e + _v[2]*f + _v[3]*g,
143 _v[0]*c + _v[1]*f + _v[2]*h + _v[3]*i,
144 _v[0]*d + _v[1]*g + _v[2]*i + _v[3]*j);
151 Scalar x(_v[0]), y(_v[1]), z(_v[2]);
152 return a*x*x + 2.0*b*x*y + 2.0*c*x*z + 2.0*d*x
153 + e*y*y + 2.0*f*y*z + 2.0*g*y
162 Scalar x(_v[0]), y(_v[1]), z(_v[2]), w(_v[3]);
163 return a*x*x + 2.0*b*x*y + 2.0*c*x*z + 2.0*d*x*w
164 + e*y*y + 2.0*f*y*z + 2.0*g*y*w
190 #endif // ACG_QUADRIC_HH defined
Namespace providing different geometric functions concerning angles.
QuadricT< Scalar > & operator*=(Scalar _s)
multiply by scalar
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
Scalar operator()(const VectorT< Scalar, 3 > _v) const
evaluate quadric Q at vector v: v*Q*v
Scalar operator()(const VectorT< Scalar, 4 > _v) const
evaluate quadric Q at vector v: v*Q*v
QuadricT< Scalar > & operator+=(const QuadricT< Scalar > &_q)
add quadrics
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
VectorT< Scalar, 4 > operator*(const VectorT< Scalar, 4 > &_v) const
multiply 4D vector from right: Q*v
void clear()
set all entries to zero
QuadricT< double > Quadricd
Quadric using double.