point
doc imports:
-
pointpen.js
-
compass.js
-
center.js
-
point-content.js
-
pointdraw.js
-
relative-xy.js
-
pointcast.js
-
point.js
Meta Data
| dependencies | () |
| unused_keys | ('title',) |
| unknown_keys | ('categories', 'doc_imports', 'doc_loader', 'doc_readme', 'doc_content', 'files') |
| categories | ['primary', 'point'] |
| doc_imports | ['point'] |
| doc_loader | ['loadDocInfo'] |
| doc_readme | ['point/readme.md'] |
| doc_content | ['point/*.md'] |
| files | ['', 'relative-xy.js', 'pointcast.js'] |
| filepath_exists | True |
| path | point |
| filepath | point.js |
| clean_files | ('relative-xy.js', 'pointcast.js') |
The entire library is focused upon the single 2D Point.
Getting Started
A Point accepts many properties, or an object.
// accepts: (x, y, radius, rotation)
new Point(100, 200, 20, 90)
// accepts: (x, y, radius, rotation)
new Point([100, 200, 20, 90])
new Point({
x: 100
, y: 200
, radius: 20
, rotation: 90
})
let point = new Point
point.x = 100
point.y = 200
point.radius = 20
point.rotation = 90
-
ExpressionStatement
:
dict_keys(['type', 'expression', 'pos']) -
ClassDeclarationclass
Positionable
extends Relativeclass comments:The base
Positionableclass provides functionality for plotting the X and Y of an entity. This includes any fundamental methods such asmultiply().-
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
ABOVE X method
Multiline - touching.
Set the X (horizontal | latitude | across) value of the positionable. From cooridinate top left `(0,0)``
point.x = 100If the given value is a function, the function is called immediately, with this positionable as the first argument.
stage.center.x = (p)=>200 -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Set the Y (vertical | height | longtitude) value of the positionable. From cooridinate top left `(0,0)``
point.x = 100If the given value is a function, the function is called immediately, with this positionable as the first argument.
stage.center.x = (p)=>200 -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Set the given
key,value, assuming the given key is a "special" string, such as "radius". This method is called by the special getters and setters for this point:const point = new Point(100,300, 20) point.setSpecial('radius', 55)Synonymous to:
point.radius = 55 -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
A callback executed by setSpecial when a "special" property is called.
If a method on this point exists matching the set method pattern, the method is called with the given
value:class MyPoint extends Point { radiusSet(value) { console.log('New Radius value is', value) } } -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Return a stored special value given a
key.If the
relIndexproperty is not None, the relative value found at the index (within this points relative data Array), add the stashed relative value to the result.const point = new Point(100,300, 20) point.getSpecial('radius', 2) // 20if a default value is given, and the internal
keyvalue does not exist, return the default value:point.getSpecial('banana', 'yellow') 'yellow' -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Returns a new point, with the XY set at the point that is
offsettimes the distance from the current point to the other point.this function is also
lerpfor linear interpolation
ClassDeclarationclassRotation
extends Positionableclass comments:Set the rotation in degrees (0 to 360). If
this.modulusRotateistrue(default), the given value is fixed through modulus 360point.rotation = 600 // 240 point.rotation += 1 // 241To set the rotation (degrees) whilst accounting for the UP vector, consider the
rotate()method.-
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Set the rotation in degrees (0 to 360). If
this.modulusRotateistrue(default), the given value is fixed through modulus 360point.rotation = 600 // 240 point.rotation += 1 // 241To set the rotation (degrees) whilst accounting for the UP vector, consider the
rotate()method. -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Rotate the point such that the angle relative to the
otherPointis0, essentially looking at the other point.point.lookAt(otherPoint)Return the angle in radians.
-
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Return the calculated theta value through atan2 and built to offload some of the boring. The direction denotes the "gravity" pull. Generally this is
DOWN.Synonymous to:
let theta = Math.atan2(point.y, point.x); let theta = Math.atan2(point.y - other.y, point.x - other.x); let theta = Math.atan2(point.y - other.y, point.x - other.x) - DOWN; -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
ABOVE X method
Multiline - touching.
Set the X (horizontal | latitude | across) value of the positionable. From cooridinate top left `(0,0)``
point.x = 100If the given value is a function, the function is called immediately, with this positionable as the first argument.
stage.center.x = (p)=>200 -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Set the Y (vertical | height | longtitude) value of the positionable. From cooridinate top left `(0,0)``
point.x = 100If the given value is a function, the function is called immediately, with this positionable as the first argument.
stage.center.x = (p)=>200 -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Set the given
key,value, assuming the given key is a "special" string, such as "radius". This method is called by the special getters and setters for this point:const point = new Point(100,300, 20) point.setSpecial('radius', 55)Synonymous to:
point.radius = 55 -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
A callback executed by setSpecial when a "special" property is called.
If a method on this point exists matching the set method pattern, the method is called with the given
value:class MyPoint extends Point { radiusSet(value) { console.log('New Radius value is', value) } } -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Return a stored special value given a
key.If the
relIndexproperty is not None, the relative value found at the index (within this points relative data Array), add the stashed relative value to the result.const point = new Point(100,300, 20) point.getSpecial('radius', 2) // 20if a default value is given, and the internal
keyvalue does not exist, return the default value:point.getSpecial('banana', 'yellow') 'yellow' -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Returns a new point, with the XY set at the point that is
offsettimes the distance from the current point to the other point.this function is also
lerpfor linear interpolation
ClassDeclarationclassTooling
extends Rotationclass comments:str such as this["rotation"]
-
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
return a point relative from this point towards the
other, offset by the given numberoffsetvalue. ThepointIndex(default 0) identifies from which point [this, other] to offset. -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Set the rotation in degrees (0 to 360). If
this.modulusRotateistrue(default), the given value is fixed through modulus 360point.rotation = 600 // 240 point.rotation += 1 // 241To set the rotation (degrees) whilst accounting for the UP vector, consider the
rotate()method. -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Rotate the point such that the angle relative to the
otherPointis0, essentially looking at the other point.point.lookAt(otherPoint)Return the angle in radians.
-
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Return the calculated theta value through atan2 and built to offload some of the boring. The direction denotes the "gravity" pull. Generally this is
DOWN.Synonymous to:
let theta = Math.atan2(point.y, point.x); let theta = Math.atan2(point.y - other.y, point.x - other.x); let theta = Math.atan2(point.y - other.y, point.x - other.x) - DOWN; -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
ABOVE X method
Multiline - touching.
Set the X (horizontal | latitude | across) value of the positionable. From cooridinate top left `(0,0)``
point.x = 100If the given value is a function, the function is called immediately, with this positionable as the first argument.
stage.center.x = (p)=>200 -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Set the Y (vertical | height | longtitude) value of the positionable. From cooridinate top left `(0,0)``
point.x = 100If the given value is a function, the function is called immediately, with this positionable as the first argument.
stage.center.x = (p)=>200 -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Set the given
key,value, assuming the given key is a "special" string, such as "radius". This method is called by the special getters and setters for this point:const point = new Point(100,300, 20) point.setSpecial('radius', 55)Synonymous to:
point.radius = 55 -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
A callback executed by setSpecial when a "special" property is called.
If a method on this point exists matching the set method pattern, the method is called with the given
value:class MyPoint extends Point { radiusSet(value) { console.log('New Radius value is', value) } } -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Return a stored special value given a
key.If the
relIndexproperty is not None, the relative value found at the index (within this points relative data Array), add the stashed relative value to the result.const point = new Point(100,300, 20) point.getSpecial('radius', 2) // 20if a default value is given, and the internal
keyvalue does not exist, return the default value:point.getSpecial('banana', 'yellow') 'yellow' -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Returns a new point, with the XY set at the point that is
offsettimes the distance from the current point to the other point.this function is also
lerpfor linear interpolation
ClassDeclarationclassPoint
extends Toolingclass comments:The
Pointis the primary class for manipulating XY 2D points.Arguments:
new Point(100, 200)Object | Array:
new Point({x: 100, y: 200}) new Point([100, 200])Properties:
point = new Point point.x = 100 point.y = 200-
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
A new point accepts arguments, an object, or an array.
By default the
Pointaccepts up to four argumentsnew Point(x, y, radius, rotation)The same properties may be supplied as a single
Array:new Point([x, y, radius, rotation])If the given object is an
object, we can assign properties immediately:point = new Point({x, y, radius, rotation, other:100}) point.other // 100 -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
return a point relative from this point towards the
other, offset by the given numberoffsetvalue. ThepointIndex(default 0) identifies from which point [this, other] to offset. -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Set the rotation in degrees (0 to 360). If
this.modulusRotateistrue(default), the given value is fixed through modulus 360point.rotation = 600 // 240 point.rotation += 1 // 241To set the rotation (degrees) whilst accounting for the UP vector, consider the
rotate()method. -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Rotate the point such that the angle relative to the
otherPointis0, essentially looking at the other point.point.lookAt(otherPoint)Return the angle in radians.
-
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Return the calculated theta value through atan2 and built to offload some of the boring. The direction denotes the "gravity" pull. Generally this is
DOWN.Synonymous to:
let theta = Math.atan2(point.y, point.x); let theta = Math.atan2(point.y - other.y, point.x - other.x); let theta = Math.atan2(point.y - other.y, point.x - other.x) - DOWN; -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
ABOVE X method
Multiline - touching.
Set the X (horizontal | latitude | across) value of the positionable. From cooridinate top left `(0,0)``
point.x = 100If the given value is a function, the function is called immediately, with this positionable as the first argument.
stage.center.x = (p)=>200 -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Set the Y (vertical | height | longtitude) value of the positionable. From cooridinate top left `(0,0)``
point.x = 100If the given value is a function, the function is called immediately, with this positionable as the first argument.
stage.center.x = (p)=>200 -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Set the given
key,value, assuming the given key is a "special" string, such as "radius". This method is called by the special getters and setters for this point:const point = new Point(100,300, 20) point.setSpecial('radius', 55)Synonymous to:
point.radius = 55 -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
A callback executed by setSpecial when a "special" property is called.
If a method on this point exists matching the set method pattern, the method is called with the given
value:class MyPoint extends Point { radiusSet(value) { console.log('New Radius value is', value) } } -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Return a stored special value given a
key.If the
relIndexproperty is not None, the relative value found at the index (within this points relative data Array), add the stashed relative value to the result.const point = new Point(100,300, 20) point.getSpecial('radius', 2) // 20if a default value is given, and the internal
keyvalue does not exist, return the default value:point.getSpecial('banana', 'yellow') 'yellow' -
dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
Returns a new point, with the XY set at the point that is
offsettimes the distance from the current point to the other point.this function is also
lerpfor linear interpolation
ExpressionStatement:
dict_keys(['type', 'expression', 'pos'])ExpressionStatement:
dict_keys(['type', 'expression', 'pos'])ExpressionStatement:
dict_keys(['type', 'expression', 'pos']) -