@@ -65,51 +65,6 @@ public void PointInPolygon(TestPoint[] controlPoints, TestPoint point, bool isIn
6565 } ,
6666 } ;
6767
68- [ Theory ]
69- [ MemberData ( nameof ( DistanceTheoryData ) ) ]
70- public void Distance ( TestPoint [ ] controlPoints , TestPoint point , float expected )
71- {
72- IPathInternals shape = new Polygon ( new LinearLineSegment ( controlPoints . Select ( x => ( PointF ) x ) . ToArray ( ) ) ) ;
73- Assert . Equal ( expected , shape . Distance ( point ) . DistanceFromPath ) ;
74- }
75-
76- public static TheoryData < TestPoint , float , float > PathDistanceTheoryData =
77- new TheoryData < TestPoint , float , float >
78- {
79- { new PointF ( 0 , 0 ) , 0f , 0f } ,
80- { new PointF ( 1 , 0 ) , 0f , 1f } ,
81- { new PointF ( 9 , 0 ) , 0f , 9f } ,
82- { new PointF ( 10 , 0 ) , 0f , 10f } ,
83- { new PointF ( 10 , 1 ) , 0f , 11f } ,
84- { new PointF ( 10 , 9 ) , 0f , 19f } ,
85- { new PointF ( 10 , 10 ) , 0f , 20f } ,
86- { new PointF ( 9 , 10 ) , 0f , 21f } ,
87- { new PointF ( 1 , 10 ) , 0f , 29f } ,
88- { new PointF ( 0 , 10 ) , 0f , 30f } ,
89- { new PointF ( 0 , 1 ) , 0f , 39f } ,
90- { new PointF ( 4 , 3 ) , - 3f , 4f } ,
91- { new PointF ( 3 , 4 ) , - 3f , 36f } ,
92- { new PointF ( - 1 , 0 ) , 1f , 0f } ,
93- { new PointF ( 1 , - 1 ) , 1f , 1f } ,
94- { new PointF ( 9 , - 1 ) , 1f , 9f } ,
95- { new PointF ( 11 , 0 ) , 1f , 10f } ,
96- { new PointF ( 11 , 1 ) , 1f , 11f } ,
97- { new PointF ( 11 , 9 ) , 1f , 19f } ,
98- { new PointF ( 11 , 10 ) , 1f , 20f } ,
99- { new PointF ( 9 , 11 ) , 1f , 21f } ,
100- { new PointF ( 1 , 11 ) , 1f , 29f }
101- } ;
102-
103- [ Theory ]
104- [ MemberData ( nameof ( PathDistanceTheoryData ) ) ]
105- public void DistanceFromPath_Path ( TestPoint point , float expectedDistance , float alongPath )
106- {
107- IPathInternals path = new Polygon ( new LinearLineSegment ( new PointF ( 0 , 0 ) , new PointF ( 10 , 0 ) , new PointF ( 10 , 10 ) , new PointF ( 0 , 10 ) ) ) ;
108- PointInfo info = path . Distance ( point ) ;
109- Assert . Equal ( expectedDistance , info . DistanceFromPath ) ;
110- Assert . Equal ( alongPath , info . DistanceAlongPath ) ;
111- }
112-
11368 [ Fact ]
11469 public void AsSimpleLinearPath ( )
11570 {
0 commit comments