Package org.mt4j.util.math

Examples of org.mt4j.util.math.Vertex


  /**
   * Center the object and make it (-1,-1,-1) to (1,1,1).
   */
  private void resize() {
    int i, j;
    Vertex cur_vtx = new Vertex();
    float biggest_dif;

    Vertex[] limit = getLimits();

    // Move object so it's centered on (0,0,0)
    Vector3D offset = new Vector3D(-0.5f * (limit[0].x + limit[1].x),
        -0.5f * (limit[0].y + limit[1].y),
        -0.5f * (limit[0].z + limit[1].z));

    if ((DEBUG & 64) != 0) {
      System.out.println("Offset amount: (" +
          offset.x + "," + offset.y + "," + offset.z + ")");
    }

    // Find the divide-by value for the normalization
    biggest_dif = limit[1].x - limit[0].x;
    if (biggest_dif < limit[1].y - limit[0].y)
      biggest_dif = limit[1].y - limit[0].y;
    if (biggest_dif < limit[1].z - limit[0].z)
      biggest_dif = limit[1].z - limit[0].z;
    biggest_dif /= 2.0f;

    for (i = 0 ; i < coordList.size() ; i++) {

      cur_vtx = (Vertex)coordList.get(i);

//      cur_vtx.add(cur_vtx, offset);
      Vector3D tmp = cur_vtx.getAdded(offset);
      cur_vtx = new Vertex(tmp.x,tmp.y,tmp.z);
     
//      Vector3D tmp = new Vector3D(offset);
//      cur_vtx.addLocal(tmp);
//      cur_vtx.addLocal(cur_vtx);

View Full Code Here


      }
     
      for (int i = 0; i < faces.size(); i++) {
        AFace currentFace = faces.get(i);
       
        Vertex v0 = allFileVerts.get(currentFace.p0);
        Vertex v1 = allFileVerts.get(currentFace.p1);
        Vertex v2 = allFileVerts.get(currentFace.p2);
       
        if allTexCoords.size() > currentFace.t0
          &&   allTexCoords.size() > currentFace.t1
          &&   allTexCoords.size() > currentFace.t2
        ){
          float[] texV0 = allTexCoords.get(currentFace.t0);
          float[] texV1 = allTexCoords.get(currentFace.t1);
          float[] texV2 = allTexCoords.get(currentFace.t2);
         
          //Etwas redundant immer wieder zu machen beim gleichen vertex..whatever
          v0.setTexCoordU(texV0[0]);
          v0.setTexCoordV(texV0[1]);
         
          v1.setTexCoordU(texV1[0]);
          v1.setTexCoordV(texV1[1]);
         
          v2.setTexCoordU(texV2[0]);
          v2.setTexCoordV(texV2[1]);
         
          //Check if there is a texture index in the hashtable at the faces texture pointer
          //if not, create a new index = the end of thexcoords list, and put the pointer into the hash
          //if yes, point the faces texture pointer to the pointer in the hash
         
View Full Code Here

      Vertex[] currentSplitPathArr = (Vertex[])currentSubPath.toArray(new Vertex[currentSubPath.size()]);
      subPaths.add(currentSplitPathArr);
      currentSubPath.clear();
    }

    Vertex moveTo = new Vertex(x,y,0);
    pathPoints.add(moveTo);
    currentSubPath.add(moveTo);
    reverseMoveToStack.push((Vertex)moveTo.getCopy());
  }
View Full Code Here

      Vertex[] currentSplitPathArr = (Vertex[])currentSubPath.toArray(new Vertex[currentSubPath.size()]);
      subPaths.add(currentSplitPathArr);
      currentSubPath.clear();
    }
   
    Vertex moveTo;
    if (!pathPoints.isEmpty() && pathPoints.getLast() != null){
      moveTo = new Vertex(pathPoints.getLast().getX() + x, pathPoints.getLast().getY() + y, 0);
    }else{
      moveTo = new Vertex(x, y, 0);
    }
    pathPoints.add(moveTo);
    currentSubPath.add(moveTo);
    reverseMoveToStack.push((Vertex)moveTo.getCopy());
  }
View Full Code Here

   */
  public void arcAbs(float rx, float ry, float phi, boolean large_arc, boolean sweep, float x, float y) throws ParseException {
    if (verbose)
      System.out.println("arcAbs: " + rx + " " + ry + " " + phi + " " + large_arc + " "  + sweep + " " + x + " " + y);
   
    Vertex lastPoint = pathPoints.getLast();
    List<Vertex> arcVertices = ToolsGeometry.arcTo(lastPoint.x, lastPoint.y, rx, ry, phi, large_arc, sweep, x, y, 40);
   
    //Prevent odd picking behavour, in which the normal is
    //not correctly computed, because the 2 points are the same
    if (!arcVertices.isEmpty()
View Full Code Here

   */
  public void arcRel(float rx, float ry, float phi, boolean large_arc, boolean sweep, float x, float y) throws ParseException {
    if (verbose)
      System.out.println("arcRel: " + rx + " " + ry + " " + phi + " " + large_arc + " "  + sweep + " " + x + " " + y);
   
    Vertex lastPoint = pathPoints.getLast();
    List<Vertex> arcVertices = ToolsGeometry.arcTo(lastPoint.x, lastPoint.y, rx, ry, phi, large_arc, sweep, lastPoint.x+x, lastPoint.y+y, 40);
   
    //Prevent odd picking behavour, in which the normal is
    //not correctly computed, because the 2 points are the same
    if (!arcVertices.isEmpty()
View Full Code Here

   */
  public void linetoAbs(float x, float y) throws ParseException {
    if (verbose)
      System.out.println("linetoAbs x:" + x + " y:" + y);

    Vertex vert = new Vertex(x,y,0);
    pathPoints.add(vert);
    currentSubPath.add(vert);
  }
View Full Code Here

   */
  public void linetoRel(float x, float y) throws ParseException {
    if (verbose)
      System.out.println("linetoRel: " + x + "," + y);
   
    Vertex vert = new Vertex(pathPoints.getLast().getX() + x, pathPoints.getLast().getY() + y, 0);
    pathPoints.add(vert);
    currentSubPath.add(vert);
  }
View Full Code Here

   */
  public void linetoHorizontalAbs(float x) throws ParseException {
    if (verbose)
      System.out.println("linetoHorizontalAbs x:" + x);

    Vertex vert = new Vertex(x, pathPoints.getLast().getY(), 0);
    pathPoints.add(vert);
    currentSubPath.add(vert);
  }
View Full Code Here

   */
  public void linetoHorizontalRel(float x) throws ParseException {
    if (verbose)
      System.out.println("linetoHorizontalRel: " + x);

    Vertex vert = new Vertex(pathPoints.getLast().getX() + x, pathPoints.getLast().getY(), 0);
    pathPoints.add(vert);
    currentSubPath.add(vert);
  }
View Full Code Here

TOP

Related Classes of org.mt4j.util.math.Vertex

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.