-
- All Implemented Interfaces:
public abstract class Shape
Abstract class presenting a geometric shape.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final class
Shape.IntersectionReturnElement
-
Field Summary
Fields Modifier and Type Field Description private CollisionBodyInterface
body
private Mat2
orientation
-
Constructor Summary
Constructors Constructor Description Shape()
-
Method Summary
Modifier and Type Method Description final CollisionBodyInterface
getBody()
final Unit
setBody(CollisionBodyInterface body)
final Mat2
getOrientation()
final Unit
setOrientation(Mat2 orientation)
abstract Unit
calcMass(Double density)
Calculates the mass of a shape. abstract Unit
createAABB()
Generates an AABB for the shape. abstract Boolean
isPointInside(Vec2 startPoint)
abstract Shape.IntersectionReturnElement
rayIntersect(Vec2 startPoint, Vec2 endPoint, Double maxDistance, Double rayLength)
Checks if a ray intersects with the shape. -
-
Method Detail
-
getBody
final CollisionBodyInterface getBody()
-
setBody
final Unit setBody(CollisionBodyInterface body)
-
getOrientation
final Mat2 getOrientation()
-
setOrientation
final Unit setOrientation(Mat2 orientation)
-
calcMass
abstract Unit calcMass(Double density)
Calculates the mass of a shape.
- Parameters:
density
- The desired density to factor into the calculation.
-
createAABB
abstract Unit createAABB()
Generates an AABB for the shape.
-
isPointInside
abstract Boolean isPointInside(Vec2 startPoint)
-
rayIntersect
abstract Shape.IntersectionReturnElement rayIntersect(Vec2 startPoint, Vec2 endPoint, Double maxDistance, Double rayLength)
Checks if a ray intersects with the shape.
- Parameters:
startPoint
- The start point of the ray.endPoint
- The end point of the ray.maxDistance
- The ray information.
-
-
-
-