Package gml4u.model

Examples of gml4u.model.GmlStroke


 
  //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);

    assertTrue("bounds", GmlUtils.isNormalized(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);
   
    assertTrue("bounds", GmlUtils.isNormalized(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);
   
    assertTrue("bounds", GmlUtils.isNormalized(gml));
View Full Code Here

   * @param brush - GmlBrush
   */
  public void beginStroke(int sessionID, int layer, final GmlBrush brush) {
   
    LOGGER.log(Level.FINEST, "Start recording");
    GmlStroke stroke = new GmlStroke();
    stroke.setLayer(layer);
    stroke.setBrush(brush)
    strokes.put(sessionID, stroke);
  }
View Full Code Here

   * Ends recording of a GmlStroke
   * @param sessionID - int
   */
  public void endStroke(int sessionID) {
    LOGGER.log(Level.FINEST, "Stop recording");
    GmlStroke stroke = strokes.get(sessionID);
    // Add the stroke only if significant (at least a certain length)
    if (null != stroke && stroke.getLength() > minStrokeLength) {
      gml.addStroke(stroke);
    }
    strokes.remove(sessionID);
  }
View Full Code Here

TOP

Related Classes of gml4u.model.GmlStroke

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.