Esempio n. 1
0
  @Test
  public void testSplitBounds() {
    List<IStellar> stellars = new LinkedList<IStellar>();
    stellars.add(start);
    stellars.add(end);

    IBoundingBox box = BoundingBox.newInstance(stellars);
    SplitDegree splitDegree = box.splitDegree();
    IBoundingBox[] splitted = new IBoundingBox[splitDegree.value()];
    for (IOffset offset : splitDegree.offsets()) {
      splitted[offset.offsetIndex()] = (IBoundingBox) box.onSplit(ctx, offset);
    }

    IBoundingBox frontBottomLeft = splitted[0];
    IBoundingBox frontBottomRight = splitted[1];
    IBoundingBox frontTopLeft = splitted[2];
    IBoundingBox frontTopRight = splitted[3];
    IBoundingBox rearBottomLeft = splitted[4];
    IBoundingBox rearBottomRight = splitted[5];
    IBoundingBox rearTopLeft = splitted[6];
    IBoundingBox rearTopRight = splitted[7];

    assertEquals(new Location(-5, -5, -5, DistanceUnit.LIGHT_YEAR), frontBottomLeft.center());
    assertEquals(5, frontBottomLeft.radius(), 0);
    assertEquals(new Location(5, -5, -5, DistanceUnit.LIGHT_YEAR), frontBottomRight.center());
    assertEquals(new Location(-5, 5, -5, DistanceUnit.LIGHT_YEAR), frontTopLeft.center());
    assertEquals(new Location(5, 5, -5, DistanceUnit.LIGHT_YEAR), frontTopRight.center());
    assertEquals(new Location(-5, -5, 5, DistanceUnit.LIGHT_YEAR), rearBottomLeft.center());
    assertEquals(new Location(5, -5, 5, DistanceUnit.LIGHT_YEAR), rearBottomRight.center());
    assertEquals(new Location(-5, 5, 5, DistanceUnit.LIGHT_YEAR), rearTopLeft.center());
    assertEquals(new Location(5, 5, 5, DistanceUnit.LIGHT_YEAR), rearTopRight.center());
  }
Esempio n. 2
0
  @Test
  public void testStellarBounds() {
    List<IStellar> stellars = new LinkedList<IStellar>();
    stellars.add(start);
    stellars.add(end);

    IBoundingBox box = BoundingBox.newInstance(stellars);

    assertEquals(new Location(0, 0, 0, DistanceUnit.LIGHT_YEAR), box.center());
    assertEquals(10, box.radius(), 0);
  }