public class Triangle extends ConvexObject
Modifier and Type | Field and Description |
---|---|
protected java.util.Set<Segment> |
segments |
Constructor and 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) |
Modifier and Type | Method and Description |
---|---|
boolean |
addSegment(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 o
|
java.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 plane
|
protected 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.
|
void |
draw(java.awt.Graphics2D g2d)
Draw this object on a Graphics2D object
|
protected double |
getSegmentIntersection(Segment s) |
protected SpritedRectangle |
getSprite() |
int |
isBehind(ConvexObject o)
Check if o is behind this.
|
protected boolean |
isCoplanar(Segment s) |
protected boolean |
isCoplanar(Triangle t) |
boolean |
isIn2D() |
protected boolean |
isPointInside(Vector3d v) |
protected boolean |
isPointInside(Vector3d v,
boolean checkCoplanarity) |
protected boolean |
isSegmentAcross(Segment s) |
protected boolean |
isSegmentInside(Segment s) |
protected boolean |
isSegmentIntersects(Segment s) |
boolean |
pointOnVertices(Vector3d p) |
void |
removeSegment(Segment s) |
void |
replaceSegment(Segment s,
java.util.List<Segment> segs) |
protected void |
setSprite(SpritedRectangle sprite) |
java.lang.String |
toString() |
addArea, areCoplanar, check, check2DIntersection, check2DTrueIntersection, drawAreas
getColorsBarycenter, getNormal, getPrecedence, getProjectedContour, getProjectedPolyLine, getProvidedNormal, is2D, isBehind, isBehind, isDegenerate, isEqual, isGreaterOrEqual, isLowerOrEqual, isNanOrInf, isNanOrInf, isNegativeOrNull, isNull, isPlanar, isPositiveOrNull, minmax2D, minmax3D, resetDefaultPrecedence, setNormal, setPrecedence
protected java.util.Set<Segment> segments
public Triangle(Vector3d[] vertices, java.awt.Color[] colors, Vector3d normal) throws InvalidPolygonException
InvalidPolygonException
public Triangle(Vector3d[] vertices, java.awt.Color[] colors) throws InvalidPolygonException
InvalidPolygonException
public Triangle(Vector3d[] vertices, Vector3d[] textureCoords, java.awt.image.BufferedImage image, Texture.Filter filter) throws InvalidPolygonException
InvalidPolygonException
public int isBehind(ConvexObject o)
ConvexObject
isBehind
in class ConvexObject
public boolean isIn2D()
public boolean addSegment(Segment s)
public boolean pointOnVertices(Vector3d p)
public void removeSegment(Segment s)
public java.util.List<ConvexObject> breakObject(ConvexObject o)
ConvexObject
breakObject
in class ConvexObject
o
- a ConvexObjectpublic java.util.List<ConvexObject> breakObject(Triangle o)
public java.util.List<ConvexObject> breakObject(Segment o)
protected void setSprite(SpritedRectangle sprite)
protected SpritedRectangle getSprite()
public void draw(java.awt.Graphics2D g2d)
AbstractDrawable3DObject
draw
in class AbstractDrawable3DObject
g2d
- the Graphics2d object where to drawpublic java.util.List<ConvexObject> breakObject(Vector4d v)
ConvexObject
breakObject
in class ConvexObject
v
- plane definitionprotected boolean isPointInside(Vector3d v)
protected boolean isPointInside(Vector3d v, boolean checkCoplanarity)
protected boolean isCoplanar(Segment s)
protected boolean isCoplanar(Triangle t)
protected boolean isSegmentAcross(Segment s)
protected boolean isSegmentInside(Segment s)
protected boolean isSegmentIntersects(Segment s)
protected double getSegmentIntersection(Segment s)
protected static java.util.List<ConvexObject> breakSegmentOnTriangle(Triangle t, Segment s)
protected static java.util.List<ConvexObject> breakTriangleOnLine(Triangle t, Vector3d p, Vector3d n)
t
- the triangle to breakp
- a point of the linen
- a vectorprotected static java.util.List<ConvexObject> breakIntersectingTriangles(Triangle t1, Triangle t2)
t1
- the first trianglet2
- the second trianglepublic java.lang.String toString()
toString
in class java.lang.Object