Classes
- Angle
- Arc
- ArcControl
- Bezier
- Color
- Composite
- Control
- Controller
- Exception
- Fill
- P5Drawer
- Point
- Ray
- RayControl
- Segment
- Shape
- Stroke
- StyleContainer
- Text
Members
(static) build :string
Build of the class. Intended for debugging purpouses.
Contains a commit-count and short-hash of the repository when the build was done.
(static) version :string
Version of the class. Same as the version used for the npm package.
controller
Controller of the instance. This objecs handles all of the controls
and pointer events related to this instance of Rac
.
drawer :object
Drawer of the instance. This object handles the drawing of all
drawable object using this instance of Rac
.
equalityThreshold :number
Value used to determine equality between two numeric values. Used for
values that tend to be integers, like screen coordinates. Used by
Rac#equals
.
When checking for equality x
is equal to non-inclusive
(x-equalityThreshold, x+equalityThreshold)
:
x
is not equal tox ± equalityThreshold
x
is equal tox ± equalityThreshold/2
Due to floating point precision some opertation like intersections can return odd or oscilating values. This threshold is used to snap values too close to a limit, as to prevent oscilating efects in user interaction.
Default value is based on 1/1000
of a point.
unitaryEqualityThreshold :number
Value used to determine equality between two unitary numeric values.
Used for values that tend to exist in the [0, 1]
range, like
Rac.Angle#turn
. Used by Rac#unitaryEquals
.
Equality logic is the same as Rac#equalityThreshold
.
Default value is based on 1/000 of the turn of an arc of radius 500
and length of 1: 1/(500*6.28)/1000
Methods
Angle(turn) → {Rac.Angle}
Convenience function that creates a new Angle
setup with this
.
The function also contains additional methods and properties listed in
instance.Angle
.
- See:
Parameters:
Name | Type | Description |
---|---|---|
turn |
number
|
The turn value of the angle, in the range |
Arc(x, y, start, endopt, clockwiseopt) → {Rac.Arc}
Convenience function that creates a new Arc
setup with this
.
The function also contains additional methods and properties listed in
instance.Arc
.
- See:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
x |
number
|
|||
y |
number
|
|||
start |
Rac.Angle
|
number
|
|||
end |
Rac.Angle
|
number
|
<optional> |
null | |
clockwise |
boolean
|
<optional> |
true |
Bezier(startX, startY, startAnchorX, startAnchorY, endAnchorX, endAnchorY, endX, endY) → {Rac.Bezier}
Convenience function that creates a new Bezier
setup with this
.
The function also contains additional methods and properties listed in
instance.Bezier
.
- See:
Parameters:
Name | Type | Description |
---|---|---|
startX |
number
|
|
startY |
number
|
|
startAnchorX |
number
|
|
startAnchorY |
number
|
|
endAnchorX |
number
|
|
endAnchorY |
number
|
|
endX |
number
|
|
endY |
number
|
Color(r, g, b, aopt) → {Rac.Color}
Convenience function that creates a new Color
setup with this
.
The function also contains additional methods and properties listed in
instance.Color
.
- See:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
r |
number
|
||
g |
number
|
||
b |
number
|
||
a |
number
|
<optional> |
equals(a, b) → {boolean}
Returns true
if the absolute distance between a
and b
is
under Rac#equalityThreshold
.
Parameters:
Name | Type | Description |
---|---|---|
a |
number
|
First number to compare |
b |
number
|
Second number to compare |
Fill(coloropt) → {Rac.Fill}
Convenience function that creates a new Fill
setup with this
.
The function also contains additional methods and properties listed in
instance.Fill
.
- See:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
color |
Rac.Color
|
<optional> |
Point(x, y) → {Rac.Point}
Convenience function that creates a new Point
setup with this
.
The function also contains additional methods and properties listed in
instance.Point
.
- See:
Parameters:
Name | Type | Description |
---|---|---|
x |
number
|
|
y |
number
|
Ray(x, y, angle) → {Rac.Ray}
Convenience function that creates a new Ray
setup with this
.
The function also contains additional methods and properties listed in
instance.Ray
.
- See:
Parameters:
Name | Type | Description |
---|---|---|
x |
number
|
|
y |
number
|
|
angle |
Rac.Angle
|
number
|
Segment(x, y, angle, length) → {Rac.Segment}
Convenience function that creates a new Segment
setup with this
.
The function also contains additional methods and properties listed in
instance.Segment
.
- See:
Parameters:
Name | Type | Description |
---|---|---|
x |
number
|
|
y |
number
|
|
angle |
Rac.Angle
|
number
|
|
length |
number
|
setupDrawer(p5Instance)
Sets the drawer for the instance. Currently only a p5.js instance is supported.
The drawer will also populate some classes with prototype functions
relevant to the drawer. For p5.js this include apply
functions for
colors and style object, and vertex
functions for drawable objects.
Parameters:
Name | Type | Description |
---|---|---|
p5Instance |
P5
|
Stroke(weightnullable, colornullable) → {Rac.Stroke}
Convenience function that creates a new Stroke
setup with this
.
The function also contains additional methods and properties listed in
instance.Stroke
.
- See:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
weight |
number
|
<nullable> |
|
color |
Rac.Color
|
<nullable> |
Style(strokenullable, fillnullable) → {Rac.Style}
Convenience function that creates a new Style
setup with this
.
The function also contains additional methods and properties listed in
instance.Style
.
- See:
-
- instance.Style
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
stroke |
Rac.Stroke
|
<nullable> |
|
fill |
Rac.Fill
|
<nullable> |
Text(x, y, string, format) → {Rac.Text}
Convenience function that creates a new Text
setup with this
.
The function also contains additional methods and properties listed in
instance.Text
.
- See:
Parameters:
Name | Type | Description |
---|---|---|
x |
number
|
|
y |
number
|
|
string |
string
|
|
format |
Rac.Text.Format
|
unitaryEquals(a, b) → {boolean}
Returns true
if the absolute distance between a
and b
is
under Rac#unitaryEqualityThreshold
.
Parameters:
Name | Type | Description |
---|---|---|
a |
number
|
First number to compare |
b |
number
|
Second number to compare |