Class ConvexObject
java.lang.Object
org.scilab.forge.scirenderer.implementation.g2d.motor.AbstractDrawable3DObject
org.scilab.forge.scirenderer.implementation.g2d.motor.ConvexObject
- Direct Known Subclasses:
Segment, SpritedRectangle, Triangle
- Author:
- Calixte DENIZET Class to represent a convex object. Collision and relative positions of convexs object are relatively easy to determinate. About the method isBehind, it could be interesting to use the algorithm of Chung-Wang.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddArea(ConvexObject co) booleanTest the coplanarity of two objectsabstract List<ConvexObject> Abstract method Break this ConvexObject against the ConvexObject oabstract List<ConvexObject> Abstract method Break this ConvexObject against a planeprotected intcheck(ConvexObject o, Vector3d v) Check the intersection this and o against vector v.booleanCheck the intersections of the projection on the xOy-plane of this and o The algorithm is the following: for each edge, determinate the normal vector and project all the points of this and o on the normal.booleanCheck the intersections of the projection on the xOy-plane of this and o The algorithm is the following: for each edge, determinate the normal vector and project all the points of this and o on the normal.protected voiddrawAreas(Graphics2D g2d) intCheck if o is behind this.Methods inherited from class AbstractDrawable3DObject
draw, 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
-
Constructor Details
-
ConvexObject
Default constructor- Parameters:
vertices- the verticescolors- the colors- Throws:
InvalidPolygonException
-
-
Method Details
-
breakObject
Abstract method Break this ConvexObject against the ConvexObject o- Parameters:
o- a ConvexObject- Returns:
- a list of ConvexObject.
-
breakObject
Abstract method Break this ConvexObject against a plane- Parameters:
v- plane definition- Returns:
- a list of ConvexObject.
-
addArea
-
drawAreas
-
areCoplanar
Test the coplanarity of two objects- Parameters:
o- a ConvexObject- Returns:
- true if the two objects are coplanar
-
isBehind
Check if o is behind this. Take care: the algorithms used are for convex objects (typically tri-tri, seg-seg or tri-seg)- Returns:
- true if o is behind this
-
check2DIntersection
Check the intersections of the projection on the xOy-plane of this and o The algorithm is the following: for each edge, determinate the normal vector and project all the points of this and o on the normal. If the intersection of [this.min,this.max] and [o.min, o.max] is empty, then we have a separating line so the two objects are separated.- Parameters:
o- the object to test with this- Returns:
- true if there is a collision
-
check2DTrueIntersection
Check the intersections of the projection on the xOy-plane of this and o The algorithm is the following: for each edge, determinate the normal vector and project all the points of this and o on the normal. If the intersection of [this.min,this.max] and [o.min, o.max] is empty, then we have a separating line so the two objects are separated.- Parameters:
o- the object to test with this- Returns:
- true if there is a collision
-
check
Check the intersection this and o against vector v. The algorithm is just to project this and o on the vector v and to check if the two projected sets can be separated.- Parameters:
v- the vector where to project- Returns:
- 1 if o is behind this, 0 if it is undeterminated and -1 if this is behind o.
-