Class: DefNormalVector

algeobra~DefNormalVector(params)

Definition of a normal vector that can be constructed in various ways. A vector consists of x and y coordinates specifying its direction and length and a reference point to which it is attached to. While a mathematical vector is of course not bound to a specific point, this makes working with and displaying vectors easier

Constructor

new DefNormalVector(params)

Constructor sets default values
Parameters:
Name Type Description
params Object
Properties
Name Type Description
ref Object The point to which this vector is attached to
normalize Boolean Whether or not this vector should be normalized
Source:

Methods

compute(createInfo) → {Object}

Computes the normal vector value
Parameters:
Name Type Description
createInfo CreateInfo The create information
Source:
Returns:
The normal with type TYPE_VECTOR
Type
Object

(static) circleNormal(p, center, r) → {Object}

Computes the normal of a point with respect to a circle. Will be scaled according to 2 / r^2 [x,y]
Parameters:
Name Type Description
p Object The point
center Object The circle center
r Number The circle radius
Source:
Returns:
The circle normal
Type
Object

(static) ellipseNormal(p, center, rx, ry, rotation) → {Object}

Computes the normal of a point with respect to an ellipse. Will be scaled according to [2x / rx^2 , 2y / ry^2]
Parameters:
Name Type Description
p Object The point
center Object The ellipse center
rx Number The ellipse x-eccentricity
ry Number The ellipse y-eccentricity
rotation Number The ellipse rotation
Source:
Returns:
The normal
Type
Object

(static) fromArc(p, arc, normalizeopt) → {CreateInfo}

Creates a normal at a point with respect to the given arc/circle. The point is the reference point as well.
Parameters:
Name Type Attributes Description
p Number | Object Either the index or value of a TYPE_POINT. The point
arc Number | Object Either the index or value of a TYPE_ARC. The circle
normalize Number | Object <optional>
Either the index or value of a TYPE_BOOLEAN. Whether the vector should be normalized
Source:
Returns:
The creation info
Type
CreateInfo

(static) fromCoordinates(params) → {CreateInfo}

Creates a new normal vector from individual vector components
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Description
x Number | Object Either the index or value of a TYPE_NUMBER. The x coordinate
y Number | Object Either the index or value of a TYPE_NUMBER. The y coordinate
ref Number | Object <optional>
Either the index or value of a TYPE_POINT. The reference point
normalize Number | Object <optional>
Either the index or value of a TYPE_BOOLEAN. Whether the vector should be normalized
Source:
Returns:
The creation info
Type
CreateInfo

(static) fromEllipse(p, ellipse, normalizeopt) → {CreateInfo}

Creates a normal at a point with respect to the given ellipse. The point is the reference point as well.
Parameters:
Name Type Attributes Description
p Number | Object Either the index or value of a TYPE_POINT. The point
ellipse Number | Object Either the index or value of a TYPE_ELLIPSE. The ellipse
normalize Number | Object <optional>
Either the index or value of a TYPE_BOOLEAN. Whether the vector should be normalized
Source:
Returns:
The creation info
Type
CreateInfo

(static) fromLine(line, normalizeopt) → {CreateInfo}

Creates a new normal vector from a line segment The vector will use the first line point as a reference and point to the second point
Parameters:
Name Type Attributes Description
line Number | Object Either the index or value of a TYPE_LINE. The line
normalize Number | Object <optional>
Either the index or value of a TYPE_BOOLEAN. Whether the vector should be normalized
Source:
Returns:
The creation info
Type
CreateInfo

(static) fromPointCoordinates(params) → {CreateInfo}

Creates a new normal vector from the position vector of a point.
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Description
p Number | Object Either the index or value of a TYPE_POINT. The position
normalize Number | Object <optional>
Either the index or value of a TYPE_BOOLEAN. Whether the vector should be normalized
Source:
Returns:
The creation info
Type
CreateInfo

(static) fromPoints(params) → {CreateInfo}

Creates a new normal vector from two points The vector will use the first point as a reference and point to the second point
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Description
p0 Number | Object Either the index or value of a TYPE_POINT. The first point
p1 Number | Object Either the index or value of a TYPE_POINT. The second point
ref Number | Object <optional>
Either the index or value of a TYPE_POINT. The reference point
normalize Number | Object <optional>
Either the index or value of a TYPE_BOOLEAN. Whether the vector should be normalized
Source:
Returns:
The creation info
Type
CreateInfo

(static) fromVector(params) → {CreateInfo}

Creates a new normal vector from another vector. If only a vector and no reference is given, the other vector's reference is used
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Description
v Number | Object Either the index or value of a TYPE_VECTOR. The vector
ref Number | Object <optional>
Either the index or value of a TYPE_POINT. The reference point
normalize Number | Object <optional>
Either the index or value of a TYPE_BOOLEAN. Whether the vector should be normalized
Source:
Returns:
The creation info
Type
CreateInfo