You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Copyright (c) 2017 Geri Borbás http://www.twitter.com/_eppz
3
+
//
4
+
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
These test scenes are designed to experience / proof the **eppz! Geometry** library features. Hit play, then manipulate the geometry in Scene window while in game mode (watch out to move the points directly instead their parent container). Every relevant code is in the corresponding `Controller_#.cs`, so you can see **how to use the API**.
7
10
8
11
You can define a polygon with simple `Vector2[]` array, but for sake of simplicity, test scenes uses some **polygon sourcing helper classes** ([`Components.PolygonSource`](../Components/PolygonSource.cs)) those take simple `GameObject` transforms as input. They also keep the polygon models updated on `GameObject` changes.
@@ -11,7 +14,7 @@ Another helper objects are **polygon line renderers** ([`Lines.PolygonLineRender
11
14
12
15
Beside these helper classes, you can easily construct `Polygon` / `Segment` instances using simple `Vector2` inputs as well. Having these test scenes, you can easily provision the mechanism of each geometry feature even with your own polygons.
13
16
14
-
## 0. Polygon-point containment
17
+
## 0. Polygon-Point containment
15
18
16
19
The star polygon drawn yellow when it contains all three points.
17
20
@@ -22,7 +25,21 @@ Usage:
22
25
```C#
23
26
booltest=polygon.ContainsPoint(point);
24
27
```
25
-
See [`Controller_0.cs`](Controllers/Controller_0,cs) for the full context.
28
+
See [`Controller_0.cs`](Controllers/Controller_0,cs) for the full script context.
29
+
30
+
## 1. Polygon-Segment intersection
31
+
32
+
The star polygon drawn yellow when any of the two segments intersects any polygon edge.
33
+
34
+
+ Returns false when a segment endpoint appears to be on a polygon edge
35
+
+ Returns false when a segment endpoint is at a polygon vertex
0 commit comments