LibreOffice Module basegfx (master) 1
|
#include <b2dcubicbezier.hxx>
Public Member Functions | |
B2DCubicBezier () | |
B2DCubicBezier (const B2DCubicBezier &rBezier) | |
B2DCubicBezier (const B2DPoint &rStart, const B2DPoint &rControlPointA, const B2DPoint &rControlPointB, const B2DPoint &rEnd) | |
B2DCubicBezier & | operator= (const B2DCubicBezier &rBezier) |
bool | operator== (const B2DCubicBezier &rBezier) const |
bool | operator!= (const B2DCubicBezier &rBezier) const |
bool | equal (const B2DCubicBezier &rBezier) const |
bool | isBezier () const |
void | testAndSolveTrivialBezier () |
double | getLength (double fDeviation=0.01) const |
get length of edge More... | |
SAL_DLLPRIVATE double | getEdgeLength () const |
SAL_DLLPRIVATE double | getControlPolygonLength () const |
const B2DPoint & | getStartPoint () const |
void | setStartPoint (const B2DPoint &rValue) |
const B2DPoint & | getEndPoint () const |
void | setEndPoint (const B2DPoint &rValue) |
const B2DPoint & | getControlPointA () const |
void | setControlPointA (const B2DPoint &rValue) |
const B2DPoint & | getControlPointB () const |
void | setControlPointB (const B2DPoint &rValue) |
B2DVector | getTangent (double t) const |
get the tangent in point t More... | |
SAL_DLLPRIVATE void | adaptiveSubdivideByAngle (B2DPolygon &rTarget, double fAngleBound) const |
adaptive subdivide by angle criteria no start point is added, but all necessary created edges and the end point #i37443# allow the criteria to get unsharp in recursions More... | |
SAL_DLLPRIVATE void | adaptiveSubdivideByCount (B2DPolygon &rTarget, sal_uInt32 nCount) const |
#i37443# adaptive subdivide by nCount subdivisions no start point is added, but all necessary created edges and the end point More... | |
void | adaptiveSubdivideByDistance (B2DPolygon &rTarget, double fDistanceBound, int nRecurseLimit=30) const |
Subdivide cubic bezier segment. More... | |
B2DPoint | interpolatePoint (double t) const |
SAL_DLLPRIVATE double | getSmallestDistancePointToBezierSegment (const B2DPoint &rTestPoint, double &rCut) const |
void | split (double t, B2DCubicBezier *pBezierA, B2DCubicBezier *pBezierB) const |
SAL_DLLPRIVATE B2DCubicBezier | snippet (double fStart, double fEnd) const |
B2DRange | getRange () const |
SAL_DLLPRIVATE bool | getMinimumExtremumPosition (double &rfResult) const |
Get the minimum extremum position t. More... | |
SAL_DLLPRIVATE void | getAllExtremumPositions (::std::vector< double > &rResults) const |
Get all extremum pos of this segment. More... | |
void | transform (const basegfx::B2DHomMatrix &rMatrix) |
apply transformation given in matrix form More... | |
SAL_DLLPRIVATE void | fround () |
fround content More... | |
Private Attributes | |
B2DPoint | maStartPoint |
B2DPoint | maEndPoint |
B2DPoint | maControlPointA |
B2DPoint | maControlPointB |
Definition at line 33 of file b2dcubicbezier.hxx.
|
default |
|
default |
basegfx::B2DCubicBezier::B2DCubicBezier | ( | const B2DPoint & | rStart, |
const B2DPoint & | rControlPointA, | ||
const B2DPoint & | rControlPointB, | ||
const B2DPoint & | rEnd | ||
) |
Definition at line 332 of file b2dcubicbezier.cxx.
References maEndPoint, and maStartPoint.
void basegfx::B2DCubicBezier::adaptiveSubdivideByAngle | ( | B2DPolygon & | rTarget, |
double | fAngleBound | ||
) | const |
adaptive subdivide by angle criteria no start point is added, but all necessary created edges and the end point #i37443# allow the criteria to get unsharp in recursions
Definition at line 528 of file b2dcubicbezier.cxx.
References basegfx::deg2rad(), getEndPoint(), isBezier(), maControlPointA, maControlPointB, maEndPoint, maStartPoint, and rTarget.
Referenced by basegfx::utils::adaptiveSubdivideByAngle().
void basegfx::B2DCubicBezier::adaptiveSubdivideByCount | ( | B2DPolygon & | rTarget, |
sal_uInt32 | nCount | ||
) | const |
#i37443# adaptive subdivide by nCount subdivisions no start point is added, but all necessary created edges and the end point
Definition at line 599 of file b2dcubicbezier.cxx.
References a, getEndPoint(), interpolatePoint(), nCount, and rTarget.
Referenced by getSmallestDistancePointToBezierSegment().
void basegfx::B2DCubicBezier::adaptiveSubdivideByDistance | ( | B2DPolygon & | rTarget, |
double | fDistanceBound, | ||
int | nRecurseLimit = 30 |
||
) | const |
Subdivide cubic bezier segment.
This function adaptively subdivides the bezier segment into as much straight line segments as necessary, such that the maximal orthogonal distance from any of the segments to the true curve is less than the given error value. No start point is added, but all necessary created edges and the end point
rPoly | Output polygon. The subdivided bezier segment is added to this polygon via B2DPolygon::append(). |
rCurve | The cubic bezier curve to subdivide |
fDistanceBound | Bound on the maximal distance of the approximation to the true curve. |
nRecurseLimit | Bound on recursion for the bezier case. |
Definition at line 613 of file b2dcubicbezier.cxx.
References getEndPoint(), isBezier(), maControlPointA, maControlPointB, maEndPoint, maStartPoint, and rTarget.
Referenced by basegfx::utils::adaptiveSubdivideByDistance().
bool basegfx::B2DCubicBezier::equal | ( | const B2DCubicBezier & | rBezier | ) | const |
Definition at line 364 of file b2dcubicbezier.cxx.
References basegfx::Tuple2D< TYPE >::equal(), maControlPointA, maControlPointB, maEndPoint, and maStartPoint.
void basegfx::B2DCubicBezier::fround | ( | ) |
fround content
Definition at line 1019 of file b2dcubicbezier.cxx.
References basegfx::fround(), basegfx::Tuple2D< TYPE >::getX(), basegfx::Tuple2D< TYPE >::getY(), maControlPointA, maControlPointB, maEndPoint, and maStartPoint.
void basegfx::B2DCubicBezier::getAllExtremumPositions | ( | ::std::vector< double > & | rResults | ) | const |
Get all extremum pos of this segment.
This method will calculate all extremum positions of the segment and add them to rResults if they are in the range ]0.0 .. 1.0[
rResults | The vector of doubles where the results will be added. Evtl. existing contents will be removed since an empty vector is a necessary result to express that there are no extreme positions anymore. Since there is an upper maximum of 4 values, it makes sense to use reserve(4) at the vector as preparation. |
Definition at line 923 of file b2dcubicbezier.cxx.
References basegfx::fTools::equalZero(), basegfx::Tuple2D< TYPE >::getX(), basegfx::Tuple2D< TYPE >::getY(), maControlPointA, maControlPointB, maEndPoint, and maStartPoint.
Referenced by getMinimumExtremumPosition().
|
inline |
Definition at line 93 of file b2dcubicbezier.hxx.
Referenced by basegfx::utils::addPointsAtCuts(), basegfx::utils::applyLineDashing(), basegfx::utils::B2DPolygonToUnoPolygonBezierCoords(), basegfx::utils::clipPolygonOnParallelAxis(), basegfx::utils::clipPolyPolygonOnPolyPolygon(), basegfx::utils::getSnippetAbsolute(), getTangent(), and basegfx::utils::simplifyCurveSegments().
|
inline |
Definition at line 96 of file b2dcubicbezier.hxx.
Referenced by basegfx::utils::addPointsAtCuts(), basegfx::utils::applyLineDashing(), basegfx::utils::B2DPolygonToUnoPolygonBezierCoords(), basegfx::utils::clipPolygonOnParallelAxis(), basegfx::utils::clipPolyPolygonOnPolyPolygon(), basegfx::utils::getSnippetAbsolute(), getTangent(), and basegfx::utils::simplifyCurveSegments().
double basegfx::B2DCubicBezier::getControlPolygonLength | ( | ) | const |
Definition at line 512 of file b2dcubicbezier.cxx.
References basegfx::Tuple2D< TYPE >::equalZero(), getEdgeLength(), basegfx::B2DVector::getLength(), maControlPointA, maControlPointB, maEndPoint, and maStartPoint.
Referenced by basegfx::utils::adaptiveSubdivideByDistance().
double basegfx::B2DCubicBezier::getEdgeLength | ( | ) | const |
Definition at line 506 of file b2dcubicbezier.cxx.
References basegfx::B2DVector::getLength(), maEndPoint, and maStartPoint.
Referenced by basegfx::utils::adaptiveSubdivideByDistance(), basegfx::utils::applyLineDashing(), basegfx::B2DCubicBezierHelper::B2DCubicBezierHelper(), and getControlPolygonLength().
|
inline |
Definition at line 90 of file b2dcubicbezier.hxx.
References maEndPoint.
Referenced by adaptiveSubdivideByAngle(), basegfx::utils::adaptiveSubdivideByAngle(), adaptiveSubdivideByCount(), adaptiveSubdivideByDistance(), basegfx::utils::adaptiveSubdivideByDistance(), basegfx::utils::addPointsAtCuts(), basegfx::utils::applyLineDashing(), basegfx::B2DCubicBezierHelper::B2DCubicBezierHelper(), basegfx::utils::B2DPolygonToUnoPolygonBezierCoords(), basegfx::utils::clipPolygonOnParallelAxis(), basegfx::utils::clipPolyPolygonOnPolyPolygon(), basegfx::utils::createAreaGeometry(), basegfx::utils::getLength(), getLength(), basegfx::utils::getSmallestDistancePointToPolygon(), basegfx::utils::getSnippetAbsolute(), getTangent(), basegfx::utils::simplifyCurveSegments(), and snippet().
double basegfx::B2DCubicBezier::getLength | ( | double | fDeviation = 0.01 | ) | const |
get length of edge
This method handles beziers and simple edges. For beziers, the deviation describes the maximum allowed deviation from the real edge length. The default allows a deviation of 1% from the correct length.
For beziers, there is no direct way to get the length, thus this method may subdivide the bezier edge and may not be cheap.
fDeviation | The maximal allowed deviation between correct length and bezier edge length |
Definition at line 489 of file b2dcubicbezier.cxx.
References getEndPoint(), basegfx::B2DVector::getLength(), getStartPoint(), and isBezier().
Referenced by basegfx::utils::getEdgeLength(), and basegfx::utils::getLength().
bool basegfx::B2DCubicBezier::getMinimumExtremumPosition | ( | double & | rfResult | ) | const |
Get the minimum extremum position t.
rfResult | Will be changed and might possibly be set to a found split value, which should be in the range [0.0 .. 1.0]. It will be the smallest current extremum; there may be more |
Definition at line 881 of file b2dcubicbezier.cxx.
References getAllExtremumPositions(), and nCount.
B2DRange basegfx::B2DCubicBezier::getRange | ( | ) | const |
Definition at line 871 of file b2dcubicbezier.cxx.
References basegfx::Range2D< TYPE, TRAITS >::expand(), maControlPointA, maControlPointB, maEndPoint, and maStartPoint.
double basegfx::B2DCubicBezier::getSmallestDistancePointToBezierSegment | ( | const B2DPoint & | rTestPoint, |
double & | rCut | ||
) | const |
Definition at line 646 of file b2dcubicbezier.cxx.
References a, adaptiveSubdivideByCount(), basegfx::B2DPolygon::append(), basegfx::B2DPolygon::count(), basegfx::B2DPolygon::getB2DPoint(), getStartPoint(), basegfx::Tuple2D< TYPE >::getX(), basegfx::Tuple2D< TYPE >::getY(), interpolatePoint(), basegfx::fTools::less(), maEndPoint, and maStartPoint.
Referenced by basegfx::utils::getSmallestDistancePointToPolygon().
|
inline |
Definition at line 87 of file b2dcubicbezier.hxx.
References maStartPoint.
Referenced by basegfx::utils::adaptiveSubdivideByAngle(), basegfx::utils::adaptiveSubdivideByDistance(), basegfx::utils::addPointsAtCuts(), basegfx::utils::applyLineDashing(), basegfx::B2DCubicBezierHelper::B2DCubicBezierHelper(), basegfx::utils::B2DPolygonToUnoPolygonBezierCoords(), basegfx::utils::clipPolygonOnParallelAxis(), basegfx::utils::clipPolyPolygonOnPolyPolygon(), basegfx::utils::createAreaGeometry(), getLength(), getSmallestDistancePointToBezierSegment(), basegfx::utils::getSmallestDistancePointToPolygon(), basegfx::utils::getSnippetAbsolute(), getTangent(), basegfx::utils::simplifyCurveSegments(), and snippet().
B2DVector basegfx::B2DCubicBezier::getTangent | ( | double | t | ) | const |
get the tangent in point t
This method handles all the exceptions, e.g. when control point A is equal to start point and/or control point B is equal to end point
t | The bezier index in the range [0.0 .. 1.0]. It will be truncated. |
Definition at line 542 of file b2dcubicbezier.cxx.
References basegfx::Tuple2D< TYPE >::equalZero(), getControlPointA(), getControlPointB(), getEndPoint(), getStartPoint(), basegfx::fTools::lessOrEqual(), basegfx::fTools::moreOrEqual(), split(), and t.
Referenced by basegfx::utils::createAreaGeometry(), basegfx::utils::getTangentEnteringPoint(), and basegfx::utils::getTangentLeavingPoint().
B2DPoint basegfx::B2DCubicBezier::interpolatePoint | ( | double | t | ) | const |
Definition at line 626 of file b2dcubicbezier.cxx.
References basegfx::interpolate(), isBezier(), maControlPointA, maControlPointB, maEndPoint, maStartPoint, and t.
Referenced by adaptiveSubdivideByCount(), basegfx::B2DCubicBezierHelper::B2DCubicBezierHelper(), basegfx::utils::clipPolygonOnParallelAxis(), basegfx::utils::clipPolyPolygonOnPolyPolygon(), basegfx::utils::getPositionAbsolute(), and getSmallestDistancePointToBezierSegment().
bool basegfx::B2DCubicBezier::isBezier | ( | ) | const |
Definition at line 375 of file b2dcubicbezier.cxx.
References maControlPointA, maControlPointB, maEndPoint, and maStartPoint.
Referenced by adaptiveSubdivideByAngle(), basegfx::utils::adaptiveSubdivideByAngle(), adaptiveSubdivideByDistance(), basegfx::utils::adaptiveSubdivideByDistance(), basegfx::utils::addPointsAtCuts(), basegfx::utils::applyLineDashing(), basegfx::B2DCubicBezierHelper::B2DCubicBezierHelper(), basegfx::utils::B2DPolygonToUnoPolygonBezierCoords(), basegfx::utils::clipPolygonOnParallelAxis(), basegfx::utils::clipPolyPolygonOnPolyPolygon(), getLength(), basegfx::utils::getPositionAbsolute(), basegfx::utils::getSmallestDistancePointToPolygon(), basegfx::utils::getSnippetAbsolute(), interpolatePoint(), basegfx::utils::simplifyCurveSegments(), snippet(), and split().
bool basegfx::B2DCubicBezier::operator!= | ( | const B2DCubicBezier & | rBezier | ) | const |
Definition at line 354 of file b2dcubicbezier.cxx.
References maControlPointA, maControlPointB, maEndPoint, and maStartPoint.
|
default |
References equal(), operator!=(), and operator==().
bool basegfx::B2DCubicBezier::operator== | ( | const B2DCubicBezier & | rBezier | ) | const |
Definition at line 344 of file b2dcubicbezier.cxx.
References maControlPointA, maControlPointB, maEndPoint, and maStartPoint.
|
inline |
Definition at line 94 of file b2dcubicbezier.hxx.
Referenced by basegfx::utils::adaptiveSubdivideByAngle(), basegfx::utils::adaptiveSubdivideByDistance(), basegfx::utils::applyLineDashing(), basegfx::utils::B2DPolygonToUnoPolygonBezierCoords(), basegfx::utils::createAreaGeometry(), basegfx::utils::getEdgeLength(), basegfx::utils::getLength(), basegfx::utils::getSmallestDistancePointToPolygon(), basegfx::utils::simplifyCurveSegments(), snippet(), and split().
|
inline |
Definition at line 97 of file b2dcubicbezier.hxx.
Referenced by basegfx::utils::adaptiveSubdivideByAngle(), basegfx::utils::adaptiveSubdivideByDistance(), basegfx::utils::applyLineDashing(), basegfx::utils::B2DPolygonToUnoPolygonBezierCoords(), basegfx::utils::createAreaGeometry(), basegfx::utils::getEdgeLength(), basegfx::utils::getLength(), basegfx::utils::getSmallestDistancePointToPolygon(), basegfx::utils::simplifyCurveSegments(), snippet(), and split().
|
inline |
Definition at line 91 of file b2dcubicbezier.hxx.
References maEndPoint.
Referenced by basegfx::utils::adaptiveSubdivideByAngle(), basegfx::utils::adaptiveSubdivideByDistance(), basegfx::utils::applyLineDashing(), basegfx::utils::B2DPolygonToUnoPolygonBezierCoords(), basegfx::utils::createAreaGeometry(), basegfx::utils::getEdgeLength(), basegfx::utils::getLength(), basegfx::utils::getSmallestDistancePointToPolygon(), basegfx::utils::simplifyCurveSegments(), snippet(), and split().
|
inline |
Definition at line 88 of file b2dcubicbezier.hxx.
References maStartPoint.
Referenced by basegfx::utils::adaptiveSubdivideByAngle(), basegfx::utils::adaptiveSubdivideByDistance(), basegfx::utils::applyLineDashing(), basegfx::utils::B2DPolygonToUnoPolygonBezierCoords(), basegfx::utils::createAreaGeometry(), basegfx::utils::getEdgeLength(), basegfx::utils::getLength(), basegfx::utils::getSmallestDistancePointToPolygon(), basegfx::utils::simplifyCurveSegments(), snippet(), and split().
B2DCubicBezier basegfx::B2DCubicBezier::snippet | ( | double | fStart, |
double | fEnd | ||
) | const |
Definition at line 799 of file b2dcubicbezier.cxx.
References basegfx::fTools::equal(), basegfx::fTools::equalZero(), getEndPoint(), getStartPoint(), basegfx::interpolate(), isBezier(), basegfx::fTools::less(), basegfx::fTools::more(), setControlPointA(), setControlPointB(), setEndPoint(), setStartPoint(), and split().
Referenced by basegfx::utils::applyLineDashing().
void basegfx::B2DCubicBezier::split | ( | double | t, |
B2DCubicBezier * | pBezierA, | ||
B2DCubicBezier * | pBezierB | ||
) | const |
Definition at line 743 of file b2dcubicbezier.cxx.
References basegfx::interpolate(), isBezier(), maControlPointA, maControlPointB, maEndPoint, maStartPoint, setControlPointA(), setControlPointB(), setEndPoint(), setStartPoint(), and t.
Referenced by basegfx::utils::applyLineDashing(), basegfx::utils::getSnippetAbsolute(), getTangent(), and snippet().
void basegfx::B2DCubicBezier::testAndSolveTrivialBezier | ( | ) |
Definition at line 380 of file b2dcubicbezier.cxx.
References basegfx::fTools::betweenOrEqualEither(), basegfx::B2DVector::cross(), basegfx::Tuple2D< TYPE >::equalZero(), basegfx::fTools::equalZero(), basegfx::B2DVector::getLength(), basegfx::Tuple2D< TYPE >::getX(), basegfx::Tuple2D< TYPE >::getY(), maControlPointA, maControlPointB, maEndPoint, and maStartPoint.
Referenced by basegfx::utils::adaptiveSubdivideByAngle(), basegfx::utils::adaptiveSubdivideByDistance(), basegfx::utils::applyLineDashing(), basegfx::utils::getSmallestDistancePointToPolygon(), and basegfx::utils::simplifyCurveSegments().
void basegfx::B2DCubicBezier::transform | ( | const basegfx::B2DHomMatrix & | rMatrix | ) |
apply transformation given in matrix form
Definition at line 993 of file b2dcubicbezier.cxx.
References basegfx::B2DHomMatrix::isIdentity(), maControlPointA, maControlPointB, maEndPoint, and maStartPoint.
|
private |
Definition at line 38 of file b2dcubicbezier.hxx.
Referenced by adaptiveSubdivideByAngle(), adaptiveSubdivideByDistance(), equal(), fround(), getAllExtremumPositions(), getControlPolygonLength(), getRange(), interpolatePoint(), isBezier(), operator!=(), operator==(), split(), testAndSolveTrivialBezier(), and transform().
|
private |
Definition at line 39 of file b2dcubicbezier.hxx.
Referenced by adaptiveSubdivideByAngle(), adaptiveSubdivideByDistance(), equal(), fround(), getAllExtremumPositions(), getControlPolygonLength(), getRange(), interpolatePoint(), isBezier(), operator!=(), operator==(), split(), testAndSolveTrivialBezier(), and transform().
|
private |
Definition at line 37 of file b2dcubicbezier.hxx.
Referenced by adaptiveSubdivideByAngle(), adaptiveSubdivideByDistance(), equal(), fround(), getAllExtremumPositions(), getControlPolygonLength(), getEdgeLength(), getRange(), getSmallestDistancePointToBezierSegment(), interpolatePoint(), isBezier(), operator!=(), operator==(), split(), testAndSolveTrivialBezier(), and transform().
|
private |
Definition at line 36 of file b2dcubicbezier.hxx.
Referenced by adaptiveSubdivideByAngle(), adaptiveSubdivideByDistance(), equal(), fround(), getAllExtremumPositions(), getControlPolygonLength(), getEdgeLength(), getRange(), getSmallestDistancePointToBezierSegment(), interpolatePoint(), isBezier(), operator!=(), operator==(), split(), testAndSolveTrivialBezier(), and transform().