Package gml4u.model

Examples of gml4u.model.Gml


    LOGGER.setLevel(Level.FINEST);
  }
 
  //TODO @Before
  public Gml createGml() {
    gml = new Gml(new Vec3D(480, 240, 60));
   
    GmlStroke stroke = new GmlStroke();
    stroke.addPoint(new GmlPoint(new Vec3D(0.1f, 0.35f, 0.25f), 0.01f, 1, new Vec3D(), new Vec3D()));
    stroke.addPoint(new GmlPoint(new Vec3D(0.85f, 0.35f, 0.25f), 0.02f, 1, new Vec3D(), new Vec3D()));
    stroke.addPoint(new GmlPoint(new Vec3D(0.85f, 0.95f, 0.70f), 0.03f, 1, new Vec3D(), new Vec3D()));
View Full Code Here


  }

  // Rotation from up -1,0,0 to up 0,-1,0
  @Test
  public void testReorientMinusX2MinusY() {
    Gml gml = createGml();
    gml.environment.up = new Vec3D(-1, 0, 0);

    AABB aabb = AABB.fromMinMax(new Vec3D(0.05f, 0.1f, 0.25f), new Vec3D(0.65f, 0.85f, 0.7f));

    GmlUtils.reorient(gml, true);
    LOGGER.log(Level.FINEST, "testMinusX2MinusY "+gml.getBoundingBox().getMin()+ " / " +gml.getBoundingBox().getMax());
    LOGGER.log(Level.FINEST, "Expected :"+aabb.getMin()+ " / "+ aabb.getMax());

    // Check min-max bounding box
    assertTrue("x=-1 to y=-1", aabb.equalsWithTolerance(gml.getBoundingBox(), 0.0000001f));
    assertTrue("up vector", gml.environment.up.equals(new Vec3D(0, -1, 0)));
  }
View Full Code Here

  }

  // Rotation from up 0,1,0 to up 0,-1,0
  @Test
  public void testReorientPlusY2MinusY() {
    Gml gml = createGml();
    gml.environment.up = new Vec3D(0, 1, 0);

    AABB aabb = AABB.fromMinMax(new Vec3D(0.15f, 0.05f, 0.7f), new Vec3D(0.9f, 0.65f, 0.25f));
   
    GmlUtils.reorient(gml, true);
    LOGGER.log(Level.FINEST, "testPlusY2MinusY "+gml.getBoundingBox().getMin()+ " / " +gml.getBoundingBox().getMax());
    LOGGER.log(Level.FINEST, "Expected :"+aabb.getMin()+ " / "+ aabb.getMax());
   
    // Check min-max bounding box
    assertTrue("y=1 to y=-1", aabb.equalsWithTolerance(gml.getBoundingBox(), 0.0000001f));
    assertTrue("up vector", gml.environment.up.equals(new Vec3D(0, -1, 0)));
  }
View Full Code Here

  }

  // Rotation from up 0,-1,0 to up 0,-1,0
  @Test
  public void testReorientMinusY2MinusY() {
    Gml gml = createGml();
    gml.environment.up = new Vec3D(0, -1, 0);

    AABB aabb = AABB.fromMinMax(new Vec3D(0.1f, 0.35f, 0.25f), new Vec3D(0.85f, 0.95f, 0.7f));

    GmlUtils.reorient(gml, true);
    LOGGER.log(Level.FINEST, "testMinusY2MinusY "+gml.getBoundingBox().getMin()+ " / " +gml.getBoundingBox().getMax());
    LOGGER.log(Level.FINEST, "Expected :"+aabb.getMin()+ " / "+ aabb.getMax());
   
    // Check min-max bounding box
    assertTrue("y=-1 to y=-1", aabb.equalsWithTolerance(gml.getBoundingBox(), 0.0000001f));
    assertTrue("up vector", gml.environment.up.equals(new Vec3D(0, -1, 0)));
 
View Full Code Here

 

  // Rotation from up 0,0,1 to up 0,-1,0
  @Test
  public void testReorientPlusZ2MinusY() {
    Gml gml = createGml();
    gml.environment.up = new Vec3D(0, 0, 1);

    AABB aabb = AABB.fromMinMax(new Vec3D(0.1f, 0.3f, 0.35f), new Vec3D(0.85f, 0.75f, 0.95f));

    GmlUtils.reorient(gml, true);
    LOGGER.log(Level.FINEST, "plusZ2MinusY "+gml.getBoundingBox().getMin()+ " / " +gml.getBoundingBox().getMax());
    LOGGER.log(Level.FINEST, "Expected :"+aabb.getMin()+ " / "+ aabb.getMax());

    // Check min-max bounding box
    assertTrue("z=1 to y=-1", aabb.equalsWithTolerance(gml.getBoundingBox(), 0.0000001f));
    assertTrue("up vector", gml.environment.up.equals(new Vec3D(0, -1, 0)));
  }
View Full Code Here

  }

  // Rotation from up 0,0,-1 to up 0,-1,0
  @Test
  public void testReorientMinusZ2MinusY() {
    Gml gml = createGml();
    gml.environment.up = new Vec3D(0, 0, -1);

    AABB aabb = AABB.fromMinMax(new Vec3D(0.15f, 0.25f, 0.35f), new Vec3D(0.9f, 0.7f, 0.95f));

    GmlUtils.reorient(gml, true);
    LOGGER.log(Level.FINEST, "testMinusZ2MinusY "+gml.getBoundingBox().getMin()+ " / " +gml.getBoundingBox().getMax());
    LOGGER.log(Level.FINEST, "Expected :"+aabb.getMin()+ " / "+ aabb.getMax());

    // Check min-max bounding box
    assertTrue("z=-1 to y=-1", aabb.equalsWithTolerance(gml.getBoundingBox(), 0.0000001f));
    assertTrue("up vector", gml.environment.up.equals(new Vec3D(0, -1, 0)));
  }
