Examples of HullFace


Examples of jmt.engine.jaba.convexHull3d.HullFace

    float[] max = { 0.0f, 0.0f, 0.0f };
    float[] min = { 0.0f, 0.0f, 0.0f };

    int size = faces.size();
    for (int i = 0; i < size; i++) {
      HullFace face = faces.get(i);

      Vector4 normal = face.getNormal();
      HullEdge[] edges = face.getEdges();
      HullVertex[] vertices = face.getVertices();

      float facing = normal.dot(forward);
      boolean isVisible = (facing <= VISIBILITY_EPSILON);
      if (isVisible) {
        visibleFacesSet.add(face);
      } else {
        hiddenFacesSet.add(face);
      }
      face.setShade(facing);

      // Create unique and visibility sets
      for (int j = 0; j < edges.length; j++) {
        HullEdge e = edges[j];
        if (isVisible) {
View Full Code Here

Examples of jmt.engine.jaba.convexHull3d.HullFace

     * incrementaFaccia(faccia) Per ogni faccia faccia.marcata = false
     */

    // Reset vertex counters and marks
    for (int fi = 0; fi < hullFacesArray.length; fi++) {
      HullFace f = hullFacesArray[fi];
      f.setNumCoplanarVertices(0);
    }

    // Start propagating the number of vertices per face
    for (int vi = 0; vi < hullVerticesArray.length; vi++) {
      // Cleanup marked bits
      for (int fi = 0; fi < hullFacesArray.length; fi++) {
        HullFace f = hullFacesArray[fi];
        f.setMarked(false);
      }

      for (int fi = 0; fi < hullFacesArray.length; fi++) {
        HullVertex v = hullVerticesArray[vi].vertex;
        HullFace f = hullFacesArray[fi];

        // Start color propagation
        if (v.getID() == f.getVertex(0).getID()
            || v.getID() == f.getVertex(1).getID()
            || v.getID() == f.getVertex(2).getID()) {
          if (!f.isMarked()) {
            incrementFaceCounter(f);
          }
        }
      }
    }
View Full Code Here

Examples of jmt.engine.jaba.convexHull3d.HullFace

    face.setMarked(true);

    for (int ei = 0; ei < 3; ei++) {
      HullEdge e = face.getEdge(ei);
      for (int ai = 0; ai < 2; ai++) {
        HullFace adj = e.getFace(ai);
        /*
         * if ( face.volumeSign( adj.getVertex( 0 ) ) == 0 &&
         * face.volumeSign( adj.getVertex( 1 ) ) == 0 &&
         * face.volumeSign( adj.getVertex( 2 ) ) == 0 &&
         * !face.isMarked() ) { incrementFaceCounter( adj ); }
         */
        if (!adj.isMarked() && face.isCoplanar(adj)) {
          incrementFaceCounter(adj);
        }
      }
    }
  }
View Full Code Here

Examples of jmt.engine.jaba.convexHull3d.HullFace

    g.setFont(FONT);

    // Draw hidden faces
    if (enableHiddenFaces) {
      for (int i = 0; i < hiddenFacesArray.length; i++) {
        HullFace f = hiddenFacesArray[i];
        HullVertex v = f.getVertex(0);
        Vector4 worldPos = Vector4.createPoint3D(v.x(), v.y(), v.z());
        Vector4 screenPos = prj.project(worldPos);
        PointData p1 = new PointData(worldPos, screenPos, v);

        v = f.getVertex(1);
        worldPos = Vector4.createPoint3D(v.x(), v.y(), v.z());
        screenPos = prj.project(worldPos);
        PointData p2 = new PointData(worldPos, screenPos, v);

        v = f.getVertex(2);
        worldPos = Vector4.createPoint3D(v.x(), v.y(), v.z());
        screenPos = prj.project(worldPos);
        PointData p3 = new PointData(worldPos, screenPos, v);

        drawFace(g, p1, p2, p3, f);
      }
    }

    // Draw visible faces
    if (enableVisibleFaces) {
      for (int i = 0; i < visibleFacesArray.length; i++) {
        HullFace f = visibleFacesArray[i];
        HullVertex v = f.getVertex(0);
        Vector4 worldPos = Vector4.createPoint3D(v.x(), v.y(), v.z());
        Vector4 screenPos = prj.project(worldPos);
        PointData p1 = new PointData(worldPos, screenPos, v);

        v = f.getVertex(1);
        worldPos = Vector4.createPoint3D(v.x(), v.y(), v.z());
        screenPos = prj.project(worldPos);
        PointData p2 = new PointData(worldPos, screenPos, v);

        v = f.getVertex(2);
        worldPos = Vector4.createPoint3D(v.x(), v.y(), v.z());
        screenPos = prj.project(worldPos);
        PointData p3 = new PointData(worldPos, screenPos, v);

        drawFace(g, p1, p2, p3, f);
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.