Beispiel #1
0
        public void GetPolygonInteriorPoint_SquarePolygon_ReturnsInteriorPoint()
        {
            // Setup
            Point2D[] outerRing = CreateBasePolygon();

            // Call
            Point2D interiorPoint = AdvancedMath2D.GetPolygonInteriorPoint(outerRing, new IEnumerable <Point2D> [0]);

            // Assert
            Assert.AreEqual(new Point2D(2, 2), interiorPoint);
        }
Beispiel #2
0
        public void GetPolygonInteriorPoint_PolygonWithHoles_ReturnsInteriorPoint()
        {
            // Setup
            Point2D[]   outerRing  = CreateCustomPolygon();
            Point2D[][] innerRings = CreateInnerRings();

            // Call
            Point2D interiorPoint = AdvancedMath2D.GetPolygonInteriorPoint(outerRing, innerRings);

            // Assert
            Assert.AreEqual(new Point2D(0.75, 2.5), interiorPoint);
        }
        private static PersistableStatePoint CreatePOPStatePoint(MacroStabilityInwardsSoilLayer2D layer, MacroStabilityInwardsExportStageType stageType,
                                                                 IdFactory idFactory, MacroStabilityInwardsExportRegistry registry)
        {
            Point2D interiorPoint = AdvancedMath2D.GetPolygonInteriorPoint(layer.OuterRing.Points, layer.NestedLayers.Select(layers => layers.OuterRing.Points));

            return(new PersistableStatePoint
            {
                Id = idFactory.Create(),
                LayerId = registry.GeometryLayers[stageType][layer],
                IsProbabilistic = true,
                Point = new PersistablePoint(interiorPoint.X, interiorPoint.Y),
                Stress = CreatePOPStress(layer.Data),
                Label = string.Format(Resources.PersistableStateFactory_CreateStatePoint_POP_LayerName_0, layer.Data.MaterialName)
            });
        }