@Test public void testTransform1MUp() { Leg up1MLeg = new Leg(1, 0, 90); Coord3D result = Space3DUtils.toCartesian(Coord3D.ORIGIN, up1MLeg); Coord3D expected = new Coord3D(0, 0, 1); assertEquals(expected, result); }
public static Coord3D toCartesian(Coord3D start, Leg leg) { double r = leg.getDistance(); double phi = Math.toRadians(leg.getAzimuth()); double theta = Math.toRadians(leg.getInclination()); double y = r * Math.cos(theta) * Math.cos(phi); double x = r * Math.cos(theta) * Math.sin(phi); double z = r * Math.sin(theta); x += start.x; y += start.y; z += start.z; return new Coord3D(x, y, z); }
Space3DUtils { public static Coord3D toCartesian(Coord3D start, Leg leg) { double r = leg.getDistance(); double phi = Math.toRadians(leg.getAzimuth()); double theta = Math.toRadians(leg.getInclination()); double y = r * Math.cos(theta) * Math.cos(phi); double x = r * Math.cos(theta) * Math.sin(phi); double z = r * Math.sin(theta); x += start.x; y += start.y; z += start.z; return new Coord3D(x, y, z); } }
Space3DUtils { public static Coord3D toCartesian(Coord3D start, Leg leg) { double r = leg.getDistance(); double phi = Math.toRadians(leg.getAzimuth()); double theta = Math.toRadians(leg.getInclination()); double y = r * Math.cos(theta) * Math.cos(phi); double x = r * Math.cos(theta) * Math.sin(phi); double z = r * Math.sin(theta); x += start.x; y += start.y; z += start.z; return new Coord3D(x, y, z); }  }
Space3DUtils { public static Coord3D toCartesian(Coord3D start, Leg leg) { double r = leg.getDistance(); double phi = Math.toRadians(leg.getAzimuth()); double theta = Math.toRadians(leg.getInclination()); double y = r * Math.cos(theta) * Math.cos(phi); double x = r * Math.cos(theta) * Math.sin(phi); double z = r * Math.sin(theta); x += start.x; y += start.y; z += start.z; return new Coord3D(x, y, z); }  static Coord3D toCartesian(Coord3D start, Leg leg); }
Space3DUtils { public static Coord3D toCartesian(Coord3D start, Leg leg) { double r = leg.getDistance(); double phi = Math.toRadians(leg.getAzimuth()); double theta = Math.toRadians(leg.getInclination()); double y = r * Math.cos(theta) * Math.cos(phi); double x = r * Math.cos(theta) * Math.sin(phi); double z = r * Math.sin(theta); x += start.x; y += start.y; z += start.z; return new Coord3D(x, y, z); }  static Coord3D toCartesian(Coord3D start, Leg leg);  }