![]() | InDesign SDK 20.5 |
#include <PMLine.h>
Public Member Functions | |
| PMLine () | |
| PMLine (const PMReal &slope, const PMReal &yIntercept) | |
| PMLine (const PMReal &xIntercept) | |
| PMLine (const PMPoint &P1, const PMPoint &P2) | |
| bool16 | SolveForY (const PMReal &X, PMReal *Y) const |
| bool16 | SolveForX (const PMReal &Y, PMReal *X) const |
| PMLine | SolveForPerpendicularLine (const PMPoint &P) const |
| bool16 | SolveForIntersectPoint (const PMLine &otherLine, PMPoint *intersectPt) const |
| bool16 | SolveForIntersectPoint (const PMPoint &P1, const PMPoint &P2, PMPoint *intersectPt) const |
| bool16 | GetSlope (PMReal *pSlope) const |
| bool16 | FindPointOnLine (const PMPoint &P0, const PMReal &dist, const PMPoint &refPoint, PMPoint *retPt) const |
| bool16 | ContainsPoint (const PMPoint &point) const |
Friends | |
| bool16 | operator== (const PMLine &a, const PMLine &b) |
| bool16 | operator!= (const PMLine &a, const PMLine &b) |
A C++ class for dealing with lines. A PMLine is specified by a slope, x and/or y intercept.
| PMLine::PMLine | ( | ) |
The default constructor makes no assumptions about what a default line is.
Construct a line from the given slope and y intercept.
| slope | specifies the slope. |
| yIntercept | is the y intercept. |
| PMLine::PMLine | ( | const PMReal & | xIntercept | ) |
Construct a line with x intercept. In this case, the line has an infinite slope, i.e. x = some constant.
| xIntercept | is the x intercept. |
Construct a line that passes between the two given points. If P1 == P2 the line is undefined.
| P1 | is the first point. |
| P2 | is the second point. |
| bool16 PMLine::ContainsPoint | ( | const PMPoint & | point | ) | const |
Returns kTrue if the line contains the given point.
| point | is the point to check. |
| bool16 PMLine::FindPointOnLine | ( | const PMPoint & | P0, |
| const PMReal & | dist, | ||
| const PMPoint & | refPoint, | ||
| PMPoint * | retPt | ||
| ) | const |
Find the point on the line that is dist distance away from P0. Returns true if a solution exists. When there are two solutions (which is most of the time) it picks the one farthest away from refPoint.
| P0 | is the anchor point. |
| dist | specifies the distance from P0. |
| refPoint | is the reference point. |
| retPt | is the point on the line. |
| bool16 PMLine::GetSlope | ( | PMReal * | pSlope | ) | const |
Return the slope of the line.
| pSlope | is the slope of the line. |
Returns whether or not the lines intersect, and if they do, fills in the intersect point. If the two lines are equal the following call will return kFalse even though the two lines intersect at every point.
| otherLine | is the line to check for interception. |
| intersectPt | is the resulting intersecting point. |
| bool16 PMLine::SolveForIntersectPoint | ( | const PMPoint & | P1, |
| const PMPoint & | P2, | ||
| PMPoint * | intersectPt | ||
| ) | const |
Finds the intersecting point that lies between P1 and P2 if it exists Essentially the same as the above method but puts constraints on the answer.
| P1 | is the first point. |
| P1 | is the second point. |
| intersectPt | is the resulting intersecting point. |
Returns the line that is perpendicular to this line and passes through the given point.
| P | is the point the perpendicular line will pass through. |
Returns true if the solution for X given Y exists. Fills in X.
| Y | is the given y value. |
| X | is solution for the given y value. |
Returns true if the solution for Y given X exists. Fills in Y.
| X | is the given x value. |
| Y | is solution for the given x value. |
Return true if two lines are not equal.
| a | is line a. |
| b | is line b. |