Пример #1
0
    public void AddEdges(S2Cap index_cap, int num_edges, MutableS2ShapeIndex index)
    {
        var fractal = new S2Testing.Fractal();

        fractal.SetLevelForApproxMaxEdges(num_edges);
        index.Add(new S2Loop.Shape(
                      fractal.MakeLoop(S2Testing.GetRandomFrameAt(index_cap.Center),
                                       index_cap.RadiusAngle())));
    }
Пример #2
0
    public void Test_S2LaxPolygonShape_CompareToS2Loop()
    {
        for (int iter = 0; iter < 100; ++iter)
        {
            var fractal = new S2Testing.Fractal();
            fractal.MaxLevel         = (S2Testing.Random.Uniform(5));
            fractal.FractalDimension = (1 + S2Testing.Random.RandDouble());
            S2Point center = S2Testing.RandomPoint();
            var     loop   = fractal.MakeLoop(
                S2Testing.GetRandomFrameAt(center), S1Angle.FromDegrees(5));

            // Compare S2Loop to S2LaxLoopShape.
            CompareS2LoopToShape(loop, new S2LaxLoopShape(loop));

            // Compare S2Loop to S2LaxPolygonShape.
            var loops = new List <List <S2Point> > {
                loop.CloneVertices().ToList()
            };
            CompareS2LoopToShape(loop, new S2LaxPolygonShape(loops));
        }
    }