Beispiel #1
0
        public void SubdomainByCentreTest()
        {
            var polyCrv = new PolyCurve(new Line(0, 0, 10, 10));

            polyCrv.AddArc(new Vector(10, 0));
            polyCrv.Add(new PolyLine(new Vector(10, 0), new Vector(5, 0), new Vector(5, -5)));

            var   domain = polyCrv.SubdomainByCentre(0.5, 20);
            Curve subCrv = polyCrv.Extract(domain);

            Assert.AreEqual(20, subCrv.Length, 0.00001);
        }
Beispiel #2
0
        public void AreaCalculationTest()
        {
            var polyCrv = new PolyCurve(new Line(0, 0, 10, 10));

            polyCrv.AddArc(new Vector(10, 0));
            polyCrv.Add(new PolyLine(new Vector(10, 0), new Vector(5, 0), new Vector(5, -5)));
            polyCrv.Close();

            Vector centroid;
            double area = polyCrv.CalculateEnclosedArea(out centroid);

            Assert.AreEqual(205.309725, area, 0.0001);
        }
Beispiel #3
0
        public void DuplicateTest()
        {
            var polyCrv = new PolyCurve(new Line(0, 0, 10, 10));

            polyCrv.AddArc(new Vector(10, 0));
            polyCrv.Add(new PolyLine(new Vector(10, 0), new Vector(5, 0), new Vector(5, -5)));

            for (int i = 0; i < 1000; i++)
            {
                var polyCrv2 = polyCrv.Duplicate();
                Assert.AreEqual(polyCrv.Length, polyCrv2.Length);
            }
        }