Skip to content

Commit 7889d92

Browse files
Cleanup
1 parent ee453aa commit 7889d92

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/PolygonClipper/Contour.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ public sealed class Contour
4343
public int HoleCount => this.holes.Count;
4444

4545
/// <summary>
46-
/// Gets a value indicating whether the contour
47-
/// is external (not a hole).
46+
/// Gets a value indicating whether the contour is external (not a hole).
4847
/// </summary>
4948
public bool IsExternal => this.HoleOf == null;
5049

@@ -127,12 +126,12 @@ public bool IsCounterClockwise()
127126
{
128127
c = points[i];
129128
c1 = points[i + 1];
130-
area += (c.X * c1.Y) - (c1.X * c.Y);
129+
area += Vertex.Cross(c, c1);
131130
}
132131

133-
c = points[this.points.Count - 1];
132+
c = points[^1];
134133
c1 = points[0];
135-
area += (c.X * c1.Y) - (c1.X * c.Y);
134+
area += Vertex.Cross(c, c1);
136135
return this.cc = area >= 0;
137136
}
138137

@@ -176,11 +175,11 @@ public void SetCounterClockwise()
176175
}
177176

178177
/// <summary>
179-
/// Offsets the contour by the specified x and y values.
178+
/// Translates the contour by the specified x and y values.
180179
/// </summary>
181180
/// <param name="x">The x-coordinate offset.</param>
182181
/// <param name="y">The y-coordinate offset.</param>
183-
public void Offset(double x, double y)
182+
public void Translate(double x, double y)
184183
{
185184
List<Vertex> points = this.points;
186185
for (int i = 0; i < points.Count; i++)

src/PolygonClipper/Polygon.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ public Box2 GetBoundingBox()
9393
}
9494

9595
/// <summary>
96-
/// Offsets the polygon by the specified x and y values.
96+
/// Translates the polygon by the specified x and y values.
9797
/// </summary>
9898
/// <param name="x">The x-coordinate offset.</param>
9999
/// <param name="y">The y-coordinate offset.</param>
100-
public void Offset(double x, double y)
100+
public void Translate(double x, double y)
101101
{
102102
for (int i = 0; i < this.contours.Count; i++)
103103
{
104-
this.contours[i].Offset(x, y);
104+
this.contours[i].Translate(x, y);
105105
}
106106
}
107107

0 commit comments

Comments
 (0)