UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
geometry.H
1 /* geometry.H */
2 /* $Id: geometry.H,v 1.9 2001/02/16 15:02:40 hoh Exp $ */
3 #ifndef __geometry_H
4 #define __geometry_H
5 
6 struct segment2D;
7 
8 // Решение системы двух уравнений// x - столбец первых переменных, y - столбец вторых переменных, // b - правая часть, pdRes - результат. Если нет решения, или их много, // возвратим код ошибки: 1 - нет решений, 2 - много решений. int so2e(double x[2],double y[2],double b[2], double* pdRes); // Различные точки class point{ protected: double x,y,z; public: point(double _x,double _y,double _z); point(const point &pCopy); ~point(){;}; point(){;}; double X() const {return x;}; double Y() const {return y;}; double Z() const {return z;}; friend int operator == (const point& p1, const point& p2); friend int operator != (const point& p1, const point& p2); friend double ro(const point& p1, const point& p2); }; #define AnyType point #define AnyAr aPoints #include <mix/AnyAr.H> typedef point point3d; class point2D{ protected: double x,y; public: point2D(double _x,double _y){x=_x;y=_y;}; point2D(const segment2D&,double); ~point2D(){;}; point2D(){;}; double X() const {return x;}; double Y() const {return y;}; friend int operator == (const point2D& p1, const point2D& p2); friend int operator != (const point2D& p1, const point2D& p2); friend double ro(const point2D& p1, const point2D& p2); }; #define AnyType point2D #define AnyAr aPoints2D #include <mix/AnyAr.H> struct segment2D{ double a,b,c; int init; segment2D(const point2D &_p1,const point2D &_p2) :p1(_p1.X(),_p1.Y()),p2(_p2.X(),_p2.Y()){init=0;}; segment2D() :p1(0,0),p2(0,0){init=0;}; ~segment2D(){;}; point2D p1,p2; //Начало и конец отрезка void get_coefs(double& A, double& B, double& C); point2D middle()const; }; #define AnyType segment2D #define AnyAr aSegments2D #include <mix/AnyAr.H> struct segment3D{ segment3D(const point &_p1,const point &_p2) :p1(_p1.X(),_p1.Y(),_p1.Z()),p2(_p2.X(),_p2.Y(),_p2.Z()) {}; point p1,p2; //Начало и конец отрезка friend int operator == (const segment3D& s1, const segment3D& s2); }; #define AnyType segment3D #define AnyAr aSegments3D #include <mix/AnyAr.H> point middle(const point& p1,const point& p2); point2D middle(const point2D& p1,const point2D& p2); double ro(const segment2D& s1, const point2D& p); extern point pNaNQ; #endif /* geometry.H */ /* Melnikov George Yu. 20-May-1999 */ /* Melnikov George Yu. 21-May-1999 */ /* Melnikov George Yu. 18-Jun-1999 */ /* Melnikov George Yu. 23-Jun-1999 */ /* Melnikov George Yu. 6-Jul-1999 */ /* Melnikov George Yu. 11-Oct-1999 */
9 // x - столбец первых переменных, y - столбец вторых переменных,// b - правая часть, pdRes - результат. Если нет решения, или их много, // возвратим код ошибки: 1 - нет решений, 2 - много решений. int so2e(double x[2],double y[2],double b[2], double* pdRes); // Различные точки class point{ protected: double x,y,z; public: point(double _x,double _y,double _z); point(const point &pCopy); ~point(){;}; point(){;}; double X() const {return x;}; double Y() const {return y;}; double Z() const {return z;}; friend int operator == (const point& p1, const point& p2); friend int operator != (const point& p1, const point& p2); friend double ro(const point& p1, const point& p2); }; #define AnyType point #define AnyAr aPoints #include <mix/AnyAr.H> typedef point point3d; class point2D{ protected: double x,y; public: point2D(double _x,double _y){x=_x;y=_y;}; point2D(const segment2D&,double); ~point2D(){;}; point2D(){;}; double X() const {return x;}; double Y() const {return y;}; friend int operator == (const point2D& p1, const point2D& p2); friend int operator != (const point2D& p1, const point2D& p2); friend double ro(const point2D& p1, const point2D& p2); }; #define AnyType point2D #define AnyAr aPoints2D #include <mix/AnyAr.H> struct segment2D{ double a,b,c; int init; segment2D(const point2D &_p1,const point2D &_p2) :p1(_p1.X(),_p1.Y()),p2(_p2.X(),_p2.Y()){init=0;}; segment2D() :p1(0,0),p2(0,0){init=0;}; ~segment2D(){;}; point2D p1,p2; //Начало и конец отрезка void get_coefs(double& A, double& B, double& C); point2D middle()const; }; #define AnyType segment2D #define AnyAr aSegments2D #include <mix/AnyAr.H> struct segment3D{ segment3D(const point &_p1,const point &_p2) :p1(_p1.X(),_p1.Y(),_p1.Z()),p2(_p2.X(),_p2.Y(),_p2.Z()) {}; point p1,p2; //Начало и конец отрезка friend int operator == (const segment3D& s1, const segment3D& s2); }; #define AnyType segment3D #define AnyAr aSegments3D #include <mix/AnyAr.H> point middle(const point& p1,const point& p2); point2D middle(const point2D& p1,const point2D& p2); double ro(const segment2D& s1, const point2D& p); extern point pNaNQ; #endif /* geometry.H */ /* Melnikov George Yu. 20-May-1999 */ /* Melnikov George Yu. 21-May-1999 */ /* Melnikov George Yu. 18-Jun-1999 */ /* Melnikov George Yu. 23-Jun-1999 */ /* Melnikov George Yu. 6-Jul-1999 */ /* Melnikov George Yu. 11-Oct-1999 */
10 // b - правая часть, pdRes - результат. Если нет решения, или их много,
11 // возвратим код ошибки: 1 - нет решений, 2 - много решений.
12 
13 int so2e(double x[2],double y[2],double b[2], double* pdRes);
14 
15 // Различные точки
16 class point{
17 protected:
18  double x,y,z;
19 public:
20  point(double _x,double _y,double _z);
21  point(const point &pCopy);
22  ~point(){;};
23  point(){;};
24  double X() const {return x;};
25  double Y() const {return y;};
26  double Z() const {return z;};
27 friend int operator == (const point& p1, const point& p2);
28 
29  friend int operator != (const point& p1, const point& p2);
30 friend double ro(const point& p1, const point& p2);
31 };
32 
33 #define AnyType point
34 #define AnyAr aPoints
35 #include <mix/AnyAr.H>
36 
37 typedef point point3d;
38 
39 class point2D{
40 protected:
41  double x,y;
42 public:
43  point2D(double _x,double _y){x=_x;y=_y;};
44  point2D(const segment2D&,double);
45  ~point2D(){;};
46  point2D(){;};
47  double X() const {return x;};
48  double Y() const {return y;};
49 friend int operator == (const point2D& p1, const point2D& p2);
50 friend int operator != (const point2D& p1, const point2D& p2);
51 friend double ro(const point2D& p1, const point2D& p2);
52 };
53 
54 #define AnyType point2D
55 #define AnyAr aPoints2D
56 #include <mix/AnyAr.H>
57 
58 struct segment2D{
59  double a,b,c;
60  int init;
61  segment2D(const point2D &_p1,const point2D &_p2)
62  :p1(_p1.X(),_p1.Y()),p2(_p2.X(),_p2.Y()){init=0;};
63  segment2D()
64  :p1(0,0),p2(0,0){init=0;};
65  ~segment2D(){;};
66  point2D p1,p2; //Начало и конец отрезка void get_coefs(double& A, double& B, double& C); point2D middle()const; }; #define AnyType segment2D #define AnyAr aSegments2D #include <mix/AnyAr.H> struct segment3D{ segment3D(const point &_p1,const point &_p2) :p1(_p1.X(),_p1.Y(),_p1.Z()),p2(_p2.X(),_p2.Y(),_p2.Z()) {}; point p1,p2; //Начало и конец отрезка friend int operator == (const segment3D& s1, const segment3D& s2); }; #define AnyType segment3D #define AnyAr aSegments3D #include <mix/AnyAr.H> point middle(const point& p1,const point& p2); point2D middle(const point2D& p1,const point2D& p2); double ro(const segment2D& s1, const point2D& p); extern point pNaNQ; #endif /* geometry.H */ /* Melnikov George Yu. 20-May-1999 */ /* Melnikov George Yu. 21-May-1999 */ /* Melnikov George Yu. 18-Jun-1999 */ /* Melnikov George Yu. 23-Jun-1999 */ /* Melnikov George Yu. 6-Jul-1999 */ /* Melnikov George Yu. 11-Oct-1999 */
67  void get_coefs(double& A, double& B, double& C);
68  point2D middle()const;
69 };
70 #define AnyType segment2D
71 #define AnyAr aSegments2D
72 #include <mix/AnyAr.H>
73 
74 struct segment3D{
75  segment3D(const point &_p1,const point &_p2)
76  :p1(_p1.X(),_p1.Y(),_p1.Z()),p2(_p2.X(),_p2.Y(),_p2.Z())
77  {};
78  point p1,p2; //Начало и конец отрезкаfriend int operator == (const segment3D& s1, const segment3D& s2); }; #define AnyType segment3D #define AnyAr aSegments3D #include <mix/AnyAr.H> point middle(const point& p1,const point& p2); point2D middle(const point2D& p1,const point2D& p2); double ro(const segment2D& s1, const point2D& p); extern point pNaNQ; #endif /* geometry.H */ /* Melnikov George Yu. 20-May-1999 */ /* Melnikov George Yu. 21-May-1999 */ /* Melnikov George Yu. 18-Jun-1999 */ /* Melnikov George Yu. 23-Jun-1999 */ /* Melnikov George Yu. 6-Jul-1999 */ /* Melnikov George Yu. 11-Oct-1999 */
79 friend int operator == (const segment3D& s1, const segment3D& s2);
80 };
81 #define AnyType segment3D
82 #define AnyAr aSegments3D
83 #include <mix/AnyAr.H>
84 
85 point middle(const point& p1,const point& p2);
86 point2D middle(const point2D& p1,const point2D& p2);
87 double ro(const segment2D& s1, const point2D& p);
88 extern point pNaNQ;
89 #endif /* geometry.H */
90 /* Melnikov George Yu. 20-May-1999 */
91 /* Melnikov George Yu. 21-May-1999 */
92 /* Melnikov George Yu. 18-Jun-1999 */
93 /* Melnikov George Yu. 23-Jun-1999 */
94 /* Melnikov George Yu. 6-Jul-1999 */
95 /* Melnikov George Yu. 11-Oct-1999 */
Definition: geometry.H:58
Definition: geometry.H:16
Definition: geometry.H:74
Definition: geometry.H:39