diff options
Diffstat (limited to 'include/basegfx/vector/b3dvector.hxx')
-rw-r--r-- | include/basegfx/vector/b3dvector.hxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/basegfx/vector/b3dvector.hxx b/include/basegfx/vector/b3dvector.hxx index 1e8572e12266..8a8997b16fbc 100644 --- a/include/basegfx/vector/b3dvector.hxx +++ b/include/basegfx/vector/b3dvector.hxx @@ -126,6 +126,18 @@ namespace basegfx return sqrt(fLen); } + /** Calculate the length in the XY-Plane for this 3D Vector + + @return The XY-Plane Length of the 3D Vector + */ + double getXYLength() const + { + double fLen((mfX * mfX) + (mfY * mfY)); + if((0.0 == fLen) || (1.0 == fLen)) + return fLen; + return sqrt(fLen); + } + /** Calculate the length in the XZ-Plane for this 3D Vector @return The XZ-Plane Length of the 3D Vector @@ -182,6 +194,20 @@ namespace basegfx */ B3DVector& normalize(); + /** Test if this 3D Vector is normalized + + @return + true if lenth of vector is equal to 1.0 + false else + */ + bool isNormalized() const + { + const double fOne(1.0); + const double fScalar(scalar(*this)); + + return (::basegfx::fTools::equal(fOne, fScalar)); + } + /** get a 3D Vector which is perpendicular to this and a given 3D Vector @attention This only works if this and the given 3D Vector are |