LibreOffice Module basegfx (master) 1
|
Base Point class with two double values. More...
#include <b2dvector.hxx>
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... | |
B2DVector & | operator*= (const B2DVector &rPnt) |
*=operator to allow usage from B2DVector, too More... | |
B2DVector & | operator*= (double t) |
*=operator to allow usage from B2DVector, too More... | |
B2DVector & | operator= (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... | |
B2DVector & | setLength (double fLen) |
Set the length of this 2D Vector. More... | |
B2DVector & | normalize () |
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... | |
B2DVector & | operator*= (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 B2DVector & | getEmptyVector () |
Static Public Member Functions inherited from basegfx::B2DTuple | |
static BASEGFX_DLLPUBLIC const B2DTuple & | getEmptyTuple () |
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 | |
} | |
}; | |
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.
Definition at line 39 of file b2dvector.hxx.
|
inline |
Create a 2D Vector.
The vector is initialized to (0.0, 0.0)
Definition at line 46 of file b2dvector.hxx.
|
inline |
Create a 2D Vector.
fX | This parameter is used to initialize the X-coordinate of the 2D Vector. |
fY | This parameter is used to initialize the Y-coordinate of the 2D Vector. |
Definition at line 59 of file b2dvector.hxx.
|
inlineexplicit |
Create a copy of a 2D Vector.
rVec | The 2D Vector which will be copied. |
Definition at line 68 of file b2dvector.hxx.
|
inline |
constructor with tuple to allow copy-constructing from B2DTuple-based classes
Definition at line 75 of file b2dvector.hxx.
double basegfx::B2DVector::angle | ( | const B2DVector & | rVec | ) | const |
Calculate the Angle with another 2D Vector.
rVec | The second 2D Vector |
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().
|
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.
rVec | The second 2D Vector |
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().
|
static |
Definition at line 74 of file b2dvector.cxx.
References basegfx::B2DTuple::getEmptyTuple().
Referenced by basegfx::B2DPolygon::appendBezierSegment(), ImplB2DPolygon::getNextControlVector(), ImplB2DPolygon::getPrevControlVector(), basegfx::B2DPolygon::resetNextControlPoint(), and basegfx::B2DPolygon::resetPrevControlPoint().
double basegfx::B2DVector::getLength | ( | ) | const |
Calculate the length of this 2D Vector.
Definition at line 54 of file b2dvector.cxx.
References basegfx::fTools::equalZero(), basegfx::Tuple2D< double >::mfX, and basegfx::Tuple2D< double >::mfY.
Referenced by basegfx::B2DCubicBezierHelper::B2DCubicBezierHelper(), basegfx::utils::createEdgesOfGivenLength(), basegfx::B2DHomMatrix::decompose(), basegfx::B2DCubicBezier::getControlPolygonLength(), basegfx::B2DCubicBezier::getEdgeLength(), basegfx::utils::getEdgeLength(), basegfx::utils::getLength(), basegfx::B2DCubicBezier::getLength(), basegfx::utils::getSmallestDistancePointToEdge(), basegfx::utils::setContinuityInPoint(), and basegfx::B2DCubicBezier::testAndSolveTrivialBezier().
B2DVector & basegfx::B2DVector::normalize | ( | ) |
Normalize this 2D Vector.
The length of the 2D Vector is set to 1.0
Definition at line 26 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::createAreaGeometry(), basegfx::getNormalizedPerpendicular(), basegfx::utils::infiniteLineFromParallelogram(), and basegfx::utils::setContinuityInPoint().
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 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.
|
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.
|
inline |
Calculate the Scalar with another 2D Vector.
rVec | The second 2D Vector |
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().
B2DVector & basegfx::B2DVector::setLength | ( | double | fLen | ) |
Set the length of this 2D Vector.
fLen | The 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().