コード例 #1
0
ファイル: ShaperTests.cs プロジェクト: cs-util/GeometryEx
        public void Intersections()
        {
            var polygons =
                new List <Polygon>
            {
                new Polygon
                (
                    new []
                {
                    new Vector3(3.0, 1.0),
                    new Vector3(10.0, 1.0),
                    new Vector3(10.0, 5.0),
                    new Vector3(3.0, 5.0)
                }
                )
            };
            var inters =
                new List <Polygon>
            {
                new Polygon
                (
                    new []
                {
                    new Vector3(7.0, 0.0),
                    new Vector3(8.0, 0.0),
                    new Vector3(8.0, 7.0),
                    new Vector3(7.0, 7.0)
                }
                ),
                new Polygon
                (
                    new []
                {
                    new Vector3(1.0, 3.0),
                    new Vector3(5.0, 3.0),
                    new Vector3(5.0, 7.0),
                    new Vector3(1.0, 7.0)
                }
                )
            };
            var intersects = Shaper.Intersections(polygons, inters);

            Assert.Equal(2, intersects.Count);
        }