Classes
Members
(static) INCH_TO_MILLIMETER
Constant for converting inches values into millimeters values.
(static) MILLIMETER_TO_INCH
Constant for converting millimeters values into inches values.
Methods
(static) copyObject(object) → {object}
Returns the copy of the object.
Parameters:
Name | Type | Description |
---|---|---|
object |
object | The object. |
Returns:
The copy of the object.
- Type
- object
(static) crossProduct2(v1, v2) → {number}
Does a 2D cross product.
Parameters:
Name | Type | Description |
---|---|---|
v1 |
Point | The first vector. |
v2 |
Point | The second vector. |
Returns:
The result on the Z axis.
- Type
- number
(static) dotProduct2(v1, v2) → {number}
Does a 2D dot product.
Parameters:
Name | Type | Description |
---|---|---|
v1 |
Point | The first vector. |
v2 |
Point | The second vector. |
Returns:
The result.
- Type
- number
(static) findAngleOrientedVectors2(v1, v2, positive) → {number}
Returns the signed angle in radian in 2d (between -2pi and 2pi).
Parameters:
Name | Type | Description |
---|---|---|
v1 |
Point | The first vector. |
v2 |
Point | The second vector. |
positive |
boolean | If the oriented angle goes counter-clockwise. |
Returns:
The angle in radian.
- Type
- number
(static) findAngleVectors2(v1, v2) → {number}
Returns the signed angle in radian in 2D (between -PI and PI).
Parameters:
Name | Type | Description |
---|---|---|
v1 |
Point | The first vector. |
v2 |
Point | The second vector. |
Returns:
The angle in radian.
- Type
- number
(static) findAxes(crossAxe) → {Axes}
Returns object of 3 axes:
re is the axes for REal numbers;
im for the IMaginary numbers;
cr for the CRoss axis
Parameters:
Name | Type | Description |
---|---|---|
crossAxe |
string | The name of the axis given by the cross product of the vectors defining the plane. Should be "x", "y" or "z", considered "z" if not "x" or "y". |
Returns:
The object defining the real, imaginary and cross axis.
- Type
- Axes
(static) isInclude(value, a, b) → {boolean}
Checks if the value is include between the value a (include) and b (include).
Order between a and b does not matter.
Parameters:
Name | Type | Description |
---|---|---|
value |
number | The value. |
a |
number | The first boundary. |
b |
number | The second boundary. |
Returns:
The result.
- Type
- boolean
(static) lengthVector3(v) → {number}
Calculates the length of a 3D vector.
Parameters:
Name | Type | Description |
---|---|---|
v |
Point | The vector. |
Returns:
The vector length.
- Type
- number
(static) movePoint(point, vector)
Moves the point according to the vector.
Parameters:
Name | Type | Description |
---|---|---|
point |
Point | The point to move. |
vector |
Point | The vector. |
(static) nearlyEqual(a, b, precisionopt) → {boolean}
Checks if two numbers are nearly equal. This function is used to avoid
to have too much precision when checking values between floating-point
numbers.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
a |
number | Number A. | ||
b |
number | Number B. | ||
precision |
number |
<optional> |
GCodeToGeometry.FLOAT_PRECISION | The precision of the comparaison. |
Returns:
True if the two values are nearly equal.
- Type
- boolean
(static) parse(code) → {ParsedGCode}
Parses the GCode into a series of lines and curves and checks if errors.
Parameters:
Name | Type | Description |
---|---|---|
code |
string | The GCode. |
- Source:
Returns:
The parsed GCode.
- Type
- ParsedGCode
(static) scaleAndRotation(center, point, newPoint, angle, length, re, im)
Does a rotation and scale of point according to center. Stores the result in
newPoint.
Parameters:
Name | Type | Description |
---|---|---|
center |
Point | The center of the rotation and scale. |
point |
Point | The point to modify. |
newPoint |
Point | The point storying the result. |
angle |
number | The angle in radians. |
length |
number | The scale ratio. |
re |
string | The real axis. |
im |
string | The imaginary axis. |
(static) swapObjects(obj1, obj2)
Swaps two objects. It has to be the same objects, too bad if it's not.
Parameters:
Name | Type | Description |
---|---|---|
obj1 |
object | The first object. |
obj2 |
object | The second object. |