Search in sources :

Example 1 with Coord3D

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;
}
Also used : Station(org.hwyl.sexytopo.model.survey.Station) Coord3D(org.hwyl.sexytopo.model.graph.Coord3D)

Example 2 with Coord3D

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;
}
Also used : Space(org.hwyl.sexytopo.model.graph.Space) Line(org.hwyl.sexytopo.model.graph.Line) Coord3D(org.hwyl.sexytopo.model.graph.Coord3D) Coord2D(org.hwyl.sexytopo.model.graph.Coord2D) Leg(org.hwyl.sexytopo.model.survey.Leg)

Example 3 with Coord3D

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);
}
Also used : Coord3D(org.hwyl.sexytopo.model.graph.Coord3D) Leg(org.hwyl.sexytopo.model.survey.Leg) Test(org.junit.Test)

Example 4 with Coord3D

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);
}
Also used : Coord3D(org.hwyl.sexytopo.model.graph.Coord3D) Leg(org.hwyl.sexytopo.model.survey.Leg) Test(org.junit.Test)

Example 5 with Coord3D

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);
}
Also used : Coord3D(org.hwyl.sexytopo.model.graph.Coord3D) Leg(org.hwyl.sexytopo.model.survey.Leg) Test(org.junit.Test)

Aggregations

Coord3D (org.hwyl.sexytopo.model.graph.Coord3D)10 Leg (org.hwyl.sexytopo.model.survey.Leg)8 Test (org.junit.Test)7 Line (org.hwyl.sexytopo.model.graph.Line)2 Coord2D (org.hwyl.sexytopo.model.graph.Coord2D)1 Space (org.hwyl.sexytopo.model.graph.Space)1 Station (org.hwyl.sexytopo.model.survey.Station)1