File tree 3 files changed +20
-5
lines changed
3 files changed +20
-5
lines changed Original file line number Diff line number Diff line change 4
4
#include " ../nullable.h"
5
5
#include " ../utils.h"
6
6
#include " point.h"
7
+ #include " circle.h"
7
8
#include " line.h"
8
9
9
10
namespace geometry {
@@ -100,6 +101,11 @@ namespace geometry {
100
101
return Nullable<Point >();
101
102
}
102
103
104
+ // circle - circle intersection method
105
+ Nullable<std::vector<Point >> Line::getIntersection (Circle circle) {
106
+ return circle.getIntersection (*this );
107
+ }
108
+
103
109
emscripten::val EMLine::getMatchingX (double y) {
104
110
Nullable<double > nullableX = Line::getMatchingX (y);
105
111
return nullableX.hasValue () ?
@@ -126,6 +132,10 @@ namespace geometry {
126
132
emPoint.set (" y" , emscripten::val (point.y ));
127
133
return emPoint;
128
134
}
135
+
136
+ emscripten::val EMLine::getIntersection (EMCircle emCircle) {
137
+ return emCircle.getIntersection (*this );
138
+ }
129
139
}
130
140
131
141
EMSCRIPTEN_BINDINGS (geometry_line_module) {
@@ -146,5 +156,10 @@ EMSCRIPTEN_BINDINGS(geometry_line_module) {
146
156
emscripten::select_overload<emscripten::val (geometry::EMLine)>(
147
157
&geometry::EMLine::getIntersection
148
158
)
159
+ )
160
+ .function (" getCircleIntersection" ,
161
+ emscripten::select_overload<emscripten::val (geometry::EMCircle)>(
162
+ &geometry::EMLine::getIntersection
163
+ )
149
164
);
150
165
}
Original file line number Diff line number Diff line change 4
4
#include < emscripten/val.h>
5
5
#include " ../nullable.h"
6
6
#include " point.h"
7
+ #include " circle.h"
7
8
8
9
namespace geometry {
9
10
class Circle ;
@@ -27,6 +28,8 @@ namespace geometry {
27
28
bool boundsHavePoint (double x, double y);
28
29
29
30
Nullable<Point > getIntersection (Line line);
31
+
32
+ Nullable<std::vector<Point >> getIntersection (Circle circle);
30
33
};
31
34
32
35
class EMLine : public Line {
@@ -38,5 +41,7 @@ namespace geometry {
38
41
emscripten::val getMatchingY (double x);
39
42
40
43
emscripten::val getIntersection (EMLine line);
44
+
45
+ emscripten::val getIntersection (EMCircle circle);
41
46
};
42
47
}
Original file line number Diff line number Diff line change @@ -14,11 +14,6 @@ Engine.Geometry.Line = class Line extends Utils.proxy(CPP.Geometry.Line) {
14
14
return this . getPolygonIntersection ( shape ) ;
15
15
}
16
16
17
- // line - circle intersection method
18
- getCircleIntersection ( circle ) {
19
- return circle . getLineIntersection ( this ) ;
20
- }
21
-
22
17
// line - polygon intersection method
23
18
getPolygonIntersection ( polygon ) {
24
19
return polygon . getLineIntersection ( this ) ;
You can’t perform that action at this time.
0 commit comments