Class: Vector2

PhotoEditorSDK.Math~ Vector2

Represents a 2-dimensional vector while providing math functions to modify / clone the vector. Fully chainable.

new Vector2(x, y)

sdk/core/lib/math/vector2.js, line 28

Creates a Vector2

Name Type Description
x Number
y Number

Members

staticPhotoEditorSDK.Math.Vector2.NULL

Returns a null vector

Methods

abs(){PhotoEditorSDK.Math.Vector2}

sdk/core/lib/math/vector2.js, line 242

Makes both numbers of this vector positive

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

add(addend, y){PhotoEditorSDK.Math.Vector2}

sdk/core/lib/math/vector2.js, line 156

Adds the given Vector2 / Numbers to this vector

Name Type Description
addend Number | PhotoEditorSDK.Math.Vector2
y Number optional
Returns:
Type Description
PhotoEditorSDK.Math.Vector2

asArray(reverse){Array.<Number>}

sdk/core/lib/math/vector2.js, line 304

Returns the values in an array

Name Type Default Description
reverse Bool false
Returns:
Type Description
Array.<Number>

ceil(){PhotoEditorSDK.Math.Vector2}

sdk/core/lib/math/vector2.js, line 222

Rounds up the values of this vector

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

clamp(minimum, maximum){PhotoEditorSDK.Math.Vector2}

sdk/core/lib/math/vector2.js, line 76

Clamps this vector with the given Vector2 / Number

Name Type Description
minimum Number | PhotoEditorSDK.Math.Vector2
maximum Number | PhotoEditorSDK.Math.Vector2
Returns:
Type Description
PhotoEditorSDK.Math.Vector2

clone(){PhotoEditorSDK.Math.Vector2}

sdk/core/lib/math/vector2.js, line 55

Creates a clone of this vector

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

copy(other){PhotoEditorSDK.Math.Vector2}

sdk/core/lib/math/vector2.js, line 64

Copies the values of the given vector

Name Type Description
other PhotoEditorSDK.Math.Vector2
Returns:
Type Description
PhotoEditorSDK.Math.Vector2

divide(divisor, y){PhotoEditorSDK.Math.Vector2}

sdk/core/lib/math/vector2.js, line 105

Divides this vector by the given Vector2 / Number

Name Type Description
divisor Number | PhotoEditorSDK.Math.Vector2
y Number optional
Returns:
Type Description
PhotoEditorSDK.Math.Vector2

dot(vec, y){Number}

sdk/core/lib/math/vector2.js, line 174

Computes the dot product of this vector and the given Vector2 / Numbers

Name Type Description
vec Number | PhotoEditorSDK.Math.Vector2
y Number optional
Returns:
Type Description
Number

equals(vec, y){Boolean}

sdk/core/lib/math/vector2.js, line 189

Checks whether the x and y value are the same as the given ones

Name Type Description
vec Number | PhotoEditorSDK.Math.Vector2
y Number
Returns:
Type Description
Boolean

flip(){PhotoEditorSDK.Math.Vector2}

sdk/core/lib/math/vector2.js, line 201

Flips the x and y values of this vector

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

floor(){PhotoEditorSDK.Math.Vector2}

sdk/core/lib/math/vector2.js, line 232

Rounds down the values of this vector

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

len(){Number}

sdk/core/lib/math/vector2.js, line 252

Returns the euclidean length of this vector

Returns:
Type Description
Number

max(){Number}

sdk/core/lib/math/vector2.js, line 268

Returns the largest number in this vector

Returns:
Type Description
Number

min(){Number}

sdk/core/lib/math/vector2.js, line 260

Returns the smallest number in this vector

Returns:
Type Description
Number

multiply(subtrahend, y){PhotoEditorSDK.Math.Vector2}

sdk/core/lib/math/vector2.js, line 139

Multiplies the given Vector2 / Number with this vector

Name Type Description
subtrahend Number | PhotoEditorSDK.Math.Vector2
y Number optional
Returns:
Type Description
PhotoEditorSDK.Math.Vector2

round(){PhotoEditorSDK.Math.Vector2}

sdk/core/lib/math/vector2.js, line 212

Rounds the values of this vector

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

roundDecimal(decimals){Number}

sdk/core/lib/math/vector2.js, line 293

Rounds this vector's values to the given number of decimals

Name Type Description
decimals Number
Returns:
Type Description
Number

set(x, y){PhotoEditorSDK.Math.Vector2}

sdk/core/lib/math/vector2.js, line 45

Sets the given values

Name Type Description
x Number
y Number
Returns:
Type Description
PhotoEditorSDK.Math.Vector2

subtract(subtrahend, y){PhotoEditorSDK.Math.Vector2}

sdk/core/lib/math/vector2.js, line 122

Subtracts the given Vector2 / Number from this vector

Name Type Description
subtrahend Number | PhotoEditorSDK.Math.Vector2
y Number optional
Returns:
Type Description
PhotoEditorSDK.Math.Vector2

toObject(){Object}

sdk/core/lib/math/vector2.js, line 276

Returns a POJO of this Vector2

Returns:
Type Description
Object

toString(){String}

sdk/core/lib/math/vector2.js, line 284

Returns a string representation of this vector

Returns:
Type Description
String

staticPhotoEditorSDK.Math.Vector2.fromObject(object){PhotoEditorSDK.Math.Vector2}

sdk/core/lib/math/vector2.js, line 317

Creates a new Vector2 instance from the given Object

Name Type Description
object Object
Returns:
Type Description
PhotoEditorSDK.Math.Vector2