Class Arc
Defined in: primitives.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Arc(x, y, radius, startAngle, endAngle, direction, styleFlag)
Draws an arc.
|
Field Attributes | Field Name and Description |
---|---|
An {Array} of QuadCurves used to draw the arc
|
|
Adding a reference to the end point makes the transform code hugely cleaner
|
|
End angle.
|
|
The end angle, in radians
|
|
The end Point
|
|
The center Point of the circle
|
|
<inner> |
Accuracy.
|
Object type used for JSON deserialization
|
|
The radius of the circle
|
|
Start angle.
|
|
The start angle, in radians
|
|
The start Point
|
|
The Style of the arc
|
|
The style flag - see contructor's arguments
|
Method Attributes | Method Name and Description |
---|---|
clone()
|
|
contains(thex, they)
|
|
equals(anotherArc)
|
|
Get the points of the Arc
|
|
<static> |
Arc.load(o)
Creates a {Arc} out of JSON parsed object
|
<static> |
Arc.loadArray(v)
Creates a {Arc} out of an Array of JSON parsed object
|
near(thex, they, theradius)
|
|
paint(context)
|
|
toString()
|
|
toSVG()
As we simulate an arc by {QuadCurve}s so we will collect all of them
and add it to a
|
|
transform(matrix)
|
Class Detail
Arc(x, y, radius, startAngle, endAngle, direction, styleFlag)
Draws an arc.
To allow easy transformations of the arc we will simulate the arc by a series of curves
- Parameters:
- {Number} x
- - the X coordinates of the "imaginary" circle of which the arc is part of
- {Number} y
- - the Y coordinates of the "imaginary" circle of which the arc is part of
- {Number} radius
- - the radius of the arc
- {Number} startAngle
- - the degrees (not radians as in Canvas'specs) of the starting angle for this arc
- {Number} endAngle
- - the degrees (not radians as in Canvas'specs) of the starting angle for this arc
- {Number} direction
- - the direction of drawing. For now it's from startAngle to endAngle (anticlockwise). Not really used
- {Number} styleFlag
- (optional) - 1: close path between start of arc and end, 2: draw pie slice, line to center point, line to start point default: empty/0/anything else: just draw the arc TODO: make it a class constant
Field Detail
curves
An {Array} of QuadCurves used to draw the arc
direction
Adding a reference to the end point makes the transform code hugely cleaner
endAngle
End angle. Required for dashedArc
endAngleRadians
The end angle, in radians
endPoint
The end Point
middle
The center Point of the circle
<inner>
numControlPoints
Accuracy. It tells the story of how many QuadCurves we will use
oType
Object type used for JSON deserialization
radius
The radius of the circle
startAngle
Start angle. required for dashedArc
startAngleRadians
The start angle, in radians
startPoint
The start Point
style
The Style of the arc
styleFlag
The style flag - see contructor's arguments
Method Detail
clone()
contains(thex, they)
- Parameters:
- thex
- they
equals(anotherArc)
- Parameters:
- anotherArc
getBounds()
{Array}
getPoints()
Get the points of the Arc
Author: Zack.
Author: Zack.
- Returns:
- {Array} of {Point}s
<static>
{Arc}
Arc.load(o)
Creates a {Arc} out of JSON parsed object
Author: Alex Gheorghiu.
Author: Alex Gheorghiu
- Parameters:
- {JSONObject} o
- - the JSON parsed object
- Returns:
- {Arc} a newly constructed Arc
<static>
{Array}
Arc.loadArray(v)
Creates a {Arc} out of an Array of JSON parsed object
Author: Alex Gheorghiu.
Author: Alex Gheorghiu
- Parameters:
- {Array} v
- - an {Array} of JSON parsed objects
- Returns:
- {Array} of newly constructed Arcs
near(thex, they, theradius)
- Parameters:
- thex
- they
- theradius
paint(context)
- Parameters:
- context
toString()
toSVG()
As we simulate an arc by {QuadCurve}s so we will collect all of them
and add it to a element.
Note: We might use the SVG's arc command but what if the arc got distorted by a transformation?
Author: Alex.
Author: Alex
- See:
- http://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands
- http://tutorials.jenkov.com/svg/path-element.html
transform(matrix)
- Parameters:
- matrix