Esempio n. 1
0
 public void Test_UVWFace()
 {
     // Check that GetUVWFace is consistent with GetUVWAxis.
     for (int face = 0; face < 6; ++face)
     {
         for (int axis = 0; axis < 3; ++axis)
         {
             Assert.Equal(S2.GetFace(-S2.GetUVWAxis(face, axis)),
                          S2.GetUVWFace(face, axis, 0));
             Assert.Equal(S2.GetFace(S2.GetUVWAxis(face, axis)),
                          S2.GetUVWFace(face, axis, 1));
         }
     }
 }
    public void Test_GetCrossingCandidates_PerturbedCubeFaceAxes()
    {
        List <(S2Point, S2Point)> edges = new();

        for (int iter = 0; iter < 5; ++iter)
        {
            int     face  = S2Testing.Random.Uniform(6);
            double  scale = Math.Pow(S2.DoubleError, S2Testing.Random.RandDouble());
            S2Point axis  = S2.GetUVWAxis(face, S2Testing.Random.Uniform(2));
            S2Point a0    = scale * axis + S2.GetNorm(face);
            S2Point b0    = scale * axis - S2.GetNorm(face);
            GetPerturbedSubEdges(a0, b0, 30, edges);
            TestAllCrossings(edges);
        }
    }
Esempio n. 3
0
        public void Test_UVWAxis()
        {
            for (int face = 0; face < 6; ++face)
            {
                // Check that axes are consistent with FaceUVtoXYZ.
                Assert.Equal(S2.FaceUVtoXYZ(face, 1, 0) - S2.FaceUVtoXYZ(face, 0, 0),
                             S2.GetUAxis(face));
                Assert.Equal(S2.FaceUVtoXYZ(face, 0, 1) - S2.FaceUVtoXYZ(face, 0, 0),
                             S2.GetVAxis(face));
                Assert.Equal(S2.FaceUVtoXYZ(face, 0, 0), S2.GetNorm(face));

                // Check that every face coordinate frame is right-handed.
                Assert.Equal(1, S2.GetUAxis(face).CrossProd(S2.GetVAxis(face))
                             .DotProd(S2.GetNorm(face)));

                // Check that GetUVWAxis is consistent with GetUAxis, GetVAxis, GetNorm.
                Assert.Equal(S2.GetUAxis(face), S2.GetUVWAxis(face, 0));
                Assert.Equal(S2.GetVAxis(face), S2.GetUVWAxis(face, 1));
                Assert.Equal(S2.GetNorm(face), S2.GetUVWAxis(face, 2));
            }
        }