-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGeom.h
96 lines (82 loc) · 6.01 KB
/
Geom.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// Geom.h
// Copyright (c) 2009, Dan Heeks
// This program is released under the BSD license. See the file COPYING for details.
#pragma once
// functions to find intersections between gp items
bool intersect(const gp_Lin& lin, const gp_Lin& lin2, gp_Pnt &pnt);
bool intersect(const gp_Lin& lin, const gp_Pln& pln, gp_Pnt &pnt);
bool intersect(const gp_Pln& pln, const gp_Pln& pln2, gp_Lin& lin);
bool intersect(const gp_Pnt& pnt, const gp_Pln& pln);
bool intersect(const gp_Pnt& pnt, const gp_Lin& lin);
bool intersect(const gp_Pnt& pnt, const gp_Circ& cir);
void intersect(const gp_Lin& lin, const gp_Elips& elips, std::list<gp_Pnt> &list);
void intersect(const gp_Lin& lin, const gp_Circ& cir, std::list<gp_Pnt> &list);
void intersect(const gp_Circ& c1, const gp_Circ& c2, std::list<gp_Pnt> &list);
void extract(const gp_Pnt &p, double *m);
void extract(const gp_Vec &v, double *m);
void extract(const gp_XYZ &xyz, double *m);
void extract(const gp_Trsf& tr, double *m);
void extract_transposed(const gp_Trsf& tr, double *m);
#define TwoCircleType 100000
class PointLineOrCircle{
public:
int type; // UnknownType, PointType, LineType, CircleType or TwoCircleType
gp_Pnt p;
gp_Lin l;
gp_Circ c;
gp_Circ c2;
PointLineOrCircle() :type(0){}
};
gp_Pnt ClosestPointOnPlane(const gp_Pln& pln, const gp_Pnt &p);
gp_Pnt ClosestPointOnLine(const gp_Lin& line, const gp_Pnt &p);
void ClosestPointsOnLines(const gp_Lin& lin, const gp_Lin& lin2, gp_Pnt &p1, gp_Pnt &p2);// they might be the same point
void ClosestPointsLineAndCircle(const gp_Lin& lin, const gp_Circ& cir, std::list<gp_Pnt> &list);
double GetEllipseRotation(const gp_Elips& elips);
double DistanceToFoci(const gp_Pnt &pnt, const gp_Elips &elips);
void ClosestPointsLineAndEllipse(const gp_Lin& lin, const gp_Elips& elips, std::list<gp_Pnt> &list);
// I've made all the combinations of these, 3*3*3 = 27 :), but all except 10 are just to redirect
void TangentCircles(const gp_Pnt& p1, const gp_Pnt& p2, const gp_Pnt& p3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Pnt& p1, const gp_Pnt& p2, const gp_Lin& l3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Pnt& p1, const gp_Pnt& p2, const gp_Circ& c3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Pnt& p1, const gp_Lin& l2, const gp_Pnt& p3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Pnt& p1, const gp_Lin& l2, const gp_Lin& l3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Pnt& p1, const gp_Lin& l2, const gp_Circ& c3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Pnt& p1, const gp_Circ& c2, const gp_Pnt& p3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Pnt& p1, const gp_Circ& c2, const gp_Lin& l3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Pnt& p1, const gp_Circ& c2, const gp_Circ& c3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Lin& l1, const gp_Pnt& p2, const gp_Pnt& p3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Lin& l1, const gp_Pnt& p2, const gp_Lin& l3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Lin& l1, const gp_Pnt& p2, const gp_Circ& c3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Lin& l1, const gp_Lin& l2, const gp_Pnt& p3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Lin& l1, const gp_Lin& l2, const gp_Lin& l3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Lin& l1, const gp_Lin& l2, const gp_Circ& c3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Lin& l1, const gp_Circ& c2, const gp_Pnt& p3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Lin& l1, const gp_Circ& c2, const gp_Lin& l3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Lin& l1, const gp_Circ& c2, const gp_Circ& c3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Circ& c1, const gp_Pnt& p2, const gp_Pnt& p3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Circ& c1, const gp_Pnt& p2, const gp_Lin& l3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Circ& c1, const gp_Pnt& p2, const gp_Circ& c3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Circ& c1, const gp_Lin& l2, const gp_Pnt& p3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Circ& c1, const gp_Lin& l2, const gp_Lin& l3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Circ& c1, const gp_Lin& l2, const gp_Circ& c3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Circ& c1, const gp_Circ& c2, const gp_Pnt& p3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Circ& c1, const gp_Circ& c2, const gp_Lin& l3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Circ& c1, const gp_Circ& c2, const gp_Circ& c3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Circ& c1, const gp_Circ& c2, const gp_Circ& c3, std::list<gp_Circ>& c_list);
void TangentCircles(const gp_Circ& c1, const gp_Lin& l2, const gp_Pnt& p3, std::list<gp_Circ>& c_list);
void TangentCircles(const PointLineOrCircle& plc1, const PointLineOrCircle& plc2, const PointLineOrCircle& plc3, std::list<gp_Circ>& c_list);
gp_Circ PointToCircle(const gp_Pnt& p);
bool LineToBigCircles(const gp_Lin& lin, const gp_Dir& z_axis, gp_Circ& c1, gp_Circ& c2);
gp_Pnt make_point(const double* p);
gp_Vec make_vector(const gp_Pnt &p1, const gp_Pnt &p2);
gp_Vec make_vector(const double* v);
gp_Lin make_line(const gp_Pnt &p1, const gp_Pnt &p2);
gp_Lin make_line(const gp_Pnt &p, const gp_Vec &v);
gp_Trsf make_matrix(const double* m);
gp_Trsf make_matrix(const gp_Pnt &origin, const gp_Vec &x_axis, const gp_Vec &y_axis);
void add_pnt_to_doubles(const gp_Pnt& pnt, std::list<double> &dlist);
int convert_pnts_to_doubles(const std::list<gp_Pnt> &plist, std::list<double> &dlist);
bool make_point_from_doubles(const std::list<double> &dlist, std::list<double>::const_iterator &It, gp_Pnt& pnt, bool four_doubles = false);
int convert_doubles_to_pnts(const std::list<double> &dlist, std::list<gp_Pnt> &plist, bool four_doubles = false);
bool IsEqual(gp_Ax2 ax1, gp_Ax2 ax2);
bool IsEqual(gp_Ax1 ax1, gp_Ax1 ax2);