View Full Code Here

  
   */
 
  @Test
  public void testIsNormalizedLarger() {
    Gml gml = new Gml();

    GmlStroke stroke = new GmlStroke();
    stroke.addPoint(new GmlPoint(new Vec3D(-0.1f, -0.35f, -0.25f), 0.01f, 1, new Vec3D(), new Vec3D()));
    stroke.addPoint(new GmlPoint(new Vec3D(1.10f, 1.95f, 1.70f), 0.04f, 1, new Vec3D(), new Vec3D()));
    stroke.setLayer(0);
    gml.addStroke(stroke);

    assertTrue("not normalized (larger)", !GmlUtils.isNormalized(gml));
  }
View Full Code Here

    assertTrue("not normalized (larger)", !GmlUtils.isNormalized(gml));
  }
 
  @Test
  public void testIsNormalizedSmaller() {
    Gml gml = new Gml();

    GmlStroke stroke = new GmlStroke();
    stroke.addPoint(new GmlPoint(new Vec3D(0.1f, 0.35f, .25f), 0.01f, 1, new Vec3D(), new Vec3D()));
    stroke.addPoint(new GmlPoint(new Vec3D(.9f, .95f, .70f), 0.04f, 1, new Vec3D(), new Vec3D()));
    stroke.setLayer(0);
    gml.addStroke(stroke);

    assertTrue("not normalized (smaller)", !GmlUtils.isNormalized(gml));
  }
View Full Code Here

    assertTrue("not normalized (smaller)", !GmlUtils.isNormalized(gml));
  }

  @Test
  public void testIsNormalized() {
    Gml gml = new Gml();

    GmlStroke stroke = new GmlStroke();
    stroke.addPoint(new GmlPoint(new Vec3D(0.0000001f, 0.f, 0.f), 0.01f, 1, new Vec3D(), new Vec3D()));
    stroke.addPoint(new GmlPoint(new Vec3D(1f, 1f, 1.0000001f), 0.04f, 1, new Vec3D(), new Vec3D()));
    stroke.setLayer(0);
    gml.addStroke(stroke);

    assertTrue("normalized", GmlUtils.isNormalized(gml));
  }
View Full Code Here

   * normalizeAll tests
   *
   */

  public void testNormalizeAllLarger() {
    Gml gml = new Gml();

    GmlStroke stroke = new GmlStroke();
    stroke.addPoint(new GmlPoint(new Vec3D(-.2f, -.1f, -.5f), .01f, 1, new Vec3D(), new Vec3D()));
    stroke.addPoint(new GmlPoint(new Vec3D(.6f, .2f, .0f), .01f, 1, new Vec3D(), new Vec3D()));
    stroke.addPoint(new GmlPoint(new Vec3D(1.4f, 1.2f, 1.1f), .04f, 1, new Vec3D(), new Vec3D()));
    stroke.setLayer(0);
    gml.addStroke(stroke);
   
    GmlUtils.normalize(gml);
   

    assertTrue("bounds", GmlUtils.isNormalized(gml));
View Full Code Here

TOP

Related Classes of gml4u.model.Gml

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.