Package toxi.geom

Examples of toxi.geom.Vec3D


  // 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 testIsUpValidTwoPlusOnes() {
    Vec3D v = new Vec3D(1, 1, 0);
    boolean result = false;
    assertTrue("invalid up", result == GmlUtils.isUpValid(v));   
  }
View Full Code Here

    boolean result = false;
    assertTrue("invalid up", result == GmlUtils.isUpValid(v));   
  }

  public void testIsUpValidTwoMinusOnes() {
    Vec3D v = new Vec3D(0, -1, -1);
    boolean result = false;
    assertTrue("invalid up", result == GmlUtils.isUpValid(v));   
  }
View Full Code Here

    boolean result = false;
    assertTrue("invalid up", result == GmlUtils.isUpValid(v));   
  }

  public void testIsUpValidTwoMinusOnePlusOne() {
    Vec3D v = new Vec3D(0, -1, 1);
    boolean result = false;
    assertTrue("invalid up", result == GmlUtils.isUpValid(v));   
  }
View Full Code Here

    assertTrue("invalid up", result == GmlUtils.isUpValid(v));   
  }

  @Test
  public void testIsUpValidNoOnes() {
    Vec3D v = new Vec3D(0, 0, 0);
    boolean result = false;
    assertTrue("invalid up", result == GmlUtils.isUpValid(v));       
  }
View Full Code Here

    assertTrue("invalid up", result == GmlUtils.isUpValid(v));       
  }

  @Test
  public void testIsUpValidPlusOne() {
    Vec3D v = new Vec3D(1, 0, 0);
    boolean result = true;
    assertTrue("valid up", result == GmlUtils.isUpValid(v));       
  }
View Full Code Here

    assertTrue("valid up", result == GmlUtils.isUpValid(v));       
  }

  @Test
  public void testIsUpValidMinusOne() {
    Vec3D v = new Vec3D(0, -1, 0);
    boolean result = true;
    assertTrue("valid up", result == GmlUtils.isUpValid(v));       
  }
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

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.