Skip to content

Commit cc488e1

Browse files
committed
0.9.5
1 parent 6468fa5 commit cc488e1

29 files changed

+119
-102
lines changed

AddOns/ClipperAddOns.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ namespace EPPZ.Geometry.AddOns
2424
using Paths = List<List<ClipperLib.IntPoint>>;
2525

2626

27+
using Model;
28+
29+
2730
public static class ClipperAddOns
2831
{
2932

AddOns/TriangleNetAddOns.cs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,42 +16,41 @@ namespace EPPZ.Geometry.AddOns
1616

1717

1818
using System.Linq;
19+
1920
using ClipperLib;
20-
21-
using TriangleNet.Geometry;
22-
23-
// Clipper definitions.
2421
using Path = List<ClipperLib.IntPoint>;
2522
using Paths = List<List<ClipperLib.IntPoint>>;
2623

24+
using Model;
25+
2726

2827
public static class TriangleNetAddOns
2928
{
3029

3130

3231
#region Polygon
3332

34-
public static TriangleNet.Geometry.Polygon TriangleNetPolygon(this EPPZ.Geometry.Polygon this_)
33+
public static TriangleNet.Geometry.Polygon TriangleNetPolygon(this Polygon this_)
3534
{
3635
TriangleNet.Geometry.Polygon polygon = new TriangleNet.Geometry.Polygon();
3736

3837
int boundary = 1;
3938
List<TriangleNet.Geometry.Vertex> vertices = new List<TriangleNet.Geometry.Vertex>();
40-
this_.EnumeratePolygons((EPPZ.Geometry.Polygon eachPolygon) =>
39+
this_.EnumeratePolygons((Polygon eachPolygon) =>
4140
{
4241
// Collect vertices.
4342
vertices.Clear();
4443
eachPolygon.EnumeratePoints((Vector2 eachPoint) =>
4544
{
46-
vertices.Add(new Vertex(
45+
vertices.Add(new TriangleNet.Geometry.Vertex(
4746
(double)eachPoint.x,
4847
(double)eachPoint.y,
4948
boundary
5049
));
5150
});
5251

5352
// Add controur.
54-
polygon.Add(new Contour(vertices.ToArray(), boundary));
53+
polygon.Add(new TriangleNet.Geometry.Contour(vertices.ToArray(), boundary));
5554

5655
// Track.
5756
boundary++;
@@ -73,7 +72,7 @@ public static Rect Bounds(this TriangleNet.Voronoi.Legacy.SimpleVoronoi this_)
7372
float ymax = 0.0f;
7473
foreach (TriangleNet.Voronoi.Legacy.VoronoiRegion region in this_.Regions)
7574
{
76-
foreach (Point eachPoint in region.Vertices)
75+
foreach (TriangleNet.Geometry.Point eachPoint in region.Vertices)
7776
{
7877
if (eachPoint.X > xmax) xmax = (float)eachPoint.X;
7978
if (eachPoint.X < xmin) xmin = (float)eachPoint.X;
@@ -91,7 +90,7 @@ public static Paths ClipperPathsFromVoronoiRegions(List<TriangleNet.Voronoi.Lega
9190
foreach (TriangleNet.Voronoi.Legacy.VoronoiRegion eachRegion in voronoiRegions)
9291
{
9392
Path eachPath = new Path();
94-
foreach (Point eachPoint in eachRegion.Vertices)
93+
foreach (TriangleNet.Geometry.Point eachPoint in eachRegion.Vertices)
9594
{
9695
eachPath.Add(new IntPoint(
9796
eachPoint.X * scale,
@@ -108,16 +107,16 @@ public static Paths ClipperPathsFromVoronoiRegions(List<TriangleNet.Voronoi.Lega
108107

109108
#region Generic
110109

111-
public static Vector2 VectorFromPoint(Point point)
110+
public static Vector2 VectorFromPoint(TriangleNet.Geometry.Point point)
112111
{
113112
return new Vector2((float)point.X, (float)point.Y);
114113
}
115114

116-
public static Vector2[] PointsFromVertices(ICollection<Point> vertices)
115+
public static Vector2[] PointsFromVertices(ICollection<TriangleNet.Geometry.Point> vertices)
117116
{
118117
Vector2[] points = new Vector2[vertices.Count];
119118
int pointIndex = 0;
120-
foreach (Point eachPoint in vertices)
119+
foreach (TriangleNet.Geometry.Point eachPoint in vertices)
121120
{
122121
points[pointIndex] = VectorFromPoint(eachPoint);
123122
pointIndex++;

AddOns/UnityEngineAddOns.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ static ITriangulator TriangulatorForType(TriangulatorType triangulator)
4242

4343
#region Polygon
4444

45-
public static UnityEngine.Mesh Mesh(this EPPZ.Geometry.Polygon this_, string name = "")
45+
public static UnityEngine.Mesh Mesh(this EPPZ.Geometry.Model.Polygon this_, string name = "")
4646
{ return this_.Mesh(Color.white, TriangulatorType.Dwyer, name); }
4747

48-
public static UnityEngine.Mesh Mesh(this EPPZ.Geometry.Polygon this_, TriangulatorType triangulator, string name = "")
48+
public static UnityEngine.Mesh Mesh(this EPPZ.Geometry.Model.Polygon this_, TriangulatorType triangulator, string name = "")
4949
{ return this_.Mesh(Color.white, triangulator, name); }
5050

51-
public static UnityEngine.Mesh Mesh(this EPPZ.Geometry.Polygon this_, Color color, TriangulatorType triangulator, string name = "")
51+
public static UnityEngine.Mesh Mesh(this EPPZ.Geometry.Model.Polygon this_, Color color, TriangulatorType triangulator, string name = "")
5252
{
5353
// Create geometry.
5454
TriangleNet.Geometry.Polygon polygon = this_.TriangleNetPolygon();

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# eppz! `Geometry`
22

3+
* 0.9.5
4+
5+
+ Namings
6+
+ Model classes namespaced into `Model`
7+
+ Source classes namespaced into `Source`
8+
+ `Components.PolygonSource` is `Source.Polygon`
9+
+ `Components.SegmentSource` is `Source.Segment`
10+
+ `pointTransforms` is `points`
11+
+ Updated controllers in `Scenes/Controllers`
12+
313
* 0.9.0
414

515
+ Added `TriangleNetAddOns`

Geometry.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ namespace EPPZ.Geometry
1414
{
1515

1616

17+
using Model; // For `Polygon` region only
18+
19+
1720
public static class Geometry
1821
{
1922

Editor/PolygonInspector.cs renamed to Inspector/Editor/PolygonInspector.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,22 @@
1010
using UnityEditor;
1111

1212

13-
namespace EPPZ.Geometry.Editor
13+
namespace EPPZ.Geometry.Inspector.Editor
1414
{
1515

1616

17-
[CustomEditor(typeof(EPPZ.Geometry.Components.PolygonInspector))]
17+
using Model;
18+
19+
20+
[CustomEditor(typeof(EPPZ.Geometry.Inspector.PolygonInspector))]
1821
public class PolygonInspector : UnityEditor.Editor
1922
{
2023

2124

2225
public override void OnInspectorGUI()
2326
{
2427
// References.
25-
EPPZ.Geometry.Components.PolygonInspector polygonInspector = (EPPZ.Geometry.Components.PolygonInspector)target;
28+
Inspector.PolygonInspector polygonInspector = (Inspector.PolygonInspector)target;
2629
Polygon polygon = polygonInspector.polygon;
2730
if (polygon == null) return;
2831
Edge edge = polygon.edges[polygonInspector.currentEdgeIndex];

Components/PolygonInspector.cs renamed to Inspector/PolygonInspector.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
using System.Collections;
1010

1111

12-
namespace EPPZ.Geometry.Components
12+
namespace EPPZ.Geometry.Inspector
1313
{
1414

1515

1616
public class PolygonInspector : MonoBehaviour
1717
{
1818

1919

20-
public Polygon polygon;
20+
public Model.Polygon polygon;
2121
public int currentEdgeIndex = 0;
2222
}
2323
}

Lines/CornerLineRenderer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace EPPZ.Geometry.Lines
1414
{
1515

1616

17-
using EPPZ.Lines;
17+
using Model;
1818

1919

2020
public class CornerLineRenderer : GeometryLineRenderer

Lines/ExtendedPolygonLineRenderer.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ namespace EPPZ.Geometry.Lines
1414
{
1515

1616

17-
using EPPZ.Lines;
18-
using Components;
19-
20-
2117
public class ExtendedPolygonLineRenderer : PolygonLineRenderer
2218
{
2319

@@ -26,13 +22,13 @@ public class ExtendedPolygonLineRenderer : PolygonLineRenderer
2622
public TextMesh areaTextMesh;
2723

2824
private float _previousArea;
29-
private Polygon.Winding _previousWindingDirection;
25+
private Model.Polygon.Winding _previousWindingDirection;
3026

3127

3228
void Start()
3329
{
3430
// Model reference.
35-
PolygonSource polygonSource = GetComponent<PolygonSource>();
31+
Source.Polygon polygonSource = GetComponent<Source.Polygon>();
3632
if (polygonSource != null)
3733
{ polygon = polygonSource.polygon; }
3834
}

Lines/GeometryLineRenderer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ namespace EPPZ.Geometry.Lines
1515

1616

1717
using EPPZ.Lines;
18+
using Model;
1819

1920

2021
public class GeometryLineRenderer : DirectLineRenderer

0 commit comments

Comments
 (0)