LibreOffice Module basegfx (master) 1
Public Member Functions | Static Public Member Functions | List of all members
basegfx::B2DVector Class Reference

Base Point class with two double values. More...

#include <b2dvector.hxx>

Inheritance diagram for basegfx::B2DVector:
[legend]
Collaboration diagram for basegfx::B2DVector:
[legend]

Public Member Functions

 B2DVector ()
 Create a 2D Vector. More...
 
 B2DVector (double fX, double fY)
 Create a 2D Vector. More...
 
 B2DVector (const ::basegfx::B2IVector &rVec)
 Create a copy of a 2D Vector. More...
 
 B2DVector (Tuple2D< double > const &rTuple)
 constructor with tuple to allow copy-constructing from B2DTuple-based classes More...
 
B2DVectoroperator*= (const B2DVector &rPnt)
 *=operator to allow usage from B2DVector, too More...
 
B2DVectoroperator*= (double t)
 *=operator to allow usage from B2DVector, too More...
 
B2DVectoroperator= (Tuple2D< double > const &rVector)
 assignment operator to allow assigning the results of B2DTuple calculations More...
 
double getLength () const
 Calculate the length of this 2D Vector. More...
 
B2DVectorsetLength (double fLen)
 Set the length of this 2D Vector. More...
 
B2DVectornormalize ()
 Normalize this 2D Vector. More...
 
double scalar (const B2DVector &rVec) const
 Calculate the Scalar with another 2D Vector. More...
 
double cross (const B2DVector &rVec) const
 Calculate the length of the cross product with another 2D Vector. More...
 
double angle (const B2DVector &rVec) const
 Calculate the Angle with another 2D Vector. More...
 
B2DVectoroperator*= (const B2DHomMatrix &rMat)
 Transform vector by given transformation matrix. More...
 
- Public Member Functions inherited from basegfx::B2DTuple
 B2DTuple ()
 Create a 2D Tuple. More...
 
 B2DTuple (double fX, double fY)
 Create a 2D Tuple. More...
 
 B2DTuple (Tuple2D< double > const &rTuple)
 
BASEGFX_DLLPUBLIC B2DTuple (const B2ITuple &rTup)
 Create a copy of a 2D integer Tuple. More...
 
B2DTuple operator- (void) const
 
- Public Member Functions inherited from basegfx::Tuple2D< double >
 Tuple2D (double x, double y)
 Create a 2D Tuple. More...
 
double get (Axis2D eAxis)
 
void set (Axis2D eAxis, double fValue)
 
double getX () const
 Get X-Coordinate of 2D Tuple. More...
 
double getY () const
 Get Y-Coordinate of 2D Tuple. More...
 
void setX (double fX)
 Set X-Coordinate of 2D Tuple. More...
 
void setY (double fY)
 Set Y-Coordinate of 2D Tuple. More...
 
void adjustX (double fX)
 Adjust X-Coordinate of 2D Tuple. More...
 
void adjustY (double fY)
 Adjust Y-Coordinate of 2D Tuple. More...
 
bool equal (const Tuple2D< double > &rTup) const
 
bool equal (const Tuple2D< double > &rTup) const
 
bool equalZero () const
 
bool equalZero () const
 
Tuple2D< double > & operator+= (const Tuple2D< double > &rTup)
 
Tuple2D< double > & operator-= (const Tuple2D< double > &rTup)
 
Tuple2D< double > & operator/= (const Tuple2D< double > &rTup)
 
Tuple2D< double > & operator/= (double t)
 
Tuple2D< double > & operator*= (const Tuple2D< double > &rTup)
 
Tuple2D< double > & operator*= (double t)
 
Tuple2D< double > operator- (void) const
 
bool operator== (const Tuple2D< double > &rTup) const
 
bool operator!= (const Tuple2D< double > &rTup) const
 

Static Public Member Functions

static const B2DVectorgetEmptyVector ()
 
- Static Public Member Functions inherited from basegfx::B2DTuple
static BASEGFX_DLLPUBLIC const B2DTuplegetEmptyTuple ()
 

Additional Inherited Members

- Public Attributes inherited from basegfx::Tuple2D< double >
double mnX
 
double mnY
 
double mfX
 
double mfY
 
- Protected Attributes inherited from basegfx::Tuple2D< double >
union {
   struct {
      TYPE   mnX
 
      TYPE   mnY
 
   } 
 
   struct {
      TYPE   mfX
 
      TYPE   mfY
 
   } 
 
}; 
 

Detailed Description

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 also
B2DTuple

Definition at line 39 of file b2dvector.hxx.

Constructor & Destructor Documentation

◆ B2DVector() [1/4]

basegfx::B2DVector::B2DVector ( )
inline

Create a 2D Vector.

The vector is initialized to (0.0, 0.0)

Definition at line 46 of file b2dvector.hxx.

◆ B2DVector() [2/4]

basegfx::B2DVector::B2DVector ( double  fX,
double  fY 
)
inline

