Class: Center

Center

new Center(position)

A center connection and location in a graph object
Name Type Description
position Vector The location of the Center object
Properties:
Name Type Description
id number The id of the center in the graph object
neighbors Polygon Set of adjacent polygon centers
borders Array.<Line> Set of bordering edges
corners Polygon Set of polygon corners
border boolean Is this polygon touching the border edge
data object The data stored by the center object. This is the data that is to be changed by the user
parent Center The parent object to the current object. The default is null, there is no parent.
children Array.<Center> The children objects to the current object. The default is an empty list

Extends

Methods

Add this vector with another vector element wise
Name Type Description
other Vector The other vector
Returns:
Type Description
Vector The vector result of adding the two vectors

inherited cross(other){number}

Get the cross product of this and the other vector
Name Type Description
other Vector The other vector
Returns:
Type Description
number The cross product of this and the other vector
Divide the vector by a scalar value
Name Type Description
scalar number
Returns:
Type Description
Vector The result of multiplying the vector by a scalar

inherited dot(other){number}

Get the dot product of this vector and another vector
Name Type Description
other Vector The other vector
Returns:
Type Description
number The dot product of this and the other vector
Get the vector key:Symbol representation
Returns:
Type Description
Symbol The vector key element

inherited list(){Array.<number>}

Get the vector in list form
Returns:
Type Description
Array.<number> List representation of the vector of length 2

inherited magnitude(){number}

Get the magnitude of the vector
Returns:
Type Description
number The magniture of the vector
Multiply the vector by a scalar value
Name Type Description
scalar number The number to multiply the vector by
Returns:
Type Description
Vector The result of multiplying the vector by a scalar element wise
Get the normal vector of the current vector.
Returns:
Type Description
Vector A vector that is the normal compenent of the vector

inherited perpendiculars(){Array.<Vector>}

Get the two normal vectors that are perpendicular to the current vector
Returns:
Type Description
Array.<Vector> The two normal vectors that are perpendicular to the vector. The first vector is the normal vector that is +90 deg or +PI/2 rad. The second vector is the noraml vector that is -90 deg or -PI/2 rad.
Get the get the current vector rotated by a certain ammount
Name Type Description
radians number
Returns:
Type Description
Vector The vector that results from rotating the current vector by a particular ammount
Subtract this vector with another vector element wise
Name Type Description
other Vector The other vector
Returns:
Type Description
Vector The vector result of subtracting the two vectors

inherited toString(){string}

Returns the vector as a string of (x, y)
Returns:
Type Description
string The string representation of a vector in (x, y) form