Examples of TriangleMesh


Examples of artofillusion.object.TriangleMesh

    }
  }

  public void reverseNormalsCommand()
  {
    TriangleMesh theMesh = (TriangleMesh) objInfo.getObject();
    setUndoRecord(new UndoRecord(this, false, UndoRecord.COPY_OBJECT, new Object [] {theMesh, theMesh.duplicate()}));
    theMesh.reverseNormals();
    objectChanged();
    updateImage();
  }
View Full Code Here

Examples of artofillusion.object.TriangleMesh

    updateImage();
  }

  void setSmoothingMethod(int method)
  {
    TriangleMesh theMesh = (TriangleMesh) objInfo.getObject();

    setUndoRecord(new UndoRecord(this, false, UndoRecord.COPY_OBJECT, new Object [] {theMesh, theMesh.duplicate()}));
    for (int i = 0; i < smoothItem.length; i++)
      smoothItem[i].setState(false);
    smoothItem[method].setState(true);
    theMesh.setSmoothingMethod(method);
    objectChanged();
    updateMenus();
    updateImage();
  }
View Full Code Here

Examples of artofillusion.object.TriangleMesh

      corresponding deltas for the unselected vertices according to the mesh tension. */
 
  public void adjustDeltas(Vec3 delta[])
  {
    int dist[] = getSelectionDistance(), count[] = new int [delta.length];
    TriangleMesh theMesh = (TriangleMesh) objInfo.getObject();
    TriangleMesh.Edge edge[] = theMesh.getEdges();
    int maxDistance = getTensionDistance();
    double tension = getMeshTension(), scale[] = new double [maxDistance+1];
   
    for (int i = 0; i < delta.length; i++)
      if (dist[i] != 0)
View Full Code Here

Examples of toxi.geom.mesh.TriangleMesh

      super(ID);
    }

    public void draw(PGraphics g, GmlStroke stroke, float scale, float minTime, float maxTime) {

      TriangleMesh mesh = buildMesh(stroke, minTime, maxTime);
      mesh.scale(scale);

      g.pushMatrix();
      g.pushStyle();

      // Style
View Full Code Here

Examples of toxi.geom.mesh.TriangleMesh

    }


    // TODO move that to an Helper
    private TriangleMesh buildMesh(GmlStroke stroke, float minTime, float maxTime) {
      TriangleMesh mesh = new TriangleMesh("");

      if (stroke.getPoints().size() > 0) { 

        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;

        prev.set(stroke.getPoints().get(0));

        float curPoint = 1;

        for (GmlPoint point: stroke.getPoints()) {
          if (point.time < minTime) continue;
          if (point.time > maxTime) break;
          pos.set(point);

          // use distance to previous point as target stroke weight
          //weight += (pos.distanceTo(prev)*4-weight)*0.1;
          weight = 0.025f;

          // define offset points for the triangle strip
          a.set(pos);
          b.set(pos);
          a.addSelf(0, weight, curPoint * .0005f);
          b.addSelf(0, -weight, curPoint * .0005f);

          if (!q.isZeroVector() && !p.isZeroVector()) {
            // add 2 faces to the mesh
            mesh.addFace(p, b, q);
            mesh.addFace(p, b, a);
          }

          // store current points for next iteration
          prev.set(pos);
          p.set(a);
          q.set(b);
          ++curPoint;
        }
      }
      mesh.computeVertexNormals();
      return mesh;
    }
View Full Code Here

Examples of toxi.geom.mesh.TriangleMesh

    }


    @Override
      public void draw(PGraphics g, GmlStroke stroke, float scale, float minTime, float maxTime) {
      TriangleMesh mesh = buildMesh(stroke, minTime, maxTime);
      mesh.scale(scale);

      g.pushMatrix();
      g.pushStyle();

      g.beginShape(PConstants.TRIANGLES);
View Full Code Here

Examples of toxi.geom.mesh.TriangleMesh

      g.popMatrix();
    }

    // TODO move that to an Helper
    private TriangleMesh buildMesh(GmlStroke stroke, float minTime, float maxTime) {
      TriangleMesh mesh = new TriangleMesh("");

      if (stroke.getPoints().size() > 0) { 

        GmlPoint pos = new GmlPoint();
        Vec3D a = new Vec3D();
        Vec3D b = new Vec3D();
        Vec3D p = new Vec3D();
        Vec3D q = new Vec3D();
        float weight = 0.25f;

        float curPoint = 1;

        for (GmlPoint point: stroke.getPoints()) {
          if (point.time < minTime) continue;
          if (point.time > maxTime) break;

          pos.set(point);

          // define offset points for the triangle strip
          a.set(pos);
          b.set(pos);

          float angle = point.rotation.z;

          Vec3D aShift = new Vec3D(weight/2 * (float) Math.sin(Math.PI * angle - .25f), weight/2 * (float) Math.cos(Math.PI * angle - .25f), (curPoint+1) * .0005f);
          Vec3D bShift = new Vec3D(weight/2 * (float) Math.sin(Math.PI * angle + .25f), weight/2 * (float) Math.cos(Math.PI * angle + .25f), (curPoint+1) * .0005f);

          a.addSelf(aShift);
          b.addSelf(bShift);

          if (!q.isZeroVector() && !p.isZeroVector()) {
            // add 2 faces to the mesh
            mesh.addFace(p, b, q);
            mesh.addFace(p, b, a);
          }

          // store current points for next iteration
          p.set(a);
          q.set(b);
          ++curPoint;
        }
      }
      mesh.computeVertexNormals();
      return mesh;
    }
View Full Code Here

Examples of toxi.geom.mesh.TriangleMesh

    super(ID);
  }

  public void draw(PGraphics g, GmlStroke stroke, float scale, float minTime, float maxTime) {

    TriangleMesh mesh = buildMesh(stroke, minTime, maxTime);
    mesh.scale(scale);

    g.pushMatrix();
    g.pushStyle();

    // Style
View Full Code Here

Examples of toxi.geom.mesh.TriangleMesh

  }


  // TODO move that to an Helper
  private static TriangleMesh buildMesh(GmlStroke stroke, float minTime, float maxTime) {
    TriangleMesh mesh = new TriangleMesh("");

    if (stroke.getPoints().size() > 0) { 

      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;

      prev.set(stroke.getPoints().get(0));

      for (GmlPoint point: stroke.getPoints()) {
        if (point.time < minTime) continue;
        if (point.time > maxTime) break;
        pos.set(point);

        // use distance to previous point as target stroke weight
        weight += (pos.distanceTo(prev)*4-weight)*0.1;

        // define offset points for the triangle strip
        a.set(pos);
        b.set(pos);
        a.addSelf(0, 0, weight);
        b.addSelf(0, 0, -weight);

        // add 2 faces to the mesh
        mesh.addFace(p,b,q);
        mesh.addFace(p, b, a);

        // store current points for next iteration
        prev.set(pos);
        p.set(a);
        q.set(b);
     
    }
    mesh.computeVertexNormals();
    return mesh;
  }
View Full Code Here

Examples of toxi.geom.mesh.TriangleMesh

    }

    public Mesh3D createControlMesh(Mesh3D mesh) {
        Vec3D[] prev = null;
        if (mesh == null) {
            mesh = new TriangleMesh();
        }
        int resU = surf.getControlNet().uLength();
        int resV = surf.getControlNet().vLength();
        Vec2D dUV = maxUV.scale(1f / resU, 1f / resV);
        for (int u = 0; u < resU; u++) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.