Search in sources :

Example 6 with Coord3D

use of org.hwyl.sexytopo.model.graph.Coord3D in project sexytopo by richsmith.

the class Space3DTransformerTest method testTransform1MDown.

@Test
public void testTransform1MDown() {
    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 7 with Coord3D

use of org.hwyl.sexytopo.model.graph.Coord3D in project sexytopo by richsmith.

the class Space3DTransformer method update.

private void update(Space<Coord3D> space, Leg leg, Coord3D start) {
    Coord3D end = transform(start, leg);
    Line<Coord3D> line = new Line<>(start, end);
    space.addLeg(leg, line);
    if (leg.hasDestination()) {
        update(space, leg.getDestination(), end);
    }
}
Also used : Line(org.hwyl.sexytopo.model.graph.Line) Coord3D(org.hwyl.sexytopo.model.graph.Coord3D)

Example 8 with Coord3D

use of org.hwyl.sexytopo.model.graph.Coord3D in project sexytopo by richsmith.

the class Space3DTransformerTest method testTransform3N3E3S3W.

@Test
public void testTransform3N3E3S3W() {
    Leg n3 = new Leg(3, 0, 0);
    Coord3D result = transformer.transform(Coord3D.ORIGIN, n3);
    Leg e3 = new Leg(3, 90, 0);
    result = transformer.transform(result, e3);
    Leg s3 = new Leg(3, 180, 0);
    result = transformer.transform(result, s3);
    Leg w3 = new Leg(3, 270, 0);
    result = transformer.transform(result, w3);
    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 9 with Coord3D

use of org.hwyl.sexytopo.model.graph.Coord3D in project sexytopo by richsmith.

the class Space3DTransformerTest method testTransform1MEast.

@Test
public void testTransform1MEast() {
    Leg east1MLeg = new Leg(1, 90, 0);
    Coord3D result = transformer.transform(Coord3D.ORIGIN, east1MLeg);
    Coord3D expected = new Coord3D(1, 0, 0);
    assertEquals(expected, result);
}
Also used : Coord3D(org.hwyl.sexytopo.model.graph.Coord3D) Leg(org.hwyl.sexytopo.model.survey.Leg) Test(org.junit.Test)

Example 10 with Coord3D

use of org.hwyl.sexytopo.model.graph.Coord3D in project sexytopo by richsmith.

the class Space3DTransformerTest method testTransform2MNorth.

@Test
public void testTransform2MNorth() {
    Leg north2MLeg = new Leg(2, 0, 0);
    Coord3D result = transformer.transform(Coord3D.ORIGIN, north2MLeg);
    Coord3D expected = new Coord3D(0, 2, 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