Class: Ellipse
Ellipse is the representation of a 2D Ellipse shape. Can be used for collision detection.
Implements
Table of contents
Constructors
Properties
Methods
Constructors
constructor
+ new Ellipse(dimensions
: Vector, orientation?
: number, center?
: Vector): Ellipse
Parameters:
Name | Type | Default value |
---|---|---|
dimensions |
Vector | - |
orientation |
number | 0 |
center |
Vector | - |
Returns: Ellipse
Properties
center
• center: Vector
dimensions
• dimensions: Vector
orientation
• orientation: number
Methods
Center
▸ Center(): Vector
Center calculates/retrieves the center of a shape.
Returns: Vector
Implementation of: IShape
Copy
▸ Copy(): Ellipse
Creates a copy of the shape and its values, rather than pointing to the same Shape.
Returns: Ellipse
Implementation of: IShape
FarthestPointInDirection
▸ FarthestPointInDirection(direction
: Vector): Vector
FarthestPointInDirection returns the point that is farthest in the direction provided. Used in the GJK algorithm for collision detection.
Parameters:
Name | Type |
---|---|
direction |
Vector |
Returns: Vector
Implementation of: IShape
Free
▸ Free(): void
Free releases an object or it's constituent parts back into any available object pools.
Returns: void
Implementation of: IShape
PointInside
▸ PointInside(point
: Vector): boolean
PointInside determines if a point provided is within the shape or not.
Parameters:
Name | Type |
---|---|
point |
Vector |
Returns: boolean
Implementation of: IShape
Transform
▸ Transform(transform
: Transform): IShape
Transform takes a transform and applies it to shape.
Parameters:
Name | Type |
---|---|
transform |
Transform |
Returns: IShape
Implementation of: IShape
Circle
▸ Static
Circle(radius
: number, centerX?
: number, centerY?
: number): Ellipse
Circle returns a new Ellipse in the shape of a circle.
Parameters:
Name | Type | Default value | Description |
---|---|---|---|
radius |
number | - | Radius of the circle |
centerX |
number | 0 | - |
centerY |
number | 0 | - |
Returns: Ellipse