Ellipse

class Ellipse

an ellipse Object

Constructor


new Ellipse(x: number, y: number, w: number, h: number) → {}
Parameters:
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

Public Properties


pos ellipse.js:15
pos: Vector2d

Vector2d

the center coordinates of the ellipse

radius ellipse.js:28
radius: number

number

Maximum radius of the ellipse

radiusSq ellipse.js:42
radiusSq: Vector2d

Vector2d

Radius squared, for pythagorean theorom

radiusV ellipse.js:35
radiusV: Vector2d

Vector2d

Pre-scaled radius vector for ellipse

ratio ellipse.js:49
ratio: Vector2d

Vector2d

x/y scaling ratio for ellipse

type ellipse.js:56
type: string = "Ellipse"

string

the shape type (used internally)

Public Methods


clone ellipse.js:226
clone() → {Ellipse}

clone this Ellipse

Returns:
Type Description
Ellipse

new Ellipse

contains ellipse.js:178
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
}
Parameters:
Name Type Attributes Description
x number | Vector2d

x coordinate or a vector point to check

y number

<optional>

y coordinate

Returns:
Type Description
boolean

true if contains

getBounds ellipse.js:215
getBounds() → {Bounds}

returns the bounding box for this shape, the smallest Rectangle object completely containing this shape.

Returns:
Type Description
Bounds

this shape bounding box Rectangle object

rotate ellipse.js:99
rotate(angle: number, v: Vector2d | ObservableVector2d) → {Ellipse}

Rotate this Ellipse (counter-clockwise) by the specified angle (in radians).

Parameters:
Name Type Attributes Description
angle number

The angle to rotate (in radians)

v Vector2d | ObservableVector2d

<optional>

an optional point to rotate around

Returns:
Type Description
Ellipse

Reference to this object for method chaining

scale ellipse.js:114
scale(x: number, y: number) → {Ellipse}

Scale this Ellipse by the specified scalar.

Parameters:
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

Returns:
Type Description
Ellipse

Reference to this object for method chaining

scaleV ellipse.js:129
scaleV(v: Vector2d) → {Ellipse}

Scale this Ellipse by the specified vector.

Parameters:
Name Type Description
v Vector2d
Returns:
Type Description
Ellipse

Reference to this object for method chaining

setShape ellipse.js:70
setShape(x: number, y: number, w: number, h: number) → {Ellipse}

set new value to the Ellipse shape

Parameters:
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

Returns:
Type Description
Ellipse

this instance for objecf chaining

transform ellipse.js:138
transform(matrix: Matrix2d) → {Polygon}

apply the given transformation matrix to this ellipse

Parameters:
Name Type Description
matrix Matrix2d

the transformation matrix

Returns:
Type Description
Polygon

Reference to this object for method chaining

translate ellipse.js:148
translate(x: number | Vector2d, y: number) → {Ellipse}

translate the circle/ellipse by the specified offset

ellipse.translate(10, 10);
// or
ellipse.translate(myVector2d);
Parameters:
Name Type Attributes Description
x number | Vector2d

x coordinate or a vector point to translate by

y number

<optional>

y offset

Returns:
Type Description
Ellipse

this ellipse


Powered by webdoc!