summaryrefslogtreecommitdiff
path: root/basegfx/inc/basegfx/vector
diff options
context:
space:
mode:
authorArmin Weiss <aw@openoffice.org>2003-11-28 10:18:16 +0000
committerArmin Weiss <aw@openoffice.org>2003-11-28 10:18:16 +0000
commitd539c95155ccc7030411f7494704894a3ac610a8 (patch)
treedc3dbd283a5f501f6e48dd585d80bb158db920e3 /basegfx/inc/basegfx/vector
parentce0ce72d1fd37f7b8e7cb4ebc372d8cd6b4ab9c0 (diff)
Removed in-between namespaces (curve, matrix, numeric, point, polygon, range, tuple, vector). Names were too common and e.g. vector leaded to problems with some defines. This is now avoided. Also some bug fixes, addition of 3d polygon tooling etc.
Diffstat (limited to 'basegfx/inc/basegfx/vector')
-rw-r--r--basegfx/inc/basegfx/vector/b2dvector.hxx382
-rw-r--r--basegfx/inc/basegfx/vector/b3dvector.hxx464
2 files changed, 417 insertions, 429 deletions
diff --git a/basegfx/inc/basegfx/vector/b2dvector.hxx b/basegfx/inc/basegfx/vector/b2dvector.hxx
index f35c38bb3236..6b5fe724b3e9 100644
--- a/basegfx/inc/basegfx/vector/b2dvector.hxx
+++ b/basegfx/inc/basegfx/vector/b2dvector.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dvector.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: aw $ $Date: 2003-11-26 14:40:05 $
+ * last change: $Author: aw $ $Date: 2003-11-28 11:17:58 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -68,250 +68,244 @@
namespace basegfx
{
- namespace matrix
+ // predeclaration
+ class B2DHomMatrix;
+
+ /** Descriptor for the mathematical orientations of two 2D Vectors
+ */
+ enum B2DVectorOrientation
+ {
+ /// mathematically positive oriented
+ ORIENTATION_POSITIVE = 0,
+
+ /// mathematically negative oriented
+ ORIENTATION_NEGATIVE,
+
+ /// mathematically neutral, thus parallel
+ ORIENTATION_NEUTRAL
+ };
+
+ /** Descriptor for the mathematical continuity of two 2D Vectors
+ */
+ enum B2DVectorContinuity
{
- // predeclaration
- class B2DHomMatrix;
- } // end of namespace matrix;
+ /// none
+ CONTINUITY_NONE = 0,
+
+ /// mathematically negative oriented
+ CONTINUITY_C1,
- namespace vector
+ /// mathematically neutral, thus parallel
+ CONTINUITY_C2
+ };
+
+ /** Base Point class with two double values
+
+ This class derives all operators and common handling for
+ a 2D data class from B2DTuple. All necessary extensions
+ which are special for 2D Vectors are added here.
+
+ @see B2DTuple
+ */
+ class B2DVector : public ::basegfx::B2DTuple
{
- /** Descriptor for the mathematical orientations of two 2D Vectors
+ public:
+ /** Create a 2D Vector
+
+ @param fVal
+ This parameter is used to initialize the coordinate
+ part of the 2D Vector.
*/
- enum B2DVectorOrientation
- {
- /// mathematically positive oriented
- ORIENTATION_POSITIVE = 0,
+ B2DVector(double fVal = 0.0)
+ : B2DTuple(fVal)
+ {}
- /// mathematically negative oriented
- ORIENTATION_NEGATIVE,
+ /** Create a 2D Vector
- /// mathematically neutral, thus parallel
- ORIENTATION_NEUTRAL
- };
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 2D Vector.
- /** Descriptor for the mathematical continuity of two 2D Vectors
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 2D Vector.
*/
- enum B2DVectorContinuity
- {
- /// none
- CONTINUITY_NONE = 0,
+ B2DVector(double fX, double fY)
+ : B2DTuple(fX, fY)
+ {}
- /// mathematically negative oriented
- CONTINUITY_C1,
+ /** Create a copy of a 2D Vector
- /// mathematically neutral, thus parallel
- CONTINUITY_C2
- };
+ @param rVec
+ The 2D Vector which will be copied.
+ */
+ B2DVector(const B2DVector& rVec)
+ : B2DTuple(rVec)
+ {}
- /** Base Point class with two double values
+ /** constructor with tuple to allow copy-constructing
+ from B2DTuple-based classes
+ */
+ B2DVector(const ::basegfx::B2DTuple& rTuple)
+ : B2DTuple(rTuple)
+ {}
- This class derives all operators and common handling for
- a 2D data class from B2DTuple. All necessary extensions
- which are special for 2D Vectors are added here.
+ ~B2DVector()
+ {}
- @see B2DTuple
+ /** *=operator to allow usage from B2DVector, too
*/
- class B2DVector : public ::basegfx::tuple::B2DTuple
+ B2DVector& operator*=( const B2DVector& rPnt )
{
- public:
- /** Create a 2D Vector
-
- @param fVal
- This parameter is used to initialize the coordinate
- part of the 2D Vector.
- */
- B2DVector(double fVal = 0.0)
- : B2DTuple(fVal)
- {}
-
- /** Create a 2D Vector
-
- @param fX
- This parameter is used to initialize the X-coordinate
- of the 2D Vector.
-
- @param fY
- This parameter is used to initialize the Y-coordinate
- of the 2D Vector.
- */
- B2DVector(double fX, double fY)
- : B2DTuple(fX, fY)
- {}
-
- /** Create a copy of a 2D Vector
-
- @param rVec
- The 2D Vector which will be copied.
- */
- B2DVector(const B2DVector& rVec)
- : B2DTuple(rVec)
- {}
-
- /** constructor with tuple to allow copy-constructing
- from B2DTuple-based classes
- */
- B2DVector(const ::basegfx::tuple::B2DTuple& rTuple)
- : B2DTuple(rTuple)
- {}
-
- ~B2DVector()
- {}
-
- /** *=operator to allow usage from B2DVector, too
- */
- B2DVector& operator*=( const B2DVector& rPnt )
- {
- mfX *= rPnt.mfX;
- mfY *= rPnt.mfY;
- return *this;
- }
-
- /** *=operator to allow usage from B2DVector, too
- */
- B2DVector& operator*=(double t)
- {
- mfX *= t;
- mfY *= t;
- return *this;
- }
-
- /** assignment operator to allow assigning the results
- of B2DTuple calculations
- */
- B2DVector& operator=( const ::basegfx::tuple::B2DTuple& rVec );
-
- /** Calculate the length of this 2D Vector
-
- @return The Length of the 2D Vector
- */
- double getLength() const;
-
- /** Set the length of this 2D Vector
-
- @param fLen
- The to be achieved length of the 2D Vector
- */
- B2DVector& setLength(double fLen);
-
- /** Normalize this 2D Vector
-
- The length of the 2D Vector is set to 1.0
- */
- B2DVector& normalize();
-
- /** Test if this 2D Vector is normalized
-
- @return
- sal_True if lenth of vector is equal to 1.0
- sal_False else
- */
- sal_Bool isNormalized() const;
-
- /** Calculate the Scalar with another 2D Vector
-
- @param rVec
- The second 2D Vector
-
- @return
- The Scalar value of the two involved 2D Vectors
- */
- double scalar( const B2DVector& rVec ) const;
-
- /** Calculate the length of the cross product with another 2D Vector
-
- In 2D, returning an actual vector does not make much
- sense here. The magnitude, although, can be readily
- used for tasks such as angle calculations, since for
- the returned value, the following equation holds:
- retVal = getLength(this)*getLength(rVec)*sin(theta),
- with theta being the angle between the two vectors.
+ mfX *= rPnt.mfX;
+ mfY *= rPnt.mfY;
+ return *this;
+ }
- @param rVec
- The second 2D Vector
+ /** *=operator to allow usage from B2DVector, too
+ */
+ B2DVector& operator*=(double t)
+ {
+ mfX *= t;
+ mfY *= t;
+ return *this;
+ }
- @return
- The length of the cross product of the two involved 2D Vectors
- */
- double cross( const B2DVector& rVec ) const;
+ /** assignment operator to allow assigning the results
+ of B2DTuple calculations
+ */
+ B2DVector& operator=( const ::basegfx::B2DTuple& rVec );
- /** Calculate the Angle with another 2D Vector
+ /** Calculate the length of this 2D Vector
- @param rVec
- The second 2D Vector
+ @return The Length of the 2D Vector
+ */
+ double getLength() const;
- @return
- The Angle value of the two involved 2D Vectors in -pi/2 < return < pi/2
- */
- double angle( const B2DVector& rVec ) const;
+ /** Set the length of this 2D Vector
- /** Transform vector by given transformation matrix.
+ @param fLen
+ The to be achieved length of the 2D Vector
+ */
+ B2DVector& setLength(double fLen);
- Since this is a vector, translational components of the
- matrix are disregarded.
- */
- B2DVector& operator*=( const matrix::B2DHomMatrix& rMat );
+ /** Normalize this 2D Vector
- static const B2DVector& getEmptyVector();
- };
+ The length of the 2D Vector is set to 1.0
+ */
+ B2DVector& normalize();
- // external operators
- //////////////////////////////////////////////////////////////////////////
+ /** Test if this 2D Vector is normalized
- /** Calculate the orientation to another 2D Vector
+ @return
+ sal_True if lenth of vector is equal to 1.0
+ sal_False else
+ */
+ sal_Bool isNormalized() const;
- @param rVecA
- The first 2D Vector
+ /** Calculate the Scalar with another 2D Vector
- @param rVecB
+ @param rVec
The second 2D Vector
@return
- The mathematical Orientation of the two involved 2D Vectors
+ The Scalar value of the two involved 2D Vectors
*/
- B2DVectorOrientation getOrientation( const B2DVector& rVecA, const B2DVector& rVecB );
+ double scalar( const B2DVector& rVec ) const;
- /** Calculate a perpendicular 2D Vector to the given one
+ /** Calculate the length of the cross product with another 2D Vector
- @param rVec
- The source 2D Vector
+ In 2D, returning an actual vector does not make much
+ sense here. The magnitude, although, can be readily
+ used for tasks such as angle calculations, since for
+ the returned value, the following equation holds:
+ retVal = getLength(this)*getLength(rVec)*sin(theta),
+ with theta being the angle between the two vectors.
- @attention This only works if the given 2D Vector is normalized.
+ @param rVec
+ The second 2D Vector
@return
- A 2D Vector perpendicular to the one given in parameter rVec
+ The length of the cross product of the two involved 2D Vectors
*/
- B2DVector getPerpendicular( const B2DVector& rNormalizedVec );
-
- /** Test two vectors which need not to be normalized for parallelism
+ double cross( const B2DVector& rVec ) const;
- @param rVecA
- The first 2D Vector
+ /** Calculate the Angle with another 2D Vector
- @param rVecB
+ @param rVec
The second 2D Vector
@return
- sal_Bool if the two values are parallel. Also sal_True if
- one of the vectors is empty.
+ The Angle value of the two involved 2D Vectors in -pi/2 < return < pi/2
*/
- sal_Bool areParallel( const B2DVector& rVecA, const B2DVector& rVecB );
+ double angle( const B2DVector& rVec ) const;
/** Transform vector by given transformation matrix.
Since this is a vector, translational components of the
matrix are disregarded.
*/
- B2DVector operator*( const matrix::B2DHomMatrix& rMat, const B2DVector& rVec );
+ B2DVector& operator*=( const B2DHomMatrix& rMat );
- /** Test continuity between given vectors.
+ static const B2DVector& getEmptyVector();
+ };
- The two given vectors are assumed to describe control points on a
- common point. Calculate if there is a continuity between them.
- */
- ::basegfx::vector::B2DVectorContinuity getContinuity( const B2DVector& rBackVector, const B2DVector& rForwardVector );
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+
+ /** Calculate the orientation to another 2D Vector
+
+ @param rVecA
+ The first 2D Vector
+
+ @param rVecB
+ The second 2D Vector
+
+ @return
+ The mathematical Orientation of the two involved 2D Vectors
+ */
+ B2DVectorOrientation getOrientation( const B2DVector& rVecA, const B2DVector& rVecB );
+
+ /** Calculate a perpendicular 2D Vector to the given one
+
+ @param rVec
+ The source 2D Vector
+
+ @attention This only works if the given 2D Vector is normalized.
+
+ @return
+ A 2D Vector perpendicular to the one given in parameter rVec
+ */
+ B2DVector getPerpendicular( const B2DVector& rNormalizedVec );
+
+ /** Test two vectors which need not to be normalized for parallelism
+
+ @param rVecA
+ The first 2D Vector
+
+ @param rVecB
+ The second 2D Vector
+
+ @return
+ sal_Bool if the two values are parallel. Also sal_True if
+ one of the vectors is empty.
+ */
+ sal_Bool areParallel( const B2DVector& rVecA, const B2DVector& rVecB );
+
+ /** Transform vector by given transformation matrix.
+
+ Since this is a vector, translational components of the
+ matrix are disregarded.
+ */
+ B2DVector operator*( const B2DHomMatrix& rMat, const B2DVector& rVec );
+
+ /** Test continuity between given vectors.
+
+ The two given vectors are assumed to describe control points on a
+ common point. Calculate if there is a continuity between them.
+ */
+ ::basegfx::B2DVectorContinuity getContinuity( const B2DVector& rBackVector, const B2DVector& rForwardVector );
- } // end of namespace vector
} // end of namespace basegfx
#endif // _BGFX_VECTOR_B2DVECTOR_HXX
diff --git a/basegfx/inc/basegfx/vector/b3dvector.hxx b/basegfx/inc/basegfx/vector/b3dvector.hxx
index 855abb7f71e8..094bacfb50a1 100644
--- a/basegfx/inc/basegfx/vector/b3dvector.hxx
+++ b/basegfx/inc/basegfx/vector/b3dvector.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b3dvector.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: aw $ $Date: 2003-11-26 14:40:05 $
+ * last change: $Author: aw $ $Date: 2003-11-28 11:17:58 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -68,270 +68,232 @@
namespace basegfx
{
- namespace matrix
- {
- // predeclaration
- class B3DHomMatrix;
- } // end of namespace matrix;
+ // predeclaration
+ class B3DHomMatrix;
- namespace vector
- {
- /** Base Point class with three double values
+ /** Base Point class with three double values
+
+ This class derives all operators and common handling for
+ a 3D data class from B3DTuple. All necessary extensions
+ which are special for 3D Vectors are added here.
- This class derives all operators and common handling for
- a 3D data class from B3DTuple. All necessary extensions
- which are special for 3D Vectors are added here.
+ @see B3DTuple
+ */
+ class B3DVector : public ::basegfx::B3DTuple
+ {
+ public:
+ /** Create a 3D Vector
- @see B3DTuple
+ @param fVal
+ This parameter is used to initialize the coordinate
+ part of the 3D Vector.
*/
- class B3DVector : public ::basegfx::tuple::B3DTuple
- {
- public:
- /** Create a 3D Vector
-
- @param fVal
- This parameter is used to initialize the coordinate
- part of the 3D Vector.
- */
- B3DVector(double fVal = 0.0)
- : B3DTuple(fVal)
- {}
-
- /** Create a 3D Vector
-
- @param fX
- This parameter is used to initialize the X-coordinate
- of the 3D Vector.
-
- @param fY
- This parameter is used to initialize the Y-coordinate
- of the 3D Vector.
-
- @param fZ
- This parameter is used to initialize the Z-coordinate
- of the 3D Vector.
- */
- B3DVector(double fX, double fY, double fZ)
- : B3DTuple(fX, fY, fZ)
- {}
-
- /** Create a copy of a 3D Vector
-
- @param rVec
- The 3D Vector which will be copied.
- */
- B3DVector(const B3DVector& rVec)
- : B3DTuple(rVec)
- {}
-
- /** constructor with tuple to allow copy-constructing
- from B3DTuple-based classes
- */
- B3DVector(const ::basegfx::tuple::B3DTuple& rTuple)
- : B3DTuple(rTuple)
- {}
-
- ~B3DVector()
- {}
-
- /** *=operator to allow usage from B3DVector, too
- */
- B3DVector& operator*=( const B3DVector& rPnt )
- {
- mfX *= rPnt.mfX;
- mfY *= rPnt.mfY;
- mfZ *= rPnt.mfZ;
- return *this;
- }
+ B3DVector(double fVal = 0.0)
+ : B3DTuple(fVal)
+ {}
- /** *=operator to allow usage from B3DVector, too
- */
- B3DVector& operator*=(double t)
- {
- mfX *= t;
- mfY *= t;
- mfZ *= t;
- return *this;
- }
+ /** Create a 3D Vector
- /** assignment operator to allow assigning the results
- of B3DTuple calculations
- */
- B3DVector& operator=( const ::basegfx::tuple::B3DTuple& rVec )
- {
- mfX = rVec.getX();
- mfY = rVec.getY();
- mfZ = rVec.getZ();
- return *this;
- }
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 3D Vector.
- /** Calculate the length of this 3D Vector
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 3D Vector.
- @return The Length of the 3D Vector
- */
- double getLength(void) const
- {
- double fLen(scalar(*this));
- if((0.0 == fLen) || (1.0 == fLen))
- return fLen;
- return sqrt(fLen);
- }
+ @param fZ
+ This parameter is used to initialize the Z-coordinate
+ of the 3D Vector.
+ */
+ B3DVector(double fX, double fY, double fZ)
+ : B3DTuple(fX, fY, fZ)
+ {}
- /** Calculate the length in the XY-Plane for this 3D Vector
+ /** Create a copy of a 3D Vector
- @return The XY-Plane Length of the 3D Vector
- */
- double getXYLength(void) const
- {
- double fLen((mfX * mfX) + (mfY * mfY));
- if((0.0 == fLen) || (1.0 == fLen))
- return fLen;
- return sqrt(fLen);
- }
+ @param rVec
+ The 3D Vector which will be copied.
+ */
+ B3DVector(const B3DVector& rVec)
+ : B3DTuple(rVec)
+ {}
- /** Calculate the length in the XZ-Plane for this 3D Vector
+ /** constructor with tuple to allow copy-constructing
+ from B3DTuple-based classes
+ */
+ B3DVector(const ::basegfx::B3DTuple& rTuple)
+ : B3DTuple(rTuple)
+ {}
- @return The XZ-Plane Length of the 3D Vector
- */
- double getXZLength(void) const
- {
- double fLen((mfX * mfZ) + (mfY * mfZ));
- if((0.0 == fLen) || (1.0 == fLen))
- return fLen;
- return sqrt(fLen);
- }
+ ~B3DVector()
+ {}
+
+ /** *=operator to allow usage from B3DVector, too
+ */
+ B3DVector& operator*=( const B3DVector& rPnt )
+ {
+ mfX *= rPnt.mfX;
+ mfY *= rPnt.mfY;
+ mfZ *= rPnt.mfZ;
+ return *this;
+ }
- /** Calculate the length in the YZ-Plane for this 3D Vector
+ /** *=operator to allow usage from B3DVector, too
+ */
+ B3DVector& operator*=(double t)
+ {
+ mfX *= t;
+ mfY *= t;
+ mfZ *= t;
+ return *this;
+ }
- @return The YZ-Plane Length of the 3D Vector
- */
- double getYZLength(void) const
- {
- double fLen((mfY * mfY) + (mfZ * mfZ));
- if((0.0 == fLen) || (1.0 == fLen))
- return fLen;
- return sqrt(fLen);
- }
+ /** assignment operator to allow assigning the results
+ of B3DTuple calculations
+ */
+ B3DVector& operator=( const ::basegfx::B3DTuple& rVec )
+ {
+ mfX = rVec.getX();
+ mfY = rVec.getY();
+ mfZ = rVec.getZ();
+ return *this;
+ }
- /** Set the length of this 3D Vector
+ /** Calculate the length of this 3D Vector
- @param fLen
- The to be achieved length of the 3D Vector
- */
- B3DVector& setLength(double fLen)
- {
- double fLenNow(scalar(*this));
+ @return The Length of the 3D Vector
+ */
+ double getLength(void) const
+ {
+ double fLen(scalar(*this));
+ if((0.0 == fLen) || (1.0 == fLen))
+ return fLen;
+ return sqrt(fLen);
+ }
- if(!::basegfx::numeric::fTools::equalZero(fLenNow))
- {
- const double fOne(1.0);
+ /** Calculate the length in the XY-Plane for this 3D Vector
- if(!::basegfx::numeric::fTools::equal(fOne, fLenNow))
- {
- fLen /= sqrt(fLenNow);
- }
+ @return The XY-Plane Length of the 3D Vector
+ */
+ double getXYLength(void) const
+ {
+ double fLen((mfX * mfX) + (mfY * mfY));
+ if((0.0 == fLen) || (1.0 == fLen))
+ return fLen;
+ return sqrt(fLen);
+ }
- mfX *= fLen;
- mfY *= fLen;
- mfZ *= fLen;
- }
+ /** Calculate the length in the XZ-Plane for this 3D Vector
- return *this;
- }
+ @return The XZ-Plane Length of the 3D Vector
+ */
+ double getXZLength(void) const
+ {
+ double fLen((mfX * mfZ) + (mfY * mfZ));
+ if((0.0 == fLen) || (1.0 == fLen))
+ return fLen;
+ return sqrt(fLen);
+ }
+
+ /** Calculate the length in the YZ-Plane for this 3D Vector
- /** Normalize this 3D Vector
+ @return The YZ-Plane Length of the 3D Vector
+ */
+ double getYZLength(void) const
+ {
+ double fLen((mfY * mfY) + (mfZ * mfZ));
+ if((0.0 == fLen) || (1.0 == fLen))
+ return fLen;
+ return sqrt(fLen);
+ }
- The length of the 3D Vector is set to 1.0
- */
- B3DVector& normalize();
+ /** Set the length of this 3D Vector
- /** Test if this 3D Vector is normalized
+ @param fLen
+ The to be achieved length of the 3D Vector
+ */
+ B3DVector& setLength(double fLen)
+ {
+ double fLenNow(scalar(*this));
- @return
- sal_True if lenth of vector is equal to 1.0
- sal_False else
- */
- sal_Bool isNormalized() const
+ if(!::basegfx::fTools::equalZero(fLenNow))
{
const double fOne(1.0);
- const double fScalar(scalar(*this));
-
- return (::basegfx::numeric::fTools::equal(fOne, fScalar));
- }
- /** get a 3D Vector which is perpendicular to this and a given 3D Vector
+ if(!::basegfx::fTools::equal(fOne, fLenNow))
+ {
+ fLen /= sqrt(fLenNow);
+ }
- @attention This only works if this and the given 3D Vector are
- both normalized.
+ mfX *= fLen;
+ mfY *= fLen;
+ mfZ *= fLen;
+ }
- @param rNormalizedVec
- A normalized 3D Vector.
+ return *this;
+ }
- @return
- A 3D Vector perpendicular to this and the given one
- */
- B3DVector getPerpendicular(const B3DVector& rNormalizedVec) const;
+ /** Normalize this 3D Vector
- /** get the projection of this Vector on the given Plane
+ The length of the 3D Vector is set to 1.0
+ */
+ B3DVector& normalize();
- @attention This only works if the given 3D Vector defining
- the Plane is normalized.
+ /** Test if this 3D Vector is normalized
- @param rNormalizedPlane
- A normalized 3D Vector defining a Plane.
+ @return
+ sal_True if lenth of vector is equal to 1.0
+ sal_False else
+ */
+ sal_Bool isNormalized() const
+ {
+ const double fOne(1.0);
+ const double fScalar(scalar(*this));
- @return
- The projected 3D Vector
- */
- B3DVector getProjectionOnPlane(const B3DVector& rNormalizedPlane) const;
+ return (::basegfx::fTools::equal(fOne, fScalar));
+ }
- /** Calculate the Scalar product
+ /** get a 3D Vector which is perpendicular to this and a given 3D Vector
- This method calculates the Scalar product between this
- and the given 3D Vector.
+ @attention This only works if this and the given 3D Vector are
+ both normalized.
- @param rVec
- A second 3D Vector.
+ @param rNormalizedVec
+ A normalized 3D Vector.
- @return
- The Scalar Product of two 3D Vectors
- */
- double scalar(const B3DVector& rVec) const
- {
- return ((mfX * rVec.mfX) + (mfY * rVec.mfY) + (mfZ * rVec.mfZ));
- }
+ @return
+ A 3D Vector perpendicular to this and the given one
+ */
+ B3DVector getPerpendicular(const B3DVector& rNormalizedVec) const;
- /** Transform vector by given transformation matrix.
+ /** get the projection of this Vector on the given Plane
- Since this is a vector, translational components of the
- matrix are disregarded.
- */
- B3DVector& operator*=( const matrix::B3DHomMatrix& rMat );
+ @attention This only works if the given 3D Vector defining
+ the Plane is normalized.
- static const B3DVector& getEmptyVector()
- {
- return (const B3DVector&) ::basegfx::tuple::B3DTuple::getEmptyTuple();
- }
- };
+ @param rNormalizedPlane
+ A normalized 3D Vector defining a Plane.
- // external operators
- //////////////////////////////////////////////////////////////////////////
+ @return
+ The projected 3D Vector
+ */
+ B3DVector getProjectionOnPlane(const B3DVector& rNormalizedPlane) const;
- /** get a 3D Vector which is in 2D (ignoring
- the Z-Coordinate) perpendicular to a given 3D Vector
+ /** Calculate the Scalar product
- @attention This only works if the given 3D Vector is normalized.
+ This method calculates the Scalar product between this
+ and the given 3D Vector.
- @param rNormalizedVec
- A normalized 3D Vector.
+ @param rVec
+ A second 3D Vector.
@return
- A 3D Vector perpendicular to the given one in X,Y (2D).
+ The Scalar Product of two 3D Vectors
*/
- inline B3DVector getPerpendicular2D( const B3DVector& rNormalizedVec )
+ double scalar(const B3DVector& rVec) const
{
- B3DVector aPerpendicular(-rNormalizedVec.getY(), rNormalizedVec.getX(), rNormalizedVec.getZ());
- return aPerpendicular;
+ return ((mfX * rVec.mfX) + (mfY * rVec.mfY) + (mfZ * rVec.mfZ));
}
/** Transform vector by given transformation matrix.
@@ -339,28 +301,60 @@ namespace basegfx
Since this is a vector, translational components of the
matrix are disregarded.
*/
- B3DVector operator*( const matrix::B3DHomMatrix& rMat, const B3DVector& rVec );
+ B3DVector& operator*=( const B3DHomMatrix& rMat );
- /** Calculate the Cross Product of two 3D Vectors
+ static const B3DVector& getEmptyVector()
+ {
+ return (const B3DVector&) ::basegfx::B3DTuple::getEmptyTuple();
+ }
+ };
- @param rVecA
- A first 3D Vector.
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
- @param rVecB
- A second 3D Vector.
+ /** get a 3D Vector which is in 2D (ignoring
+ the Z-Coordinate) perpendicular to a given 3D Vector
- @return
- The Cross Product of both 3D Vectors
- */
- inline B3DVector cross(const B3DVector& rVecA, const B3DVector& rVecB)
- {
- B3DVector aVec(
- rVecA.getY() * rVecB.getZ() - rVecA.getZ() * rVecB.getY(),
- rVecA.getZ() * rVecB.getX() - rVecA.getX() * rVecB.getZ(),
- rVecA.getX() * rVecB.getY() - rVecA.getY() * rVecB.getX());
- return aVec;
- }
- } // end of namespace vector
+ @attention This only works if the given 3D Vector is normalized.
+
+ @param rNormalizedVec
+ A normalized 3D Vector.
+
+ @return
+ A 3D Vector perpendicular to the given one in X,Y (2D).
+ */
+ inline B3DVector getPerpendicular2D( const B3DVector& rNormalizedVec )
+ {
+ B3DVector aPerpendicular(-rNormalizedVec.getY(), rNormalizedVec.getX(), rNormalizedVec.getZ());
+ return aPerpendicular;
+ }
+
+ /** Transform vector by given transformation matrix.
+
+ Since this is a vector, translational components of the
+ matrix are disregarded.
+ */
+ B3DVector operator*( const B3DHomMatrix& rMat, const B3DVector& rVec );
+
+ /** Calculate the Cross Product of two 3D Vectors
+
+ @param rVecA
+ A first 3D Vector.
+
+ @param rVecB
+ A second 3D Vector.
+
+ @return
+ The Cross Product of both 3D Vectors
+ */
+ inline B3DVector cross(const B3DVector& rVecA, const B3DVector& rVecB)
+ {
+ B3DVector aVec(
+ rVecA.getY() * rVecB.getZ() - rVecA.getZ() * rVecB.getY(),
+ rVecA.getZ() * rVecB.getX() - rVecA.getX() * rVecB.getZ(),
+ rVecA.getX() * rVecB.getY() - rVecA.getY() * rVecB.getX());
+ return aVec;
+ }
} // end of namespace basegfx
#endif // _BGFX_VECTOR_B3DVECTOR_HXX