|
1 | 1 | # eppz.Geometry |
2 | 2 | > part of [**Unity.Library.eppz**](https://github.com/eppz/Unity.Library.eppz) |
3 | 3 |
|
4 | | -📐 2D geometry for Unity. |
| 4 | +**📐 2D geometry for Unity.** |
5 | 5 |
|
6 | | -Polygon triangulation, Delunay triangulation, Voronoi, polygon offset, polygon outline, union of polygons, substraction of polygons. polygon clipping, polygon winding direction, polygon area, polygon centroid, centroid of multiple polygons, line intersection, point-line distance, segment intersection, polygon-point containment, and more. |
| 6 | +Polygon triangulation, Voronoi diagram, polygon offset, polygon outline, union of polygons, substraction of polygons. polygon clipping, polygon winding direction, polygon area, polygon centroid, centroid of multiple polygons, line intersection, point-line distance, segment intersection, polygon-point containment, and more. |
7 | 7 |
|
8 | | -The library is **being used in production**. However, it comes with the disclaimed liability and warranty of [MIT License](https://en.wikipedia.org/wiki/MIT_License)). |
| 8 | +The library is **being used in production**. However, it comes with the disclaimed liability and warranty of [MIT License](https://en.wikipedia.org/wiki/MIT_License). |
| 9 | + |
| 10 | +## Examples |
| 11 | + |
| 12 | +If you prefer to read example code immediately, you can find example scenes in [`Scenes`](Scenes) folder. |
| 13 | + |
| 14 | +## Model classes |
| 15 | + |
| 16 | +* [`Vertex.cs`](Model/Vertex.cs) |
| 17 | + + Basically a `Vector2` point, but is aware of the polygon context it resides (neighbours, segments, edges, polygon, bisector, normal). |
| 18 | +* [`Segment.cs`](Model/Segment.cs) |
| 19 | + + Segment of two `Vector2` point. Carries out basic geometry features (point distance, point containment, segment intersection). |
| 20 | +* [`Edge.cs`](Model/Edge.cs) |
| 21 | + + Edge of two `Vertex` in a polygon (a special `Segment` subclass). Likewise vertices, this model is also aware of the polygon context it resides (neighbours, segments, edges, polygon, perpendicular, normal). |
| 22 | +* [`Polygon.cs`](Model/Edge.cs) |
| 23 | + + The role player, it really **embodies mostly every feature of this library**. Basically a polygon made of vertices. |
| 24 | + + Can be created with point array, transforms, [`PolygonSource`](Components/PolygonSource.cs). Further polygons can be embedded into recursively. Vertices, edges, polygons can be enumerated (recursively). |
| 25 | + + Area, winding direction, centroid are being calculated. Also carries the basic geometry features (point containment, line-, segment-, polygon intersection and more). |
| 26 | + + Using library modules, it implements polygon offset (outline), union polygon (polygon clipping), basic mesh triangulation. It implements conversion to both [Clipper](https://github.com/eppz/Clipper) and [Triangle.NET](https://github.com/eppz/Triangle.NET), so you can implement further integration with those (awesome) libraries. |
9 | 27 |
|
10 | 28 | ## [`Geometry.cs`](Geometry.cs) |
11 | 29 |
|
12 | | -The basic 2D geometry algorithm collection is implemented in this static base class. |
| 30 | +Most of the basic 2D geometry algorithm collection is implemented in this static base class. You can (mostly) **use them with Unity `Vector2` types directly**, so (almost entirely) without the model classes introduced above. |
13 | 31 |
|
14 | 32 | * **Point** |
15 | 33 | + `bool ArePointsEqualWithAccuracy(Vector2 a, Vector2 b, float accuracy)` |
|
0 commit comments