Package gml4u.model

Examples of gml4u.model.GmlPoint


  //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()));
    stroke.addPoint(new GmlPoint(new Vec3D(0.10f, 0.95f, 0.70f), 0.04f, 1, new Vec3D(), new Vec3D()));
    stroke.setLayer(0);
    gml.addStroke(stroke);
    return gml;
  }
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

  @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);
   
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);
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);
   
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);
   
View Full Code Here

   */
  public static void updateMesh(TriangleMesh mesh, List<GmlPoint> points) {

    mesh.clear();

    GmlPoint prev = new GmlPoint();
    GmlPoint pos = new GmlPoint();
    Vec3D a = new Vec3D();
    Vec3D b = new Vec3D();
    Vec3D p=new Vec3D();
    Vec3D q=new Vec3D();
    float weight = 0;

    for (GmlPoint point: points) {
      if (prev.isZeroVector()) {
        prev.set(point);
      }
      pos.set(point);
      // use distance to previous point as target stroke weight
      weight += (Math.sqrt(pos.distanceTo(prev))*2-weight)*0.1;

      /*weight = 0;
      if(pos.time- prev.time != 0) {
        weight = pos.distanceTo(prev);
      }*/
 
View Full Code Here

      //if (point.y != point.y) point.y = 0;
      //if (point.z != point.z) point.z = 0;
      //}

      for(int i=0; i<points.size(); i++) {
        GmlPoint p = points.get(i);
        p.subSelf(originShift);
        p.scaleSelf(scaling);

        // Fix NaN
        if (p.x != p.x || p.y != p.y || p.z != p.z) {
          points.remove(i);
        }
View Full Code Here

TOP

Related Classes of gml4u.model.GmlPoint

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.