org.scilab.forge.scirenderer.implementation.g2d.motor
Class Triangle
java.lang.Object
org.scilab.forge.scirenderer.implementation.g2d.motor.AbstractDrawable3DObject
org.scilab.forge.scirenderer.implementation.g2d.motor.ConvexObject
org.scilab.forge.scirenderer.implementation.g2d.motor.Triangle
public class Triangle
- extends ConvexObject
- Author:
- Calixte DENIZET
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 |
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, isNegativeOrNull, isNull, isPlanar, isPositiveOrNull, minmax2D, minmax3D, resetDefaultPrecedence, setNormal, setPrecedence |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
segments
protected java.util.Set<Segment> segments
Triangle
public Triangle(Vector3d[] vertices,
java.awt.Color[] colors,
Vector3d normal)
throws InvalidPolygonException
- Throws:
InvalidPolygonException
Triangle
public Triangle(Vector3d[] vertices,
java.awt.Color[] colors)
throws InvalidPolygonException
- Throws:
InvalidPolygonException
Triangle
public Triangle(Vector3d[] vertices,
Vector3d[] textureCoords,
java.awt.image.BufferedImage image,
Texture.Filter filter)
throws InvalidPolygonException
- Throws:
InvalidPolygonException
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
addSegment
public boolean addSegment(Segment s)
pointOnVertices
public boolean pointOnVertices(Vector3d p)
removeSegment
public void removeSegment(Segment s)
replaceSegment
public void replaceSegment(Segment s,
java.util.List<Segment> segs)
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(Triangle o)
breakObject
public java.util.List<ConvexObject> breakObject(Segment o)
setSprite
protected void setSprite(SpritedRectangle sprite)
getSprite
protected SpritedRectangle getSprite()
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
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.
isPointInside
protected boolean isPointInside(Vector3d v)
isPointInside
protected boolean isPointInside(Vector3d v,
boolean checkCoplanarity)
isCoplanar
protected boolean isCoplanar(Segment s)
isCoplanar
protected boolean isCoplanar(Triangle t)
isSegmentAcross
protected boolean isSegmentAcross(Segment s)
isSegmentInside
protected boolean isSegmentInside(Segment s)
isSegmentIntersects
protected boolean isSegmentIntersects(Segment s)
getSegmentIntersection
protected double getSegmentIntersection(Segment s)
breakSegmentOnTriangle
protected static java.util.List<ConvexObject> breakSegmentOnTriangle(Triangle t,
Segment s)
breakTriangleOnLine
protected static java.util.List<ConvexObject> breakTriangleOnLine(Triangle t,
Vector3d p,
Vector3d n)
- Break a triangle according to its intersection with a line containing p in the plane of the triangle and orthogonal to n
The triangle and the line are supposed to be coplanar.
- Parameters:
t
- the triangle to breakp
- a point of the linen
- a vector
- Returns:
- a list of triangles
breakIntersectingTriangles
protected static java.util.List<ConvexObject> breakIntersectingTriangles(Triangle t1,
Triangle t2)
- Get the broken triangles in following the intersection of the planes containing t1 and t2.
The planes containing t1 and t2 are supposed to be secant.
- Parameters:
t1
- the first trianglet2
- the second triangle
- Returns:
- an array of length 2 containing the resulting triangles for t1 and t2.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object