Class: DefVectorOps

algeobra~DefVectorOps()

Easier access to some common vector operations. These could also easily be implemented by a DefFunc

Constructor

new DefVectorOps()

Source:

Methods

compute(info)

Computes the specified operation
Parameters:
Name Type Description
info CreateInfo The creation info
Source:
Returns:
The result of the operation of the type specified for the different from methods

(static) fromAttach(a, b, refopt) → {CreateInfo}

Attaches the second vector at the tip of the first. The result is a vector that points from the first vector's reference point to the tip of the second. Optionally, a new reference point may be specified. The result will be of type TYPE_VECTOR NOTE: This will be equivalent to adding the vectors and placing them at the reference, if they share the same reference point.
Parameters:
Name Type Attributes Description
a Number | Object Either the index or value of a TYPE_VECTOR. The first vector
b Number | Object Either the index or value of a TYPE_VECTOR. The vector to be attached
ref Number | Object <optional>
Either the index or value of a TYPE_POINT. The new reference
Source:
Returns:
The creation info
Type
CreateInfo

(static) fromDot(a, b) → {CreateInfo}

Computes the dot product of two vectors. The result will be of type TYPE_NUMBER
Parameters:
Name Type Description
a Number | Object Either the index or value of a TYPE_VECTOR. The first vector
b Number | Object Either the index or value of a TYPE_VECTOR. The second vector
Source:
Returns:
The creation info
Type
CreateInfo

(static) fromNegate(a, attachAtEndPointopt) → {CreateInfo}

Negates the given vectors Optionally, the reference point can be switched to the old arrow tip, so the arrow overall stays in the same place The result will be of type TYPE_VECTOR
Parameters:
Name Type Attributes Default Description
a Number | Object Either the index or value of a TYPE_VECTOR. The vector
attachAtEndPoint Boolean <optional>
false Whether or not the new vector will be attached at the old arrow tip
Source:
Returns:
The creation info
Type
CreateInfo

(static) fromTransform(a, params, defaultValuesopt) → {CreateInfo}

Transforms a given vector by rotation and scaling Optionally, a new reference point may be specified. The result will be of type TYPE_VECTOR
Parameters:
Name Type Attributes Description
a Number | Object Either the index or value of a TYPE_VECTOR. The vector
params Object
Properties
Name Type Attributes Description
alpha Number | Object <optional>
Either the index or value of a TYPE_NUMBER. The rotation angle
scale Number | Object <optional>
Either the index or value of a TYPE_NUMBER. The scaling factor
normalize Number | Object <optional>
Either the index or value of a TYPE_BOOLEAN. Whether the vector should be normalized before scaling
ref Number | Object <optional>
Either the index or value of a TYPE_POINT. The new reference point
defaultValues Object <optional>
Properties
Name Type Attributes Default Description
alpha Number <optional>
0 Default value for the rotation angle
scale Number <optional>
1 Default value for the scaling factor
normalize Number <optional>
false Default value for the normalization
Source:
Returns:
The creation info
Type
CreateInfo