Create a 2D Vector.

Parameters
fXThis parameter is used to initialize the X-coordinate of the 2D Vector.
fYThis parameter is used to initialize the Y-coordinate of the 2D Vector.

Definition at line 59 of file b2dvector.hxx.

◆ B2DVector() [3/4]

basegfx::B2DVector::B2DVector ( const ::basegfx::B2IVector rVec)
inlineexplicit

Create a copy of a 2D Vector.

Parameters
rVecThe 2D Vector which will be copied.

Definition at line 68 of file b2dvector.hxx.

◆ B2DVector() [4/4]

basegfx::B2DVector::B2DVector ( Tuple2D< double > const &  rTuple)
inline

constructor with tuple to allow copy-constructing from B2DTuple-based classes

Definition at line 75 of file b2dvector.hxx.

Member Function Documentation

◆ angle()

double basegfx::B2DVector::angle ( const B2DVector rVec) const

Calculate the Angle with another 2D Vector.

Parameters
rVecThe second 2D Vector
Returns
The Angle value of the two involved 2D Vectors ranging from -pi to +pi

Definition at line 68 of file b2dvector.cxx.

References basegfx::Tuple2D< TYPE >::getX(), basegfx::Tuple2D< TYPE >::getY(), basegfx::Tuple2D< double >::mfX, and basegfx::Tuple2D< double >::mfY.

Referenced by basegfx::utils::createAreaGeometry().

◆ cross()

double basegfx::B2DVector::cross ( const B2DVector rVec) const
inline

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.

Parameters
rVecThe second 2D Vector
Returns
The length of the cross product of the two involved 2D Vectors

Definition at line 151 of file b2dvector.hxx.

References basegfx::Tuple2D< TYPE >::getX(), basegfx::Tuple2D< TYPE >::getY(), mfX, and mfY.

Referenced by basegfx::utils::arePointsOnSameSideOfLine(), basegfx::B2DHomMatrix::decompose(), and basegfx::B2DCubicBezier::testAndSolveTrivialBezier().

◆ getEmptyVector()

const B2DVector & basegfx::B2DVector::getEmptyVector ( )
static

◆ getLength()

double basegfx::B2DVector::getLength ( ) const

◆ normalize()

B2DVector & basegfx::B2DVector::normalize ( )

◆ operator*=() [1/3]

B2DVector & basegfx::B2DVector::operator*= ( const B2DHomMatrix rMat)

Transform vector by given transformation matrix.

Since this is a vector, translational components of the matrix are disregarded.

Definition at line 79 of file b2dvector.cxx.

References basegfx::B2DHomMatrix::get(), basegfx::Tuple2D< double >::mfX, and basegfx::Tuple2D< double >::mfY.

◆ operator*=() [2/3]

B2DVector & basegfx::B2DVector::operator*= ( const B2DVector rPnt)
inline

*=operator to allow usage from B2DVector, too

Definition at line 81 of file b2dvector.hxx.

References mfX, basegfx::Tuple2D< TYPE >::mfX, mfY, and basegfx::Tuple2D< TYPE >::mfY.

◆ operator*=() [3/3]

B2DVector & basegfx::B2DVector::operator*= ( double  t)
inline

*=operator to allow usage from B2DVector, too

Definition at line 90 of file b2dvector.hxx.

References mfX, mfY, and t.

◆ operator=()

B2DVector & basegfx::B2DVector::operator= ( Tuple2D< double > const &  rVector)
inline

assignment operator to allow assigning the results of B2DTuple calculations

Definition at line 100 of file b2dvector.hxx.

References basegfx::Tuple2D< TYPE >::getX(), basegfx::Tuple2D< TYPE >::getY(), mfX, and mfY.

◆ scalar()

double basegfx::B2DVector::scalar ( const B2DVector rVec) const
inline

Calculate the Scalar with another 2D Vector.

Parameters
rVecThe second 2D Vector
Returns
The Scalar value of the two involved 2D Vectors

Definition at line 134 of file b2dvector.hxx.

References mfX, basegfx::Tuple2D< TYPE >::mfX, mfY, and basegfx::Tuple2D< TYPE >::mfY.

Referenced by basegfx::B2DHomMatrix::decompose(), basegfx::getContinuity(), basegfx::utils::isInEpsilonRange(), normalize(), basegfx::utils::setContinuityInPoint(), and setLength().

◆ setLength()

B2DVector & basegfx::B2DVector::setLength ( double  fLen)

Set the length of this 2D Vector.

Parameters
fLenThe to be achieved length of the 2D Vector

Definition at line 91 of file b2dvector.cxx.

References basegfx::fTools::equal(), basegfx::fTools::equalZero(), basegfx::Tuple2D< double >::mfX, basegfx::Tuple2D< double >::mfY, and scalar().

Referenced by basegfx::utils::createLineTrapezoidFromEdge().


The documentation for this class was generated from the following files: