|
wxArt2D
|
Line calculations. More...
#include <liner.h>
Public Member Functions | |
| a2dLine (double x1=0, double y1=0, double x2=0, double y2=0) | |
| create a line with given end and begin point More... | |
| a2dLine (const a2dPoint2D &a, const a2dPoint2D &b) | |
| create a line with given end and begin point More... | |
| a2dLine (const a2dLine &other) | |
| ~a2dLine () | |
| destructor | |
| a2dLine & | operator= (const a2dLine &other) |
| a2dPoint2D | GetBeginPoint () const |
| Get the beginpoint from a a2dLine. More... | |
| a2dPoint2D | GetEndPoint () const |
| Get the endpoint from a a2dLine. More... | |
| bool | CheckIntersect (a2dLine &line, double Marge) const |
| Check if two wxLines intersects. More... | |
| int | Intersect (a2dLine &line, a2dPoint2D &bp, a2dPoint2D &ep, double Marge) const |
| Intersects two wxLines. More... | |
| bool | Intersect (a2dLine &lijn, a2dPoint2D &crossing) const |
| intersect two (infinit) lines More... | |
| R_PointStatus | PointOnLine (const a2dPoint2D &a_Point, double &Distance, double Marge) const |
| For an infinite a2dLine. More... | |
| R_PointStatus | PointInLine (const a2dPoint2D &a_Point, double &Distance, double Marge) const |
| For a non-infinite a2dLine. More... | |
| a2dPoint2D | ProjectedPoint (const a2dPoint2D &p) const |
| return point after projecting p to this line. | |
| double | PointDistance (const a2dPoint2D &p, a2dPoint2D *nearest) const |
| Calculate the distance of a point from the line. Works even if l==0. More... | |
| double | PointDistanceOrhto (const a2dPoint2D &p, a2dPoint2D *nearest) const |
| Calculate the orthogonal distance of a point from the line. Works even if l==0. More... | |
| OUTPRODUCT | OutProduct (const a2dLine &two, double accur) const |
| outproduct of two wxLines More... | |
| double | Calculate_Y (double X) const |
| Caclulate Y if X is known. More... | |
| void | Virtual_Point (a2dPoint2D &a_point, double distance) const |
| calculate point Perpendicula at distance from the line, through given point | |
| a2dPoint2D | DistancePoint (double distance, bool begin) const |
| calculate point on line at distance from the begin or end of line | |
| a2dLine * | CreatePerpendicularLineAt (const a2dPoint2D &a_point) const |
| create a line through a_point and which is pperpendicular to this | |
| void | CalculateLineParameters () |
| Calculate the parameters if invalid. More... | |
| void | OffsetContour (const a2dLine &nextline, double factor, a2dPoint2D &offsetpoint) const |
| Calculate point for a contour at a given distance. | |
| double | GetLength () const |
| return length of vector | |
Line calculations.
A line class to intersect lines and line segments.
Next to that the are point on/in Line and Line Segment tests. The class is designed to be accurate and can deal with vertical and horizontal lines. A snap factor (marge) is often required to do proper calculations
| a2dLine::a2dLine | ( | double | x1 = 0, |
| double | y1 = 0, |
||
| double | x2 = 0, |
||
| double | y2 = 0 |
||
| ) |
| a2dLine::a2dLine | ( | const a2dPoint2D & | a, |
| const a2dPoint2D & | b | ||
| ) |
| double a2dLine::Calculate_Y | ( | double | X | ) | const |
| void a2dLine::CalculateLineParameters | ( | ) |
| bool a2dLine::CheckIntersect | ( | a2dLine & | lijn, |
| double | Marge | ||
| ) | const |
Check if two wxLines intersects.
Checks if a a2dLine intersect with another a2dLine.
| line | line to intersect with |
| Marge | within volume at this distance still an intersection |
inout a2dLine : another a2dLine Marge: optional, standard on MARGE (declared in MISC.CPP)
return true : wxLines are crossing false: wxLines are not crossing
| a2dPoint2D a2dLine::GetBeginPoint | ( | ) | const |
| a2dPoint2D a2dLine::GetEndPoint | ( | ) | const |
| int a2dLine::Intersect | ( | a2dLine & | line, |
| a2dPoint2D & | bp, | ||
| a2dPoint2D & | ep, | ||
| double | Marge | ||
| ) | const |
| bool a2dLine::Intersect | ( | a2dLine & | lijn, |
| a2dPoint2D & | crossing | ||
| ) | const |
| OUTPRODUCT a2dLine::OutProduct | ( | const a2dLine & | two, |
| double | accur | ||
| ) | const |
outproduct of two wxLines
Return the position of the second a2dLine compared to this a2dLine.
Result = IS_ON | IS_LEFT | IS_RIGHT Here Left and Right is defined as being left or right from the this a2dLine towards the center (common) node direction of vetors taken as begin to endpoint with end of this at begin of a2dLine two
| double a2dLine::PointDistance | ( | const a2dPoint2D & | p, |
| a2dPoint2D * | nearest | ||
| ) | const |
| double a2dLine::PointDistanceOrhto | ( | const a2dPoint2D & | p, |
| a2dPoint2D * | nearest | ||
| ) | const |
| R_PointStatus a2dLine::PointInLine | ( | const a2dPoint2D & | a_Point, |
| double & | Distance, | ||
| double | Marge | ||
| ) | const |
For a non-infinite a2dLine.
test if a point lies in the linesegment.
If the point isn't on the a2dLine the function returns a value that indicates on which side of the a2dLine the point is (in linedirection from first point to second point
returns R_LEFT_SIDE, when point lies on the left side of the a2dLine R_RIGHT_SIDE, when point lies on the right side of the a2dLine R_ON_AREA, when point lies on the infinite a2dLine within a range R_IN_AREA, when point lies in the area of the linesegment the returnvalues are declared in (a2dLine.H)
| R_PointStatus a2dLine::PointOnLine | ( | const a2dPoint2D & | a_Point, |
| double & | Distance, | ||
| double | Marge | ||
| ) | const |
For an infinite a2dLine.
test if a point lies on the a2dLine.
If the point isn't on the a2dLine the function returns a value that indicates on which side of the a2dLine the point is (in linedirection from first point to second point
returns R_LEFT_SIDE, when point lies on the left side of the a2dLine R_ON_AREA, when point lies on the infinite a2dLine within a range R_RIGHT_SIDE, when point lies on the right side of the a2dLine R_LEFT_SIDE , R_RIGHT_SIDE , R_ON_AREA