Methods
(static) create()
Create a new connector. A connector allows two objects to be connected at predefined positions.
For example a servo motor and a servo horn can both have a connector called 'shaft'. The horn can be moved and rotated to any position, and then the servo horn is attached to the servo motor at the proper position, such that the two connectors match. Connectors are children of the solid, transform-wise, so transformations are applied to both solid and connector(s). (parent => child relationship)
Properties:
Name | Type | Description |
---|---|---|
point |
vec3 | the position of the connector (relative to its parent) |
axis |
vec3 | the direction (unit vector) of the connector |
normal |
vec3 | the direction (unit vector) perpendicular to axis, that defines the "12 o'clock" orientation of the connector |
- Source:
Example
let myconnector = create()
(static) fromPointsAxisNormal(point, axis, normal) → {connector}
Create a connector from the given point, axis and normal.
Parameters:
Name | Type | Description |
---|---|---|
point |
vec3 | the point of the connector, relative to the parent geometry |
axis |
vec3 | the axis (directional vector) of the connector |
normal |
vec3 | the normal (directional vector) of the connector, perpendicular to the axis |
- Source:
Returns:
a new connector
- Type
- connector
(static) toString(connector) → {string}
Return a string representing the given connector.
Parameters:
Name | Type | Description |
---|---|---|
connector |
connector | the connector of reference |
- Source:
Returns:
string representation
- Type
- string
(static) transform(matrix, connector) → {connector}
Transform the give connector using the given matrix.
Parameters:
Name | Type | Description |
---|---|---|
matrix |
mat4 | a transform matrix |
connector |
connector | the connector to transform |
- Source:
Returns:
a new connector
- Type
- connector
(static) transformationBetween(options, from, to) → {mat4}
Get the transformation matrix that connects the given connectors.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
|||||||||||||||
from |
connector | connector from which to connect |
|||||||||||||||
to |
connector | connector to which to connected |
Returns:
- the matrix that transforms (connects) one connector to another
- Type
- mat4