use of org.hwyl.sexytopo.model.graph.Coord3D in project sexytopo by richsmith.
the class SurveyStats method calcHeightRange.
public static double calcHeightRange(Survey survey) {
Space3DTransformer transformer = new Space3DTransformer();
Space<Coord3D> space = transformer.transformTo3D(survey);
Map<Station, Coord3D> stationsToCoords = space.getStationMap();
if (stationsToCoords.size() <= 1) {
return 0;
}
double min = Double.MAX_VALUE, max = Double.MIN_VALUE;
for (Coord3D point : space.getStationMap().values()) {
max = Math.max(max, point.getZ());
min = Math.min(min, point.getZ());
}
return max - min;
}
use of org.hwyl.sexytopo.model.graph.Coord3D in project sexytopo by richsmith.
the class CrossSection method getProjection.
public Space<Coord2D> getProjection() {
Space<Coord2D> projection = new Space<>();
projection.addStation(station, Coord2D.ORIGIN);
for (Leg leg : station.getUnconnectedOnwardLegs()) {
// first of all normalise to match the angle of the cross section
Leg rotated = leg.rotate(-angle);
Coord3D coord3D = transformer.transform(Coord3D.ORIGIN, rotated);
Coord2D coord2D = new Coord2D(coord3D.getX(), coord3D.getZ());
Line<Coord2D> line = new Line<>(Coord2D.ORIGIN, coord2D);
projection.addLeg(rotated, line);
}
return projection;
}
use of org.hwyl.sexytopo.model.graph.Coord3D in project sexytopo by richsmith.
the class Space3DTransformerTest method testTransform1MUp.
@Test
public void testTransform1MUp() {
Leg up1MLeg = new Leg(1, 0, 90);
Coord3D result = transformer.transform(Coord3D.ORIGIN, up1MLeg);
Coord3D expected = new Coord3D(0, 0, 1);
assertEquals(expected, result);
}
use of org.hwyl.sexytopo.model.graph.Coord3D in project sexytopo by richsmith.
the class Space3DTransformerTest method testTransform10mNEUAndBack.
@Test
public void testTransform10mNEUAndBack() {
Leg northEastAndUp10M = new Leg(10, 45, 45);
Coord3D result = transformer.transform(Coord3D.ORIGIN, northEastAndUp10M);
System.out.println("result = " + result);
Leg reverse = new Leg(10, 225, -45);
result = transformer.transform(result, reverse);
assertEquals(Coord3D.ORIGIN, result);
}
use of org.hwyl.sexytopo.model.graph.Coord3D in project sexytopo by richsmith.
the class Space3DTransformerTest method testTransform1MNorth.
@Test
public void testTransform1MNorth() {
Leg north1MLeg = new Leg(1, 0, 0);
Coord3D result = transformer.transform(Coord3D.ORIGIN, north1MLeg);
Coord3D expected = new Coord3D(0, 1, 0);
assertEquals(expected, result);
}
Aggregations