-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtest_application.py
More file actions
147 lines (119 loc) · 3.67 KB
/
test_application.py
File metadata and controls
147 lines (119 loc) · 3.67 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
import sympy.geometry as geoSympy
from Generic.Kernel.GeoEntity.point import Point
from Generic.Kernel.GeoEntity.segment import Segment
from Generic.Kernel.GeoEntity.arc import Arc
from Generic.Kernel.GeoEntity.ellipse import Ellipse
from Generic.Kernel.GeoEntity.cline import CLine
from Generic.Kernel.GeoUtil.intersection import find_intersections
def testSympySegment():
print("++ Sympy Segment ++")
p1 = Point(0, 1)
p2 = Point(10, 20)
arg = {"SEGMENT_0": p1, "SEGMENT_1": p2}
seg = Segment(arg)
symSeg = seg.getSympy()
print(symSeg)
p3 = Point(30, 40)
arg1 = {"SEGMENT_0": p1, "SEGMENT_1": p3}
seg1 = Segment(arg1)
seg1.setFromSympy(symSeg)
print("Segment ", seg1)
print("-- Sympy Segment --")
def testSympyCline():
print("++ Sympy CLine ++")
p1 = Point(0, 1)
p2 = Point(10, 20)
arg = {"CLINE_0": p1, "CLINE_1": p2}
seg = CLine(arg)
symSeg = seg.getSympy()
print(symSeg)
p3 = Point(30, 40)
arg1 = {"CLINE_0": p1, "CLINE_1": p3}
seg1 = CLine(arg1)
seg1.setFromSympy(symSeg)
print("CLine ", seg1)
print("-- Sympy CLine --")
def testSympyCircle():
print("++ Sympy Arc ++")
p1 = Point(0, 1)
arg = {"ARC_0": p1, "ARC_1": 5, "ARC_2": 0, "ARC_3": 6.2831}
arc = Arc(arg)
sympCircle = arc.getSympy()
print("sympCircle", sympCircle)
sympCircel = geoSympy.Circle(geoSympy.Point(10, 10), 10)
arc.setFromSympy(sympCircel)
print("Pythonca Arc ", arc)
print("-- Sympy Arc --")
def testSympyEllipse():
print("++ Sympy Ellipse ++")
p1 = Point(0, 1)
arg = {"ELLIPSE_0": p1, "ELLIPSE_1": 100, "ELLIPSE_2": 50}
eli = Ellipse(arg)
sympEli = eli.getSympy()
print("sympEllipse", sympEli)
sympEli1 = geoSympy.Ellipse(geoSympy.Point(10, 10), 300, 200)
eli.setFromSympy(sympEli1)
print("Pythonca Ellipse ", eli)
print("-- Sympy Ellipse --")
def TestSympy():
testSympySegment()
testSympyCline()
testSympyCircle()
testSympyEllipse()
# *****************************************************************
# Test Intersection
# *****************************************************************
def segment_segmet():
print("++ segment_segmet ++")
p1 = Point(0, 0)
p2 = Point(0, 1)
arg = {"SEGMENT_0": p1, "SEGMENT_1": p2}
seg1 = Segment(arg)
p3 = Point(0, 0)
p4 = Point(-1, 0)
arg = {"SEGMENT_0": p3, "SEGMENT_1": p4}
seg2 = Segment(arg)
print(find_intersections(seg1, seg2))
print("-- segment_segmet --")
def segment_cline():
print("++ segment_cline ++")
p1 = Point(0, 0)
p2 = Point(0, 1)
arg = {"CLINE_0": p1, "CLINE_1": p2}
seg1 = CLine(arg)
p3 = Point(0, 0)
p4 = Point(-1, 0)
arg = {"SEGMENT_0": p3, "SEGMENT_1": p4}
seg2 = Segment(arg)
print(find_intersections(seg1, seg2))
print("-- segment_cline --")
def segment_circle():
print("++ segment_circle ++")
p1 = Point(0, 0)
arg = {"ARC_0": p1, "ARC_1": 5, "ARC_2": 0, "ARC_3": 6.2831}
arc = Arc(arg)
p2 = Point(0, 0)
p3 = Point(-1, 0)
arg = {"CLINE_0": p2, "CLINE_1": p3}
seg1 = CLine(arg)
print(find_intersections(arc, seg1))
print("-- segment_circle --")
def segment_ellipse():
print("++ segment_ellipse ++")
p1 = Point(0, 0)
arg = {"ELLIPSE_0": p1, "ELLIPSE_1": 300, "ELLIPSE_2": 100}
eli = Ellipse(arg)
p2 = Point(0, 0)
p3 = Point(-1, 0)
arg = {"CLINE_0": p2, "CLINE_1": p3}
seg1 = CLine(arg)
print(find_intersections(eli, seg1))
print("-- segment_ellipse --")
def TestIntersection():
segment_segmet()
segment_cline()
segment_circle()
segment_ellipse()
if __name__ == "__main__":
TestSympy()
TestIntersection()