Classdesc

A class for elliptic sectors.

Requires

Line

Requires

Vector

Requires

VertTuple

Requires

Vertex

Requires

SVGSerializale

Requires

UID

Requires

UIDGenerator

Constructors

  • Create a new elliptic sector from the given ellipse and two angles.

    Note that the direction from start to end goes clockwise, and that start and end angle will be wrapped to [0,PI*2).

    Parameters

    • ellipse: VEllipse
    • startAngle: number

      The start angle of the sector.

    • endAngle: number

      The end angle of the sector.

    Returns VEllipseSector

    Name

    VEllipseSector

Properties

className: string = "VEllipseSector"

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

ellipse: VEllipse

Member

Memberof

VEllipseSector

Instance

endAngle: number

Member

Memberof

VEllipseSector

Instance

isDestroyed: boolean

Member

isDestroyed

Memberof

VEllipseSector

Instance

startAngle: number

Member

Memberof

VEllipseSector

Instance

uid: string

The UID of this drawable object.

Member

Memberof

VEllipseSector

Instance

ellipseSectorUtils: {
    describeSVGArc: ((x, y, radiusH, radiusV, startAngle, endAngle, rotation?, options?) => SVGPathParams);
    equidistantVertAngles: ((radiusH, radiusV, startAngle, endAngle, fullEllipsePointCount) => number[]);
    findClosestToStartAngle: ((startAngle, endAngle, ellipseAngles) => number);
    normalizeAngle: ((angle) => number);
    endpointToCenterParameters(x1, y1, rx, ry, phi, fa, fs, x2, y2): VEllipseSector;
} = ...

Type declaration

  • describeSVGArc: ((x, y, radiusH, radiusV, startAngle, endAngle, rotation?, options?) => SVGPathParams)

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

    Returns

    [ 'A', radiusH, radiusV, rotation, largeArcFlag=1|0, sweepFlag=0, endx, endy ]

      • (x, y, radiusH, radiusV, startAngle, endAngle, rotation?, options?): SVGPathParams
      • Parameters

        • x: number
        • y: number
        • radiusH: number
        • radiusV: number
        • startAngle: number
        • endAngle: number
        • Optional rotation: number
        • Optional options: {
              moveToStart: boolean;
          }
          • moveToStart: boolean

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

        Returns SVGPathParams

  • equidistantVertAngles: ((radiusH, radiusV, startAngle, endAngle, fullEllipsePointCount) => number[])

    Helper function to find second-kind elliptic angles, so that the euclidean distance along the the elliptic sector is the same for all.

    Note that this is based on the full ellipse calculuation and start and end will be cropped; so the distance from the start angle to the first angle and/or the distance from the last angle to the end angle may be different to the others.

    Furthermore the computation is only possible on un-rotated ellipses; if your source ellipse has a rotation on the plane please 'rotate' the result angles afterwards to find matching angles.

    Returned angles are normalized to the interval [ 0, PI*2 ].

    Returns

    An array of n angles inside startAngle and endAngle (where n <= fullEllipsePointCount).

      • (radiusH, radiusV, startAngle, endAngle, fullEllipsePointCount): number[]
      • Parameters

        • radiusH: number

          The first (horizonal) radius of the ellipse.

        • radiusV: number

          The second (vertical) radius of the ellipse.

        • startAngle: number

          The opening angle of your elliptic sector (please use normalized angles).

        • endAngle: number

          The closing angle of your elliptic sector (please use normalized angles).

        • fullEllipsePointCount: number

          The number of base segments to use from the source ellipse (12 or 16 are good numbers).

        Returns number[]

  • findClosestToStartAngle: ((startAngle, endAngle, ellipseAngles) => number)
      • (startAngle, endAngle, ellipseAngles): number
      • Parameters

        • startAngle: number
        • endAngle: number
        • ellipseAngles: number[]

        Returns number

  • normalizeAngle: ((angle) => number)
      • (angle): number
      • Parameters

        • angle: number

        Returns number

  • endpointToCenterParameters:function
    • Convert the elliptic arc from endpoint parameters to center parameters as described in the w3c svg arc implementation note.

      https://www.w3.org/TR/SVG/implnote.html#ArcConversionEndpointToCenter

      Parameters

      • x1: number

        The x component of the start point (end of last SVG command).

      • y1: number

        The y component of the start point (end of last SVG command).

      • rx: number

        The first (horizontal) radius of the ellipse.

      • ry: number

        The second (vertical) radius of the ellipse.

      • phi: number

        The ellipse's rotational angle (angle of axis rotation) in radians (not in degrees as the SVG command uses!)

      • fa: boolean

        The large-arc-flag (boolean, not 0 or 1).

      • fs: boolean

        The sweep-flag (boolean, not 0 or 1).

      • x2: number

        The x component of the end point (end of last SVG command).

      • y2: number

        The y component of the end point (end of last SVG command).

      Returns VEllipseSector

Methods

  • 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.

    Returns void

  • Convert this elliptic sector into cubic Bézier curves.

    Parameters

    • Optional quarterSegmentCount: number

      The number of segments per base elliptic quarter (default is 3, min is 1).

    • Optional threshold: number

      The Bézier threshold (default value 0.666666 approximates the ellipse with best results but you might wish to use other values)

    Returns CubicBezierCurve[]

    An array of cubic Bézier curves representing the elliptic sector.