Add is_zero for vector magnitude
This commit is contained in:
parent
f8ad4c0c04
commit
68adb32472
@ -184,6 +184,14 @@ vector::cartesian_to_spherical (const vector &c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
vector::is_zero (void) const {
|
||||||
|
return almost_equal (x, 0.0) &&
|
||||||
|
almost_equal (y, 0.0) &&
|
||||||
|
almost_equal (z, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
vector::sanity (void) const {
|
vector::sanity (void) const {
|
||||||
check_soft (!std::isnan (x));
|
check_soft (!std::isnan (x));
|
||||||
|
@ -56,6 +56,8 @@ namespace util {
|
|||||||
static vector spherical_to_cartesian (const vector &);
|
static vector spherical_to_cartesian (const vector &);
|
||||||
static vector cartesian_to_spherical (const vector &);
|
static vector cartesian_to_spherical (const vector &);
|
||||||
|
|
||||||
|
bool is_zero (void) const;
|
||||||
|
|
||||||
void sanity (void) const;
|
void sanity (void) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user