![]() | InDesign SDK 20.5 |
#include <PMBezierCurve.h>
Public Types | |
| enum | { kBezierAdjustReflectedp1 = 1, kBezierAdjustReflectedp2 = 2, kBezierAdjustRotatedp1 = 4, kBezierAdjustRotatedp2 = 8 } |
| typedef base_type | data_type |
Public Member Functions | |
| PMBezierCurve () | |
| PMBezierCurve (const PMPoint &p0, const PMPoint &p1, const PMPoint &p2, const PMPoint &p3) | |
| PMBezierCurve (const PMPoint &p0p1, const PMPoint &p2p3) | |
| PMBezierCurve (const PMPoint &p) | |
| const PMPoint & | GetP0 () const |
| const PMPoint & | GetP1 () const |
| const PMPoint & | GetP2 () const |
| const PMPoint & | GetP3 () const |
| const PMPoint & | GetNthPoint (int32 n) const |
| void | SetP0 (const PMPoint &p) |
| void | SetP1 (const PMPoint &p) |
| void | SetP2 (const PMPoint &p) |
| void | SetP3 (const PMPoint &p) |
| void | SetNthPoint (int32 n, const PMPoint &p) |
| PMRect | GetCtrlPtBounds () const |
| PMRect | GetPathBounds () const |
| void | TransformPoints (const PMMatrix &xForm) |
| bool16 | FindParameter (const PMPoint &p, const PMReal &hitzone, PMReal *retU) const |
| PMPoint | Evaluate (const PMReal &u) const |
| PMPoint | EvaluateSlope (const PMReal &u) const |
| void | EvaluatePointAndSlope (const PMReal &u, PMPoint *outP, PMPoint *outSlope) const |
| int32 | GetStepSize (const PMReal &flatness) const |
| void | FlattenCurve (PMPoint *pts, int32 stepSize) |
| int32 | FindMinMax (PMReal *uResult) const |
| void | SubDivide (const PMReal &u, PMBezierCurve *bezLeft, PMBezierCurve *bezRight) const |
| void | SubSegment (const PMReal &begU, const PMReal &endU, PMBezierCurve *subSegment) const |
| void | DivideIntoPathPoints (const PMReal u, PMPathPoint *ptBefore, PMPathPoint *ptAt, PMPathPoint *ptAfter) |
| void | ReadWrite (IPMStream *iPMStream) |
| void | operator*= (const PMReal &a) |
| void | operator/= (const PMReal &a) |
| PMBezierCurve & | operator= (const PMBezierCurve &rhs) |
| PMReal | PrivateFindParameter (const PMReal &startP, const PMReal &endP, const PMReal &coord, bool16 isXCoord, bool16 *oneCrossing) const |
| PMReal | FindParameterByAverage (PMReal t0, PMReal t1, const PMPoint &p) const |
| bool16 | HitTest (const PMRect &r) const |
| int16 | AdjustToPassThroughPoint (const PMPoint &p, const PMReal &t) |
| bool16 | PreAdjustCurve (const PMReal &t, PMPoint &t0, PMPoint &t3, PMPoint &c, PMPoint &d, PMPoint &e) const |
| int16 | DoAdjustCurve (const PMPoint &m, const PMReal &t, const PMPoint &t0, const PMPoint &t3, const PMPoint &c, const PMPoint &d, const PMPoint &e, bool16 parallel) |
Static Public Member Functions | |
| static void | Reduce (PMPoint *P, const PMPoint &A, const PMPoint &B, const PMReal &u) |
Protected Attributes | |
| PMPoint | fP0 |
| PMPoint | fP1 |
| PMPoint | fP2 |
| PMPoint | fP3 |
Friends | |
| PMBezierCurve | operator* (const PMReal &c, const PMBezierCurve &pt) |
| PMBezierCurve | operator/ (const PMBezierCurve &numer, const PMReal &denom) |
| bool16 | operator== (const PMBezierCurve &a, const PMBezierCurve &b) |
| bool16 | operator!= (const PMBezierCurve &a, const PMBezierCurve &b) |
A C++ class for Bezier curve. The Bezier curve is defined by 4 points.
| anonymous enum |
| PMBezierCurve::PMBezierCurve | ( | ) |
Constructs an empty Bezier.
| PMBezierCurve::PMBezierCurve | ( | const PMPoint & | p0, |
| const PMPoint & | p1, | ||
| const PMPoint & | p2, | ||
| const PMPoint & | p3 | ||
| ) |
Contructs a Bezier from four points.
| P0 | is the first point. |
| P1 | is the second point. |
| P2 | is the third point. |
| P3 | is the fourth point. |
Constructs a Bezier from two points. This will make p0 = p1 and p2 = p3
| p0p1 | the first point. |
| p2p3 | is the second point. |
| PMBezierCurve::PMBezierCurve | ( | const PMPoint & | p | ) |
Construct a degenerate curve where p0 = p1 = p2 = p3
| p | is the point. |
| void PMBezierCurve::DivideIntoPathPoints | ( | const PMReal | u, |
| PMPathPoint * | ptBefore, | ||
| PMPathPoint * | ptAt, | ||
| PMPathPoint * | ptAfter | ||
| ) |
Divide the curve at u and return the path points representing the curve.
Evaluate the curve at the given parameter.
| u | is the parameter where 0 <= u <= 1.0 |
| void PMBezierCurve::EvaluatePointAndSlope | ( | const PMReal & | u, |
| PMPoint * | outP, | ||
| PMPoint * | outSlope | ||
| ) | const |
This is faster than calling Evaluate and EvaluateSlope separately.
Find the slope at the given u.
| u |
| int32 PMBezierCurve::FindMinMax | ( | PMReal * | uResult | ) | const |
Find the min and max paramesters. Returns the number of paramesters found. Max is 4. FindMinMax does not check param == 0.0 or param == 1.0
| uResult | contains the resulting parameters. |
| bool16 PMBezierCurve::FindParameter | ( | const PMPoint & | p, |
| const PMReal & | hitzone, | ||
| PMReal * | retU | ||
| ) | const |
Returns whether the point is within hit zone of the curve. If so, it fills out the parameter location.
| p | is the point to check. |
| hitzone | is the hit zone. |
| retU | ? |
| void PMBezierCurve::FlattenCurve | ( | PMPoint * | pts, |
| int32 | stepSize | ||
| ) |
Convert the Bezier to (1 << stepSize) + 1 number of points.
| pts | is the resulting points. |
| stepSize | is the step size. |
| PMRect PMBezierCurve::GetCtrlPtBounds | ( | ) | const |
Return the bounding box of the curve including control points. If a single point the bbox is empty centered on the point.
| const PMPoint& PMBezierCurve::GetNthPoint | ( | int32 | n | ) | const |
Return the point at the given index, 0 <= n <= 3
| n | is the index. |
| inline |
| inline |
| inline |
| inline |
| PMRect PMBezierCurve::GetPathBounds | ( | ) | const |
Returns the bounds of the path. This does not include the control points
| int32 PMBezierCurve::GetStepSize | ( | const PMReal & | flatness | ) | const |
Returns a step value that when passed into FlattenCurve will result in the given flatness.
| flatness | is the desired flatness, where 0 < flatness <= 1.0 |
| bool16 PMBezierCurve::HitTest | ( | const PMRect & | r | ) | const |
Returns whether the given rectangle intersects the curve.
| r | is the rectangle to test. |
| void PMBezierCurve::ReadWrite | ( | IPMStream * | iPMStream | ) |
Read/Write bezier from/to given stream.
| iPMStream | is the stream. |
| static |
Reduce the Bezier. The equation for this method is P = A*(1-u) + B*u
| void PMBezierCurve::SetNthPoint | ( | int32 | n, |
| const PMPoint & | p | ||
| ) |
Sets the nth point to p.
| n | is the index of the point. |
| p | is the new point. |
| inline |
Sets the first point to p.
| p | specifies the new first point. |
| inline |
Sets the second point to p.
| p | specifies the new second point. |
| inline |
Sets the third point to p.
| p | specifies the new third point. |
| inline |
Sets the fourth point to p.
| p | specifies the new fourth point. |
| void PMBezierCurve::SubDivide | ( | const PMReal & | u, |
| PMBezierCurve * | bezLeft, | ||
| PMBezierCurve * | bezRight | ||
| ) | const |
Subdivide curve into two other curves at the given parameter.
| u | is the parameter. |
| bezLeft | is the resulting left bezier. |
| bezRight | is the resulting right bezier. |
| void PMBezierCurve::SubSegment | ( | const PMReal & | begU, |
| const PMReal & | endU, | ||
| PMBezierCurve * | subSegment | ||
| ) | const |
Take a segment from begU to endU.
| begU | |
| endU | |
| subSegment | is the resulting bezier from begU and endU. |
| void PMBezierCurve::TransformPoints | ( | const PMMatrix & | xForm | ) |
Transform the curve with the given matrix
| xForm | is the matrix to transform by. |
| friend |
Compare two PMBezierCurve
| a | is one beszier curve. |
| b | is the other bezier curve. |
| friend |
Compare two PMBezierCurve
| a | is one beszier curve. |
| b | is the other bezier curve. |