VectorSpace: Added cmptSqr
This commit is contained in:
@ -302,11 +302,18 @@ inline Scalar cmptAv(const Scalar s)
|
||||
}
|
||||
|
||||
|
||||
inline Scalar cmptSqr(const Scalar s)
|
||||
{
|
||||
return sqr(s);
|
||||
}
|
||||
|
||||
|
||||
inline Scalar cmptMag(const Scalar s)
|
||||
{
|
||||
return mag(s);
|
||||
}
|
||||
|
||||
|
||||
inline Scalar sqrtSumSqr(const Scalar a, const Scalar b)
|
||||
{
|
||||
Scalar maga = mag(a);
|
||||
@ -323,7 +330,7 @@ inline Scalar sqrtSumSqr(const Scalar a, const Scalar b)
|
||||
}
|
||||
|
||||
|
||||
// Stabilisation around zero for division
|
||||
//- Stabilisation around zero for division
|
||||
inline Scalar stabilise(const Scalar s, const Scalar small)
|
||||
{
|
||||
if (s >= 0)
|
||||
|
||||
@ -537,6 +537,18 @@ inline Cmpt cmptProduct
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, direction Ncmpts>
|
||||
inline Form cmptSqr
|
||||
(
|
||||
const VectorSpace<Form, Cmpt, Ncmpts>& vs
|
||||
)
|
||||
{
|
||||
Form v;
|
||||
VectorSpaceOps<Ncmpts,0>::eqOp(v, vs, eqSqrOp<Cmpt>());
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, direction Ncmpts>
|
||||
inline Form cmptMag
|
||||
(
|
||||
|
||||
@ -72,6 +72,7 @@ EqOp(plusEq, x += y)
|
||||
EqOp(minusEq, x -= y)
|
||||
EqOp(multiplyEq, x *= y)
|
||||
EqOp(divideEq, x /= y)
|
||||
EqOp(eqSqr, x = sqr(y))
|
||||
EqOp(eqMag, x = mag(y))
|
||||
EqOp(plusEqMagSqr, x += magSqr(y))
|
||||
EqOp(maxEq, x = max(x, y))
|
||||
|
||||
Reference in New Issue
Block a user