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
-
-
Constructor Summary
Constructors Constructor Description Triangle(Vector3d[] vertices, java.awt.Color[] colors)Triangle(Vector3d[] vertices, java.awt.Color[] colors, Vector3d normal)Triangle(Vector3d[] vertices, Vector3d[] textureCoords, java.awt.image.BufferedImage image, Texture.Filter filter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddSegment(Segment s)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.java.util.List<ConvexObject>breakObject(ConvexObject o)Abstract method Break this ConvexObject against the ConvexObject ojava.util.List<ConvexObject>breakObject(Segment o)java.util.List<ConvexObject>breakObject(Triangle o)java.util.List<ConvexObject>breakObject(Vector4d v)Abstract method Break this ConvexObject against a planeprotected static java.util.List<ConvexObject>breakSegmentOnTriangle(Triangle t, Segment s)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.voiddraw(java.awt.Graphics2D g2d)Draw this object on a Graphics2D objectprotected doublegetSegmentIntersection(Segment s)protected SpritedRectanglegetSprite()intisBehind(ConvexObject o)Check if o is behind this.protected booleanisCoplanar(Segment s)protected booleanisCoplanar(Triangle t)booleanisIn2D()protected booleanisPointInside(Vector3d v)protected booleanisPointInside(Vector3d v, boolean checkCoplanarity)protected booleanisSegmentAcross(Segment s)protected booleanisSegmentInside(Segment s)protected booleanisSegmentIntersects(Segment s)booleanpointOnVertices(Vector3d p)voidremoveSegment(Segment s)voidreplaceSegment(Segment s, java.util.List<Segment> segs)protected voidsetSprite(SpritedRectangle sprite)java.lang.StringtoString()-
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
-
-
-
-
Field Detail
-
segments
protected java.util.List<Segment> segments
-
-
Constructor Detail
-
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
-
-
Method Detail
-
isBehind
public int isBehind(ConvexObject o)
Description copied from class:ConvexObjectCheck if o is behind this. Take care: the algorithms used are for convex objects (typically tri-tri, seg-seg or tri-seg)- Overrides:
isBehindin classConvexObject- Returns:
- true if o is behind this
-
isIn2D
public boolean isIn2D()
-
addSegment
public boolean addSegment(Segment s)
-
pointOnVertices
public boolean pointOnVertices(Vector3d p)
-
removeSegment
public void removeSegment(Segment s)
-
breakObject
public java.util.List<ConvexObject> breakObject(ConvexObject o)
Description copied from class:ConvexObjectAbstract method Break this ConvexObject against the ConvexObject o- Specified by:
breakObjectin classConvexObject- 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:AbstractDrawable3DObjectDraw this object on a Graphics2D object- Specified by:
drawin classAbstractDrawable3DObject- Parameters:
g2d- the Graphics2d object where to draw
-
breakObject
public java.util.List<ConvexObject> breakObject(Vector4d v)
Description copied from class:ConvexObjectAbstract method Break this ConvexObject against a plane- Specified by:
breakObjectin classConvexObject- 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:
toStringin classjava.lang.Object
-
-