Class DrawPolyhedronProcessing

java.lang.Object
Jcg.viewer.DrawSkeleton
Jcg.viewer.DrawMesh
Jcg.viewer.processing3d.DrawPolyhedronProcessing

public class DrawPolyhedronProcessing extends DrawMesh
Class for drawing a surface mesh (Polyhedron_3) in 3D, using a Processing PApplet
Author:
Luca Castelli Aleardi (INF562/555, 2012-20)
  • Field Details

    • view

      processing.core.PApplet view
      Processing (P3D) frame for rendering 3D objects (meshes, faces, edges, points, ...)
    • polyhedron3D

      public Polyhedron_3<Point_3> polyhedron3D
      the triangle mesh (to be rendered)
    • triangleSoup

      public Collection<Triangle_3> triangleSoup
      the triangle soup (to be rendered)
    • edgeColors

      public float[][] edgeColors
    • vertexNormals

      public float[][] vertexNormals
    • colors

      public Color[] colors
      a basic set of predefined colors for drawing faces, edges and vertices
  • Constructor Details

    • DrawPolyhedronProcessing

      public DrawPolyhedronProcessing(processing.core.PApplet view, Polyhedron_3<Point_3> polyhedron3D)
      Create a surface mesh
    • DrawPolyhedronProcessing

      public DrawPolyhedronProcessing(processing.core.PApplet view, String filename)
      Create a surface mesh from an OFF file
    • DrawPolyhedronProcessing

      public DrawPolyhedronProcessing(MeshViewerProcessing view, Polyhedron_3<Point_3> polyhedron3D, float[][] edgeColors)
      Create a surface mesh from a 3D polyhedron (3D surface mesh). Edges are endowed with colors (RGB format)
    • DrawPolyhedronProcessing

      public DrawPolyhedronProcessing(MeshViewerProcessing view, Collection<Triangle_3> triangles)
      Create a 3D triangle soup
  • Method Details

    • createColors

      public void createColors()
      Define a basic set of 13 colors for drawing edges, faces, vertices.
    • drawSegment

      public void drawSegment(Point_3 p, Point_3 q)
      Draw a segment between two points
      Specified by:
      drawSegment in class DrawSkeleton
    • drawNormal

      public void drawNormal(Point_3 p, float[] normal)
      Draw the vertex normal
    • drawSegment

      public void drawSegment(Point_3 p, Point_3 q, float[] color)
      Draw a segment between two points
    • drawVertex

      public void drawVertex(Point_3 p)
      Draw a vertex (as a small sphere)
      Specified by:
      drawVertex in class DrawSkeleton
    • drawTriangle

      public void drawTriangle(Point_3 p, Point_3 q, Point_3 r)
      Draw a triangle
      Specified by:
      drawTriangle in class DrawMesh
    • drawFace

      public void drawFace(Point_3[] f)
      Draw a (triangle or polygonal) face
      Specified by:
      drawFace in class DrawMesh
    • drawFace

      public void drawFace(Face<Point_3> f)
      Draw a (triangle or polygonal) face
    • drawFace

      public void drawFace(Face<Point_3> f, Color c)
      Draw a (triangle or polygonal) face of a Polyhedral surface
    • drawMesh

      public void drawMesh(int type)
      Draw the entire mesh
    • drawTriangleSoup

      public void drawTriangleSoup(int type)
      Draw the triangle soup
    • draw

      public void draw(int type)
      Draw the 3D scene
      Specified by:
      draw in class DrawSkeleton
      Parameters:
      type - indicates the rendering mode
    • computeScaleFactor

      public float computeScaleFactor()
      Compute the scale factor (depending on the max distance of the point set)
    • resetMeshColors

      public static void resetMeshColors(Polyhedron_3 mesh)
      Reset face/edge/vertex colors.
      Set the initial tag of all faces, edges and vertices to a given value (used for color rendering)