Ellipse
class Ellipse
an ellipse Object
Constructor
new Ellipse(x: number, y: number, w: number, h: number) → {}
Name | Type | Description |
---|---|---|
x | number |
the center x coordinate of the ellipse |
y | number |
the center y coordinate of the ellipse |
w | number |
width (diameter) of the ellipse |
h | number |
height (diameter) of the ellipse |
Summary
Properties from Ellipse
Methods from Ellipse
Public Properties
Public Methods
clone() → {Ellipse}
clone this Ellipse
Type | Description |
---|---|
Ellipse |
new Ellipse |
contains(x: number | Vector2d, y: number) → {boolean}
check if this circle/ellipse contains the specified point
if (circle.contains(10, 10)) {
// do something
}
// or
if (circle.contains(myVector2d)) {
// do something
}
Name | Type | Attributes | Description |
---|---|---|---|
x | number | Vector2d |
x coordinate or a vector point to check |
|
y | number |
<optional> |
y coordinate |
Type | Description |
---|---|
boolean |
true if contains |
getBounds() → {Bounds}
returns the bounding box for this shape, the smallest Rectangle object completely containing this shape.
Type | Description |
---|---|
Bounds |
this shape bounding box Rectangle object |
rotate(angle: number, v: Vector2d | ObservableVector2d) → {Ellipse}
Rotate this Ellipse (counter-clockwise) by the specified angle (in radians).
Name | Type | Attributes | Description |
---|---|---|---|
angle | number |
The angle to rotate (in radians) |
|
v | Vector2d | ObservableVector2d |
<optional> |
an optional point to rotate around |
Type | Description |
---|---|
Ellipse |
Reference to this object for method chaining |
scale(x: number, y: number) → {Ellipse}
Scale this Ellipse by the specified scalar.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
x | number |
the scale factor along the x-axis |
||
y | number |
<optional> |
x |
the scale factor along the y-axis |
Type | Description |
---|---|
Ellipse |
Reference to this object for method chaining |
scaleV(v: Vector2d) → {Ellipse}
Scale this Ellipse by the specified vector.
Name | Type | Description |
---|---|---|
v | Vector2d |
Type | Description |
---|---|
Ellipse |
Reference to this object for method chaining |
setShape(x: number, y: number, w: number, h: number) → {Ellipse}
set new value to the Ellipse shape
Name | Type | Description |
---|---|---|
x | number |
the center x coordinate of the ellipse |
y | number |
the center y coordinate of the ellipse |
w | number |
width (diameter) of the ellipse |
h | number |
height (diameter) of the ellipse |
Type | Description |
---|---|
Ellipse |
this instance for objecf chaining |
transform(matrix: Matrix2d) → {Polygon}
apply the given transformation matrix to this ellipse
Name | Type | Description |
---|---|---|
matrix | Matrix2d |
the transformation matrix |
Type | Description |
---|---|
Polygon |
Reference to this object for method chaining |
translate(x: number | Vector2d, y: number) → {Ellipse}
translate the circle/ellipse by the specified offset
ellipse.translate(10, 10);
// or
ellipse.translate(myVector2d);
Name | Type | Attributes | Description |
---|---|---|---|
x | number | Vector2d |
x coordinate or a vector point to translate by |
|
y | number |
<optional> |
y offset |
Type | Description |
---|---|
Ellipse |
this ellipse |