Class AbstractDrawable3DObject
java.lang.Object
org.scilab.forge.scirenderer.implementation.g2d.motor.AbstractDrawable3DObject
- Direct Known Subclasses:
ConvexObject
- Author:
- Calixte DENIZET
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BoundingBox
protected final Color[]
protected Boolean
protected Boolean
protected boolean
protected boolean
protected Vector3d
protected double
protected int
static final double
protected Vector3d
protected Vector3d
protected Vector3d
protected final Vector3d[]
protected Double
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractDrawable3DObject
(Vector3d[] vertices, Color[] colors) Default constructor -
Method Summary
Modifier and TypeMethodDescriptionabstract void
draw
(Graphics2D g2d) Draw this object on a Graphics2D objectprotected static final Color
getColorsBarycenter
(Color c1, Color c2, double w1, double w2) Get the normal vector.int
Get the precedence of this object, i.e.protected Path2D
Get the projected contour (i.e.protected Path2D
Get the projected polyline of this objectGet the normal vector.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)int
static boolean
protected boolean
protected static final boolean
isEqual
(double d1, double d2) protected static final boolean
isGreaterOrEqual
(double d1, double d2) protected static final boolean
isLowerOrEqual
(double d1, double d2) static boolean
isMonochromatic
(Color[] colors) Test if an array of colors contains only one color or notprotected boolean
static final boolean
protected static final boolean
isNegativeOrNull
(double d) protected static final boolean
isNull
(double d) protected boolean
isPlanar()
Determinates if the object is contained into a planeprotected static final boolean
isPositiveOrNull
(double d) protected static final double[]
minmax2D
(AbstractDrawable3DObject o, double x, double y) Get min-max of the projections of the vertices of o on vprotected static final double[]
Get min-max of the projections of the vertices of o on vstatic void
Reset the default precedenceprotected void
Set the normal vectorvoid
setPrecedence
(int precedence) Set the precedence of this object.
-
Field Details
-
PRECISION
public static final double PRECISION- See Also:
-
vertices
-
colors
-
precedence
protected int precedence -
is2d
-
zindex
-
v0
-
v1
-
v0v1
-
nv0v1
protected double nv0v1 -
normal
-
bbox
-
marked
protected boolean marked -
marked2
protected boolean marked2 -
degenerated
-
-
Constructor Details
-
AbstractDrawable3DObject
Default constructor- Parameters:
vertices
- the vertices- Throws:
InvalidPolygonException
-
-
Method Details
-
isMonochromatic
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
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
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
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
-
isBehind
-
getProjectedPolyLine
Get the projected polyline of this object- Returns:
- a path 2D
-
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 numberd2
- a number- Returns:
- true if d1 is greater than d2
-
isLowerOrEqual
protected static final boolean isLowerOrEqual(double d1, double d2) - Parameters:
d1
- a numberd2
- a number- Returns:
- true if d1 is lower than d2
-
isEqual
protected static final boolean isEqual(double d1, double d2) - Parameters:
d1
- a numberd2
- a number- Returns:
- true if d1 is equal to d2
-
minmax3D
Get min-max of the projections of the vertices of o on v- Parameters:
o
- an objectv
- a vector- Returns:
- an array of size 2 containing min-max.
-
minmax2D
Get min-max of the projections of the vertices of o on v- Parameters:
o
- an objectv
- a vector- Returns:
- an array of size 2 containing min-max.
-
getColorsBarycenter
-
isDegenerate
protected boolean isDegenerate()- Returns:
- true if there are two vertices which are indentical
-
isNanOrInf
protected boolean isNanOrInf() -
isNanOrInf
-