Exemplo n.º 1
0
 /** Constructor create an instance of a light, set it to on, color to null, from.z = 1.0 */
 public Light(int num) {
   number = num % 8;
   on = true;
   from = new PointType();
   to = new PointType();
   from.z = 1000.0F;
   color = null;
 }
Exemplo n.º 2
0
  @Test
  public void testDistance() {
    PointType pointParis = new PointType("48.8566140,2.3522219");

    assertEquals(2.3522219, pointParis.getLongitude().doubleValue(), 0.0000001);
    assertEquals(48.856614, pointParis.getLatitude().doubleValue(), 0.0000001);

    PointType pointBerlin = new PointType("52.5200066,13.4049540");

    LocationItem locationParis = new LocationItem("paris");
    locationParis.setState(pointParis);
    LocationItem locationBerlin = new LocationItem("berlin");
    locationBerlin.setState(pointBerlin);

    DecimalType distance = locationParis.distanceFrom(pointParis);
    assertEquals(0, distance.intValue());

    double parisBerlin = locationParis.distanceFrom(pointBerlin).doubleValue();
    assertEquals(878400, 50, parisBerlin);

    double gravParis = pointParis.getGravity().doubleValue();
    assertEquals(gravParis, 9.809, 0.001);

    // Check canonization of position
    PointType point3 = new PointType("-100,200");
    double lat3 = point3.getLatitude().doubleValue();
    double lon3 = point3.getLongitude().doubleValue();
    assertTrue(lat3 > -90);
    assertTrue(lat3 < 90);
    assertTrue(lon3 < 180);
    assertTrue(lon3 > -180);
  }
Exemplo n.º 3
0
 public void translate(double x, double y, double z) {
   position.x += x;
   position.y += y;
   position.z += z;
 }
Exemplo n.º 4
0
 public void translate(float x, float y, float z) {
   position.x += x;
   position.y += y;
   position.z += z;
 }
Exemplo n.º 5
0
 @Override
 public String toString() {
   return "" + type.toString() + " (" + this.x + ", " + this.y + ") : " + type.toString();
 }