org.scilab.forge.scirenderer.implementation.g2d.motor
Class Segment

java.lang.Object
  extended by org.scilab.forge.scirenderer.implementation.g2d.motor.AbstractDrawable3DObject
      extended by org.scilab.forge.scirenderer.implementation.g2d.motor.ConvexObject
          extended by org.scilab.forge.scirenderer.implementation.g2d.motor.Segment
All Implemented Interfaces:
java.lang.Comparable<Segment>

public class Segment
extends ConvexObject
implements java.lang.Comparable<Segment>

Author:
Calixte DENIZET

Field Summary
protected  java.util.List<ConvexObject> segmentOn
           
protected  java.awt.Stroke stroke
           
 
Fields inherited from class org.scilab.forge.scirenderer.implementation.g2d.motor.AbstractDrawable3DObject
bbox, colors, degenerated, is2d, marked, marked2, normal, nv0v1, precedence, PRECISION, v0, v0v1, v1, vertices, zindex
 
Constructor Summary
Segment(Vector3d[] vertices, java.awt.Color[] colors)
           
Segment(Vector3d[] vertices, java.awt.Color[] colors, java.awt.Stroke stroke)
           
 
Method Summary
 void addConvexObject(ConvexObject co)
           
 java.util.List<ConvexObject> breakObject(ConvexObject o)
          Abstract method Break this ConvexObject against the ConvexObject o
 java.util.List<Segment> breakObject(Vector3d p, Vector3d u, Vector3d n)
           
 java.util.List<ConvexObject> breakObject(Vector4d v)
          Abstract method Break this ConvexObject against a plane
 int compareTo(Segment o)
           
 void draw(java.awt.Graphics2D g2d)
          Draw this object on a Graphics2D object
 boolean equals(java.lang.Object o)
           
 double getLength()
           
static double getLength(Vector3d[] vertices)
           
 int hashCode()
           
 int isBehind(ConvexObject o)
          Check if o is behind this.
 boolean isIn2D()
           
 boolean isInFront()
           
 void removeConvexObject(ConvexObject co)
           
 void replaceSegment(java.util.List<Segment> segs)
           
 void setStroke(java.awt.Stroke stroke)
           
 java.lang.String toString()
           
 
Methods inherited from class org.scilab.forge.scirenderer.implementation.g2d.motor.ConvexObject
addArea, areCoplanar, check, check2DIntersection, check2DTrueIntersection, drawAreas
 
Methods inherited from class org.scilab.forge.scirenderer.implementation.g2d.motor.AbstractDrawable3DObject
getColorsBarycenter, getNormal, getPrecedence, getProjectedContour, getProjectedPolyLine, getProvidedNormal, is2D, isBehind, isBehind, isDegenerate, isEqual, isGreaterOrEqual, isLowerOrEqual, isMonochromatic, isNanOrInf, isNanOrInf, isNegativeOrNull, isNull, isPlanar, isPositiveOrNull, minmax2D, minmax3D, resetDefaultPrecedence, setNormal, setPrecedence
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

stroke

protected java.awt.Stroke stroke

segmentOn

protected java.util.List<ConvexObject> segmentOn
Constructor Detail

Segment

public Segment(Vector3d[] vertices,
               java.awt.Color[] colors,
               java.awt.Stroke stroke)
        throws InvalidPolygonException
Throws:
InvalidPolygonException

Segment

public Segment(Vector3d[] vertices,
               java.awt.Color[] colors)
        throws InvalidPolygonException
Throws:
InvalidPolygonException
Method Detail

setStroke

public void setStroke(java.awt.Stroke stroke)

getLength

public double getLength()

getLength

public static double getLength(Vector3d[] vertices)

addConvexObject

public void addConvexObject(ConvexObject co)

removeConvexObject

public void removeConvexObject(ConvexObject co)

replaceSegment

public void replaceSegment(java.util.List<Segment> segs)

isIn2D

public boolean isIn2D()

isInFront

public boolean isInFront()

compareTo

public int compareTo(Segment o)
Specified by:
compareTo in interface java.lang.Comparable<Segment>

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

isBehind

public int isBehind(ConvexObject o)
Description copied from class: ConvexObject
Check if o is behind this. Take care: the algorithms used are for convex objects (typically tri-tri, seg-seg or tri-seg)

Overrides:
isBehind in class ConvexObject
Returns:
true if o is behind this

breakObject

public java.util.List<ConvexObject> breakObject(ConvexObject o)
Description copied from class: ConvexObject
Abstract method Break this ConvexObject against the ConvexObject o

Specified by:
breakObject in class ConvexObject
Parameters:
o - a ConvexObject
Returns:
a list of ConvexObject.

breakObject

public java.util.List<ConvexObject> breakObject(Vector4d v)
Description copied from class: ConvexObject
Abstract method Break this ConvexObject against a plane

Specified by:
breakObject in class ConvexObject
Parameters:
v - plane definition
Returns:
a list of ConvexObject.

breakObject

public java.util.List<Segment> breakObject(Vector3d p,
                                           Vector3d u,
                                           Vector3d n)

draw

public void draw(java.awt.Graphics2D g2d)
Description copied from class: AbstractDrawable3DObject
Draw this object on a Graphics2D object

Specified by:
draw in class AbstractDrawable3DObject
Parameters:
g2d - the Graphics2d object where to draw

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object