wxArt2D
Public Member Functions | List of all members

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
 
a2dLineoperator= (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
 
a2dLineCreatePerpendicularLineAt (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
 

Detailed Description

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

Definition at line 36 of file liner.h.

Constructor & Destructor Documentation

a2dLine::a2dLine ( double  x1 = 0,
double  y1 = 0,
double  x2 = 0,
double  y2 = 0 
)

create a line with given end and begin point

Remarks
line parameters will not be calculated automatically.
Parameters
x1X begin point
y1Y begin point
x2X end point
y2Y end point

Definition at line 21 of file liner.cpp.

a2dLine::a2dLine ( const a2dPoint2D a,
const a2dPoint2D b 
)

create a line with given end and begin point

Remarks
line parameters will not be calculated automatically.
Parameters
abegin point
bend point

Definition at line 34 of file liner.cpp.

Member Function Documentation

double a2dLine::Calculate_Y ( double  X) const

Caclulate Y if X is known.

Calculate the Y when the X is given.

Definition at line 294 of file liner.cpp.

void a2dLine::CalculateLineParameters ( )

Calculate the parameters if invalid.

Calculate the lineparameters for the a2dLine if nessecary.

Definition at line 355 of file liner.cpp.

bool a2dLine::CheckIntersect ( a2dLine lijn,
double  Marge 
) const

Check if two wxLines intersects.

Checks if a a2dLine intersect with another a2dLine.

Parameters
lineline to intersect with
Margewithin volume at this distance still an intersection
Returns
true is intersecting

inout a2dLine : another a2dLine Marge: optional, standard on MARGE (declared in MISC.CPP)

return true : wxLines are crossing false: wxLines are not crossing

Definition at line 399 of file liner.cpp.

a2dPoint2D a2dLine::GetBeginPoint ( ) const

Get the beginpoint from a a2dLine.

Get the beginPoint from the a2dLine usage: Point aPoint = a_line.GetBeginPoint()

Definition at line 437 of file liner.cpp.

a2dPoint2D a2dLine::GetEndPoint ( ) const

Get the endpoint from a a2dLine.

Get the endPoint from the a2dLine usage: Point aPoint = a_line.GetEndPoint()

Definition at line 446 of file liner.cpp.

int a2dLine::Intersect ( a2dLine line,
a2dPoint2D bp,
a2dPoint2D ep,
double  Marge 
) const

Intersects two wxLines.

Parameters
lineline to intersect with
bpbeginpoint
ependpoint
Margewithin volume at this distance still an intersection
Returns
0: If there are no crossings 1: If there is one crossing 2: If there are two crossings

Definition at line 451 of file liner.cpp.

bool a2dLine::Intersect ( a2dLine lijn,
a2dPoint2D crossing 
) const

intersect two (infinit) lines

Intersects two lines if a crossing return true else false

Definition at line 823 of file liner.cpp.

a2dLine & a2dLine::operator= ( const a2dLine a_line)

makes a a2dLine same as these usage : a2dLine1 = a2dLine2;

Definition at line 59 of file liner.cpp.

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

Definition at line 795 of file liner.cpp.

double a2dLine::PointDistance ( const a2dPoint2D p,
a2dPoint2D nearest 
) const

Calculate the distance of a point from the line. Works even if l==0.

Parameters
pthe point to which the closest point on the line is searched
nearestif not 0, the closest point to p on the line is assigned to nearest

Definition at line 657 of file liner.cpp.

double a2dLine::PointDistanceOrhto ( const a2dPoint2D p,
a2dPoint2D nearest 
) const

Calculate the orthogonal distance of a point from the line. Works even if l==0.

Parameters
pthe point to which the closest point on the line is searched
nearestif not 0, the closest point to p on the line is assigned to nearest

Definition at line 707 of file liner.cpp.

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)

Definition at line 560 of file liner.cpp.

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

Definition at line 614 of file liner.cpp.


The documentation for this class was generated from the following files:
a2dLine Class Reference -- Sun Oct 12 2014 17:04:41 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation