Class Triangle3D

java.lang.Object
edu.cnu.mdi.mdi3D.item3D.Item3D
edu.cnu.mdi.mdi3D.item3D.Triangle3D

public class Triangle3D extends Item3D
A single filled (and optionally framed) triangle, defined by three vertices in world coordinates.
  • Field Details

    • _coords

      protected float[] _coords
    • _frame

      protected boolean _frame
  • Constructor Details

    • Triangle3D

      public Triangle3D(Panel3D panel3d, float[] coords, Color color, float lineWidth, boolean frame)
      Create a triangle from an array of coordinates
      Parameters:
      panel3d - the owner panel
      coords - the coordinates [x1, y1, ..., y3, z3]
      color - the triangle color
      lineWidth - the line width
      frame - frame the triangle
    • Triangle3D

      public Triangle3D(Panel3D panel3d, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, Color color, float lineWidth, boolean frame)
      Create a triangle from nine explicit coordinates
      Parameters:
      panel3d - the owner panel
      x1 -
      y1 -
      z1 -
      x2 -
      y2 -
      z2 -
      x3 -
      y3 -
      z3 -
      color - the triangle color
      lineWidth - the line width
      frame - frame the triangle
  • Method Details

    • draw

      public void draw(com.jogamp.opengl.GLAutoDrawable drawable)
      Description copied from class: Item3D
      The custom drawing method
      Specified by:
      draw in class Item3D
      Parameters:
      drawable - the OpenGL drawable
    • getSortPoint

      public float[] getSortPoint()
      Description copied from class: Item3D
      A representative point for transparent sorting, in world coordinates. Default is origin. Override in items with a natural center (Sphere, Cube, Cylinder, etc.).
      Overrides:
      getSortPoint in class Item3D
      Returns:
      the sort point as [x, y, z]