23#include <osl/diagnose.h>
32 const sal_Int32 nQuad(
33 (4 +
fround( M_2_PI*fmod( fRadiant, 2 * M_PI ) )) % 4 );
57 OSL_FAIL(
"createSinCos: Impossible case reached" );
64 o_rSin = sin(fRadiant);
65 o_rCos = cos(fRadiant);
72 const double fOne(1.0);
76 aRetval.
set(0, 0, fScaleX);
81 aRetval.
set(1, 1, fScaleY);
93 aRetval.
set(0, 1, fShearX);
105 aRetval.
set(1, 0, fShearY);
121 aRetval.
set(0, 0, fCos);
122 aRetval.
set(1, 1, fCos);
123 aRetval.
set(1, 0, fSin);
124 aRetval.
set(0, 1, -fSin);
136 aRetval.
set(0, 2, fTranslateX);
137 aRetval.
set(1, 2, fTranslateY);
144 double fScaleX,
double fScaleY,
147 double fTranslateX,
double fTranslateY)
149 const double fOne(1.0);
212 fScaleY * ((fCos * fShearX) - fSin),
215 fScaleY * ((fSin * fShearX) + fCos),
227 double fTranslateX,
double fTranslateY)
282 (fCos * fShearX) - fSin,
285 (fSin * fShearX) + fCos,
294 double fScaleX,
double fScaleY,
295 double fTranslateX,
double fTranslateY)
297 const double fOne(1.0);
312 aRetval.
set(0, 0, fScaleX);
313 aRetval.
set(1, 1, fScaleY);
334 double fPointX,
double fPointY,
349 (fPointX * (1.0 - fCos)) + (fSin * fPointY),
352 (fPointY * (1.0 - fCos)) - (fSin * fPointX));
381 const double fScaleMin(std::min(fScaleX, fScaleY));
385 aRetval.
scale(fScaleMin, fScaleMin);
408 if(&rSourceRange == &rTargetRange)
419 const double fSourceW(rSourceRange.
getWidth());
420 const double fSourceH(rSourceRange.
getHeight());
423 const double fScaleX(bDivX ? rTargetRange.
getWidth() / fSourceW : rTargetRange.
getWidth());
424 const double fScaleY(bDivY ? rTargetRange.
getHeight() / fSourceH : rTargetRange.
getHeight());
428 aRetval.
scale(fScaleX, fScaleY);
void set3x2(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2)
allow setting all needed values for a 3x2 matrix in one call.
void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue)
void rotate(double fRadiant)
void translate(double fX, double fY)
double get(sal_uInt16 nRow, sal_uInt16 nColumn) const
void scale(double fX, double fY)
Base Point class with two double values.
A two-dimensional interval over doubles.
BASEGFX_DLLPUBLIC void transform(const B2DHomMatrix &rMatrix)
Transform Range by given transformation matrix.
B2DVector getRange() const
return difference between upper and lower point. returns (0,0) for empty sets.
B2DPoint getMinimum() const
get lower bound of the set. returns arbitrary values for empty sets.
Base class for all Points/Vectors with two double values.
Base Point class with two double values.
TYPE getWidth() const
return difference between upper and lower X value. returns 0 for empty sets.
TYPE getMinX() const
get lower bound of the set. returns arbitrary values for empty sets.
TYPE getMinY() const
get lower bound of the set. returns arbitrary values for empty sets.
double getCenterX() const
return center X value of set. returns 0 for empty sets.
double getCenterY() const
return center Y value of set. returns 0 for empty sets.
TYPE getHeight() const
return difference between upper and lower Y value. returns 0 for empty sets.
TYPE getX() const
Get X-Coordinate of 2D Tuple.
TYPE getY() const
Get Y-Coordinate of 2D Tuple.
B2DHomMatrix createCoordinateSystemTransform(const B2DPoint &rOrigin, const B2DVector &rX, const B2DVector &rY)
create based on given CoordinateSystem which is defined by origin and x/yaxis
B2DHomMatrix createScaleTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fTranslateX, double fTranslateY)
B2DHomMatrix createRotateAroundPoint(double fPointX, double fPointY, double fRadiant)
special for the often used case of rotation around a point
B2DHomMatrix createShearYB2DHomMatrix(double fShearY)
B2DHomMatrix createRotateAroundCenterKeepAspectRatioStayInsideRange(const basegfx::B2DRange &rTargetRange, double fRotate)
special for creating a mapping for a Range rotated around it's center while keeping AspectRatio uncha...
B2DHomMatrix createScaleB2DHomMatrix(double fScaleX, double fScaleY)
Tooling methods for on-the-fly matrix generation e.g.
B2DHomMatrix createShearXB2DHomMatrix(double fShearX)
B2DTuple getColumn(const B2DHomMatrix &rMatrix, sal_uInt16 nCol)
get column vector from B2dHomMatrix, e.g. to extract coordinate system origin and x/yaxis
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
B2DHomMatrix createRotateB2DHomMatrix(double fRadiant)
void createSinCosOrthogonal(double &o_rSin, double &o_rCos, double fRadiant)
If the rotation angle is an approximate multiple of pi/2, force fSin/fCos to -1/0/1,...
B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fShearX, double fRadiant, double fTranslateX, double fTranslateY)
Tooling methods for faster completely combined matrix creation when scale, shearX,...
B2DHomMatrix createShearXRotateTranslateB2DHomMatrix(double fShearX, double fRadiant, double fTranslateX, double fTranslateY)
B2DHomMatrix createSourceRangeTargetRangeTransform(const B2DRange &rSourceRange, const B2DRange &rTargetRange)
special for the case to map from source range to target range
B2IRange fround(const B2DRange &rRange)
Round double to nearest integer for 2D range.