Class CircleSector

Classdesc

A simple circle sector: circle, start- and end-angle.

Line

SVGSerializale

UID

UIDGenerator

XYCoords

Constructors

• Create a new circle sector with given circle, start- and end-angle.

Parameters

• circle: Circle

The circle.

• startAngle: number

The start angle of the sector.

• endAngle: number

The end angle of the sector.

CircleSector

Properties

circle: Circle

CircleSector

Instance

className: string = "CircleSector"

Required to generate proper CSS classes and other class related IDs.

endAngle: number

CircleSector

Instance

isDestroyed: boolean

isDestroyed

CircleSector

Instance

startAngle: number

CircleSector

Instance

uid: string

The UID of this drawable object.

CircleSector

Instance

circleSectorUtils: {
describeSVGArc: ((x, y, radius, startAngle, endAngle, options?) => SVGPathParams);
polarToCartesian: ((centerX, centerY, radius, angle) => XYCoords);
} = ...

Type declaration

• describeSVGArc: ((x, y, radius, startAngle, endAngle, options?) => SVGPathParams)

Helper function to convert a circle section as SVG arc params (for the `d` attribute). Found at: https://stackoverflow.com/questions/5736398/how-to-calculate-the-svg-path-for-an-arc-of-a-circle

TODO: generalize for ellipses (two radii).

Returns

• (x, y, radius, startAngle, endAngle, options?): SVGPathParams
• Parameters

• x: number
• y: number
• startAngle: number
• endAngle: number
• `Optional` options: {
moveToStart: boolean;
}
• moveToStart: boolean

If false (default=true) the initial 'Move' command will not be used.

Returns SVGPathParams

• polarToCartesian: ((centerX, centerY, radius, angle) => XYCoords)

Helper function to convert polar circle coordinates to cartesian coordinates.

TODO: generalize for ellipses (two radii).

• (centerX, centerY, radius, angle): XYCoords
• Parameters

• centerX: number
• centerY: number
• angle: number

Methods

• Get the angle inside this sector for a given ratio. 0.0 means startAngle, and 1.0 means endAngle.

Parameters

• t: number

The ratio inside [0..1].

Returns number

The angle inside this sector at a given ratio.

angleAt

Memberof

CircleSector

• Calculate the intersection of this circle sector and some other sector.

If the two sectors do not corerently intersect (when not both points of the radical line are containted in both source sectors) then null is returned.

See demo/53-circle-sector-intersections for a geometric visualisation.

Returns CircleSector

The intersecion of both sectors or null if they don't intersect.

Method

circleSectorIntersection

Memberof

CircleSector

• Checks wether the given angle (must be inside 0 and PI*2) is contained inside this sector.

Parameters

• angle: number

The numeric angle to check.

Returns boolean

True if (and only if) this sector contains the given angle.

Method

containsAngle

Memberof

CircleSector

• This function should invalidate any installed listeners and invalidate this object. After calling this function the object might not hold valid data any more and should not be used.

destroy

Memberof

CircleSector

• Get the sectors ending point (on the underlying circle, located at the end angle).

Returns Vertex

The sector's ending point.

getEndPoint

Memberof

CircleSector

• Get the sectors starting point (on the underlying circle, located at the start angle).

Returns Vertex

The sector's stating point.

Method

getStartPoint

CircleSector