Skip to content

Commit 57ff99d

Browse files
Remove MaxIntersections
1 parent 1d0a834 commit 57ff99d

7 files changed

Lines changed: 4 additions & 30 deletions

File tree

src/ImageSharp.Drawing/Shapes/ComplexPolygon.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public sealed class ComplexPolygon : IPath, IPathInternals, IInternalPathOwner
1818
{
1919
private readonly IPath[] paths;
2020
private readonly List<InternalPath> internalPaths;
21-
private readonly int maxIntersections;
2221
private readonly float length;
2322

2423
/// <summary>
@@ -48,7 +47,6 @@ public ComplexPolygon(params IPath[] paths)
4847
float minY = float.MaxValue;
4948
float maxY = float.MinValue;
5049
float length = 0;
51-
int intersections = 0;
5250

5351
foreach (IPath p in this.paths)
5452
{
@@ -75,19 +73,16 @@ public ComplexPolygon(params IPath[] paths)
7573
foreach (ISimplePath s in p.Flatten())
7674
{
7775
var ip = new InternalPath(s.Points, s.IsClosed);
78-
intersections += ip.PointCount;
7976
length += ip.Length;
8077
this.internalPaths.Add(ip);
8178
}
8279
}
8380

84-
this.maxIntersections = intersections;
8581
this.length = length;
8682
this.Bounds = new RectangleF(minX, minY, maxX - minX, maxY - minY);
8783
}
8884
else
8985
{
90-
this.maxIntersections = 0;
9186
this.length = 0;
9287
this.Bounds = RectangleF.Empty;
9388
}
@@ -106,9 +101,6 @@ public ComplexPolygon(params IPath[] paths)
106101
/// <inheritdoc/>
107102
public RectangleF Bounds { get; }
108103

109-
/// <inheritdoc/>
110-
int IPathInternals.MaxIntersections => this.maxIntersections;
111-
112104
/// <inheritdoc/>
113105
public bool Contains(PointF point)
114106
{

src/ImageSharp.Drawing/Shapes/EllipsePolygon.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ private EllipsePolygon(CubicBezierLineSegment segment)
7676
/// <inheritdoc/>
7777
public PathTypes PathType => PathTypes.Closed;
7878

79-
/// <inheritdoc />
80-
int IPathInternals.MaxIntersections => this.innerPath.PointCount;
81-
8279
/// <inheritdoc/>
8380
public IPath Transform(Matrix3x2 matrix) => matrix.IsIdentity
8481
? this

src/ImageSharp.Drawing/Shapes/IPathInternals.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ namespace SixLabors.ImageSharp.Drawing
88
/// </summary>
99
internal interface IPathInternals : IPath
1010
{
11-
/// <summary>
12-
/// Gets the maximum number intersections that a shape can have when testing a line.
13-
/// </summary>
14-
int MaxIntersections { get; }
15-
1611
/// <summary>
1712
/// Returns information about a point at a given distance along a path.
1813
/// </summary>

src/ImageSharp.Drawing/Shapes/Path.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ public Path(params ILineSegment[] segments)
5757
/// <inheritdoc />
5858
public PathTypes PathType => this.IsClosed ? PathTypes.Open : PathTypes.Closed;
5959

60-
/// <inheritdoc />
61-
public int MaxIntersections => this.InnerPath.PointCount;
60+
/// <summary>
61+
/// Gets the maximum number intersections that a shape can have when testing a line.
62+
/// </summary>
63+
internal int MaxIntersections => this.InnerPath.PointCount;
6264

6365
/// <summary>
6466
/// Gets readonly collection of line segments.

src/ImageSharp.Drawing/Shapes/RectangularPolygon.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,6 @@ public RectangularPolygon(RectangleF rectangle)
121121
/// <inheritdoc/>
122122
public RectangleF Bounds { get; private set; }
123123

124-
/// <inheritdoc/>
125-
int IPathInternals.MaxIntersections => 4;
126-
127124
/// <inheritdoc/>
128125
public bool IsClosed => true;
129126

tests/ImageSharp.Drawing.Tests/Drawing/Paths/ShapeRegionTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ public abstract class MockPath : IPath, IPathInternals
2727

2828
public abstract PathTypes PathType { get; }
2929

30-
public abstract int MaxIntersections { get; }
31-
3230
public int TestFindIntersectionsInvocationCounter { get; private set; }
3331

3432
public virtual int TestYToScan => 10;

tests/ImageSharp.Drawing.Tests/Shapes/RectangleTests.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,6 @@ public void Bounds_Path()
144144
Assert.Equal(24, shape.Bounds.Bottom);
145145
}
146146

147-
[Fact]
148-
public void MaxIntersections_Shape()
149-
{
150-
IPathInternals shape = new RectangularPolygon(10, 11, 12, 13);
151-
Assert.Equal(4, shape.MaxIntersections);
152-
}
153-
154147
[Fact]
155148
public void ShapePaths()
156149
{

0 commit comments

Comments
 (0)