private void DoCubeFaceTest(CubeSectorFace face, LongLat longLat, bool doXNotY, double expectedAnswer) { var front = new CubeSector(face, 0, 0, 0); Vector3d normal = front.sectorFace.GetFaceNormal(); Vector3d down = front.sectorFace.GetFaceDownDirection(); Vector3d right = front.sectorFace.GetFaceRightDirection(); if (doXNotY) { ZAssert.AssertIsClose(front.GetRel(normal, right, longLat.ToSphereVector()), expectedAnswer); } else { ZAssert.AssertIsClose(front.GetRel(normal, down, longLat.ToSphereVector()), expectedAnswer); } }
public static string GetFaceAcronym(this CubeSectorFace sectorFace) { switch (sectorFace) { case CubeSectorFace.FRONT: return("FR"); case CubeSectorFace.BACK: return("BA"); case CubeSectorFace.LEFT: return("LE"); case CubeSectorFace.RIGHT: return("RI"); case CubeSectorFace.TOP: return("TO"); case CubeSectorFace.BOTTOM: return("BO"); } throw new NotImplementedException(); }
public static Vector3d GetFaceNormal(this CubeSectorFace sectorFace) { switch (sectorFace) { case CubeSectorFace.FRONT: return(new Vector3d(0, -1, 0)); case CubeSectorFace.BACK: return(new Vector3d(0, 1, 0)); case CubeSectorFace.LEFT: return(new Vector3d(-1, 0, 0)); case CubeSectorFace.RIGHT: return(new Vector3d(1, 0, 0)); case CubeSectorFace.TOP: return(new Vector3d(0, 0, 1)); case CubeSectorFace.BOTTOM: return(new Vector3d(0, 0, -1)); } throw new NotImplementedException(); }
public static Vector3d GetFaceRightDirection(this CubeSectorFace sectorFace) { switch (sectorFace) { case CubeSectorFace.FRONT: return(GetFaceNormal(CubeSectorFace.RIGHT)); case CubeSectorFace.BACK: return(GetFaceNormal(CubeSectorFace.LEFT)); case CubeSectorFace.LEFT: return(GetFaceNormal(CubeSectorFace.FRONT)); case CubeSectorFace.RIGHT: return(GetFaceNormal(CubeSectorFace.BACK)); case CubeSectorFace.TOP: return(GetFaceNormal(CubeSectorFace.RIGHT)); case CubeSectorFace.BOTTOM: return(GetFaceNormal(CubeSectorFace.LEFT)); } throw new NotImplementedException(); }