Class AbstractDrawable3DObject

java.lang.Object
org.scilab.forge.scirenderer.implementation.g2d.motor.AbstractDrawable3DObject
Direct Known Subclasses:
ConvexObject

public abstract class AbstractDrawable3DObject extends Object
Author:
Calixte DENIZET
  • Field Details

    • PRECISION

      public static final double PRECISION
      See Also:
    • vertices

      protected final Vector3d[] vertices
    • colors

      protected final Color[] colors
    • precedence

      protected int precedence
    • is2d

      protected Boolean is2d
    • zindex

      protected Double zindex
    • v0

      protected Vector3d v0
    • v1

      protected Vector3d v1
    • v0v1

      protected Vector3d v0v1
    • nv0v1

      protected double nv0v1
    • normal

      protected Vector3d normal
    • bbox

      protected BoundingBox bbox
    • marked

      protected boolean marked
    • marked2

      protected boolean marked2
    • degenerated

      protected Boolean degenerated
  • Constructor Details

  • Method Details

    • isMonochromatic

      public static boolean isMonochromatic(Color[] colors)
      Test if an array of colors contains only one color or not
      Parameters:
      colors - the colors array
      Returns:
      true if the array is monochromatic
    • draw

      public abstract void draw(Graphics2D g2d)
      Draw this object on a Graphics2D object
      Parameters:
      g2d - the Graphics2d object where to draw
    • resetDefaultPrecedence

      public static void resetDefaultPrecedence()
      Reset the default precedence
    • setPrecedence

      public void setPrecedence(int precedence)
      Set the precedence of this object.
      Parameters:
      precedence - the precedence of this object
    • getPrecedence

      public int getPrecedence()
      Get the precedence of this object, i.e. its position in the list of the draw objects. The first object has a precedence of 0, the second has a precedence of 1, ...
      Parameters:
      the - precedence
    • is2D

      public boolean is2D()
      Determinates if this object is 2D in looking at the z coordinates (when all the drawn objects are 2D, we can avoid the projection)
    • getProvidedNormal

      public Vector3d getProvidedNormal()
      Get the normal vector. If no normal vector has been set then it is calculated in using the cross product of the first two vectors.
      Returns:
      the normal vector.
    • getNormal

      public Vector3d getNormal()
      Get the normal vector. If no normal vector has been set then it is calculated in using the cross product of the first two vectors.
      Returns:
      the normal vector.
    • setNormal

      protected void setNormal()
      Set the normal vector
    • isPlanar

      protected boolean isPlanar()
      Determinates if the object is contained into a plane
      Returns:
      true if the object is planar
    • isBehind

      public int isBehind(Vector3d v, double a)
    • isBehind

      public static boolean isBehind(Vector3d M, Vector3d v, double a)
    • getProjectedPolyLine

      protected Path2D getProjectedPolyLine()
      Get the projected polyline of this object
      Returns:
      a path 2D
    • getProjectedContour

      protected Path2D getProjectedContour()
      Get the projected contour (i.e. a closed polyline) of this object
      Returns:
      a path 2D
    • isNull

      protected static final boolean isNull(double d)
      Parameters:
      d - a number
      Returns:
      true if d is near zero
    • isPositiveOrNull

      protected static final boolean isPositiveOrNull(double d)
      Parameters:
      d - a number
      Returns:
      true if d is greater than zero
    • isNegativeOrNull

      protected static final boolean isNegativeOrNull(double d)
      Parameters:
      d - a number
      Returns:
      true if d is greater than zero
    • isGreaterOrEqual

      protected static final boolean isGreaterOrEqual(double d1, double d2)
      Parameters:
      d1 - a number
      d2 - a number
      Returns:
      true if d1 is greater than d2
    • isLowerOrEqual

      protected static final boolean isLowerOrEqual(double d1, double d2)
      Parameters:
      d1 - a number
      d2 - a number
      Returns:
      true if d1 is lower than d2
    • isEqual

      protected static final boolean isEqual(double d1, double d2)
      Parameters:
      d1 - a number
      d2 - a number
      Returns:
      true if d1 is equal to d2
    • minmax3D

      protected static final double[] minmax3D(AbstractDrawable3DObject o, Vector3d v)
      Get min-max of the projections of the vertices of o on v
      Parameters:
      o - an object
      v - a vector
      Returns:
      an array of size 2 containing min-max.
    • minmax2D

      protected static final double[] minmax2D(AbstractDrawable3DObject o, double x, double y)
      Get min-max of the projections of the vertices of o on v
      Parameters:
      o - an object
      v - a vector
      Returns:
      an array of size 2 containing min-max.
    • getColorsBarycenter

      protected static final Color getColorsBarycenter(Color c1, Color c2, double w1, double w2)
    • isDegenerate

      protected boolean isDegenerate()
      Returns:
      true if there are two vertices which are indentical
    • isNanOrInf

      protected boolean isNanOrInf()
    • isNanOrInf

      public static final boolean isNanOrInf(Vector3d v)