Package toxi.geom

Examples of toxi.geom.Vec3D


  @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


  @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

  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));
    assertTrue("origin", gml.environment.originalOriginShift.equalsWithTolerance(new Vec3D(-.2f, -.1f, -.5f), 0.0000001f));
    assertTrue("aspect ratio", gml.environment.originalAspectRatio.equalsWithTolerance(new Vec3D(1.6000001f, 1.3000001f, 1.6f), .0000001f));
   
    assertTrue("normalized origin", gml.environment.normalizedOriginShift.equalsWithTolerance(new Vec3D(-0.12499998f, -0.06250001f, -0.31249997f), .000001f));
    assertTrue("normalized aspect ratio", gml.environment.normalizedAspectRatio.equalsWithTolerance(new Vec3D(1f, 0.81249994f, 1f), .0000001f));
  }
View Full Code Here

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

    GmlStroke stroke = new GmlStroke();
    stroke.addPoint(new GmlPoint(new Vec3D(.2f, .1f, .25f), .01f, 1, new Vec3D(), new Vec3D()));
    stroke.addPoint(new GmlPoint(new Vec3D(.6f, .2f, .3f), .01f, 1, new Vec3D(), new Vec3D()));
    stroke.addPoint(new GmlPoint(new Vec3D(.9f, .8f, .8f), .04f, 1, new Vec3D(), new Vec3D()));
    stroke.setLayer(0);
    gml.addStroke(stroke);
   
    GmlUtils.normalize(gml);

    assertTrue("bounds", GmlUtils.isNormalized(gml));
    assertTrue("origin", gml.environment.originalOriginShift.equalsWithTolerance(new Vec3D(.2f, .1f, .25f), 0.0000001f));
    assertTrue("aspect ratio", gml.environment.originalAspectRatio.equalsWithTolerance(new Vec3D(.7f, 0.7f, .55f), .0000001f));
   
    assertTrue("normalized origin", gml.environment.normalizedOriginShift.equalsWithTolerance(new Vec3D(0.2857143f, 0.14285715f, 0.3571429f), .000001f));
    assertTrue("normalized aspect ratio", gml.environment.normalizedAspectRatio.equalsWithTolerance(new Vec3D(1f, 1f, 0.7857143f), .0000001f));
  }
View Full Code Here

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

    GmlStroke stroke = new GmlStroke();
    stroke.addPoint(new GmlPoint(new Vec3D(.2f, .1f, .25f), .01f, 1, new Vec3D(), new Vec3D()));
    stroke.addPoint(new GmlPoint(new Vec3D(.6f, .2f, .3f), .01f, 1, new Vec3D(), new Vec3D()));
    stroke.addPoint(new GmlPoint(new Vec3D(1.3f, 1.25f, 1.8f), .04f, 1, new Vec3D(), new Vec3D()));
    stroke.setLayer(0);
    gml.addStroke(stroke);
   
    GmlUtils.normalize(gml);
   
    assertTrue("bounds", GmlUtils.isNormalized(gml));
    assertTrue("origin", gml.environment.originalOriginShift.equalsWithTolerance(new Vec3D(0.19999999f, 0.100000024f, .25f), 0.000001f));
    assertTrue("aspect ratio", gml.environment.originalAspectRatio.equalsWithTolerance(new Vec3D(1.0999999f, 1.15f, 1.55f), .0000001f));
   
    assertTrue("normalized origin", gml.environment.normalizedOriginShift.equalsWithTolerance(new Vec3D(0.12903225f, 0.06451615f, 0.16129033f), .000001f));
    assertTrue("normalized aspect ratio", gml.environment.normalizedAspectRatio.equalsWithTolerance(new Vec3D(0.7096774f, 0.7419355f, 1f), .0000001f));
  }
View Full Code Here

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

    GmlStroke stroke = new GmlStroke();
    stroke.addPoint(new GmlPoint(new Vec3D(-.2f, -.1f, -.25f), .01f, 1, new Vec3D(), new Vec3D()));
    stroke.addPoint(new GmlPoint(new Vec3D(.6f, .2f, .3f), .01f, 1, new Vec3D(), new Vec3D()));
    stroke.addPoint(new GmlPoint(new Vec3D(.7f, .7f, .6f), .04f, 1, new Vec3D(), new Vec3D()));
    stroke.setLayer(0);
    gml.addStroke(stroke);
   
    GmlUtils.normalize(gml);
   
    assertTrue("bounds", GmlUtils.isNormalized(gml));
    assertTrue("origin", gml.environment.originalOriginShift.equalsWithTolerance(new Vec3D(-.2f, -.1f, -.25f), 0.0000001f));
    assertTrue("aspect ratio", gml.environment.originalAspectRatio.equalsWithTolerance(new Vec3D(.9f, 0.8000001f, .85f), .0000001f));
   
    assertTrue("normalized origin", gml.environment.normalizedOriginShift.equalsWithTolerance(new Vec3D(-0.22222224f, -0.11111111f, -0.2777778f), .000001f));
    assertTrue("normalized aspect ratio", gml.environment.normalizedAspectRatio.equalsWithTolerance(new Vec3D(1f, 0.888889f, .94444454f), .0000001f));
  }
View Full Code Here

   *
   */
 
  @Test
  public void testGetSmallestAxisSizeX() {
    float size = Vec3DUtils.getSmallestAxisSize(new Vec3D(.1f, .2f, .3f));
    assertTrue("x is the smallest", size == .1f);
  }
View Full Code Here

    assertTrue("x is the smallest", size == .1f);
  }

  @Test
  public void testGetSmallestAxisSizeY() {
    float size = Vec3DUtils.getSmallestAxisSize(new Vec3D(.2f, .1f, .3f));
    assertTrue("y is the smallest", size == .1f);
  }
View Full Code Here

    assertTrue("y is the smallest", size == .1f);
  }

  @Test
  public void testGetSmallestAxisSizeZ() {
    float size = Vec3DUtils.getSmallestAxisSize(new Vec3D(.2f, .3f, .1f));
    assertTrue("z is the smallest", size == .1f);
  }
View Full Code Here

   * Longest axis size tests
   *
   */
  @Test
  public void testGetLongestAxisSizeX() {
    float size = Vec3DUtils.getLongestAxisSize(new Vec3D(.3f, .2f, .1f));
    assertTrue("x is the longest", size == .3f);
  }
View Full Code Here

TOP

Related Classes of toxi.geom.Vec3D

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.