]> git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/canvas/liner.h
A few tweaks and cleanups
[wxWidgets.git] / contrib / include / wx / canvas / liner.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: liner.h
3 // Author: Klaas Holwerda
4 // Created: 1/10/2000
5 // Copyright: 2000 (c) Klaas Holwerda
6 // Licence: wxWindows Licence
7 /////////////////////////////////////////////////////////////////////////////
8 #ifndef __WXLINER_H
9 #define __WXLINER_H
10
11 #ifdef __GNUG__
12 #pragma interface "liner.cpp"
13 #endif
14
15
16 #include "wx/geometry.h"
17
18 enum OUTPRODUCT {R_IS_LEFT,R_IS_ON,R_IS_RIGHT};
19
20 // Status of a point to a wxLine
21 enum R_PointStatus {R_LEFT_SIDE, R_RIGHT_SIDE, R_ON_AREA, R_IN_AREA};
22
23 class wxLine
24 {
25 public:
26 // constructors and destructor
27 wxLine( double x1, double y1, double x2, double y2 );
28 wxLine( const wxPoint2DDouble& a, const wxPoint2DDouble& b);
29 ~wxLine();
30
31 wxPoint2DDouble GetBeginPoint(); // Get the beginpoint from a wxLine
32 wxPoint2DDouble GetEndPoint(); // Get the endpoint from a wxLine
33 bool CheckIntersect( wxLine&, double Marge); // Check if two wxLines intersects
34 int Intersect( wxLine&, wxPoint2DDouble& bp ,wxPoint2DDouble& ep ,double Marge) ; // Intersects two wxLines
35 bool Intersect( wxLine& lijn, wxPoint2DDouble& crossing); //intersect two (infinit) lines
36 R_PointStatus PointOnLine( const wxPoint2DDouble& a_Point, double& Distance, double Marge ); //For an infinite wxLine
37 R_PointStatus PointInLine( const wxPoint2DDouble& a_Point, double& Distance, double Marge ); //For a non-infinite wxLine
38 OUTPRODUCT OutProduct( const wxLine& two, double accur); // outproduct of two wxLines
39 double Calculate_Y( double X); // Caclulate Y if X is known
40 void Virtual_Point( wxPoint2DDouble& a_point, double distance) const;
41 wxLine& operator=( const wxLine&); // assignment operator
42 void CalculateLineParameters(); // Calculate the parameters if nessecary
43 void OffsetContour( const wxLine& nextline, double factor,wxPoint2DDouble& offsetpoint) const;
44
45 private:
46
47 int ActionOnTable1(R_PointStatus,R_PointStatus); // Function needed for Intersect
48 int ActionOnTable2(R_PointStatus,R_PointStatus); // Function needed for Intersect
49
50 double m_AA;
51 double m_BB;
52 double m_CC;
53 wxPoint2DDouble m_a;
54 wxPoint2DDouble m_b;
55 bool m_valid_parameters;
56 };
57
58 #endif