Class: Vector2

PhotoEditorSDK.Math. Vector2

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

new PhotoEditorSDK.Math.Vector2(x, y)

sdk/lib/math/vector2.js, line 21

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/lib/math/vector2.js, line 227

Makes both numbers of this vector positive

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

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

sdk/lib/math/vector2.js, line 157

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

ceil(){PhotoEditorSDK.Math.Vector2}

sdk/lib/math/vector2.js, line 207

Rounds up the values of this vector

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

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

sdk/lib/math/vector2.js, line 75

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/lib/math/vector2.js, line 54

Creates a clone of this vector

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

copy(other){PhotoEditorSDK.Math.Vector2}

sdk/lib/math/vector2.js, line 63

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/lib/math/vector2.js, line 106

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

equals(vec, y){Boolean}

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

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/lib/math/vector2.js, line 186

Flips the x and y values of this vector

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

floor(){PhotoEditorSDK.Math.Vector2}

sdk/lib/math/vector2.js, line 217

Rounds down the values of this vector

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

len(){Number}

sdk/lib/math/vector2.js, line 237

Returns the euclidean length of this vector

Returns:
Type Description
Number

max(){Number}

sdk/lib/math/vector2.js, line 253

Returns the largest number in this vector

Returns:
Type Description
Number

min(){Number}

sdk/lib/math/vector2.js, line 245

Returns the smallest number in this vector

Returns:
Type Description
Number

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

sdk/lib/math/vector2.js, line 140

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/lib/math/vector2.js, line 197

Rounds the values of this vector

Returns:
Type Description
PhotoEditorSDK.Math.Vector2

roundDecimal(decimals){Number}

sdk/lib/math/vector2.js, line 278

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/lib/math/vector2.js, line 44

Sets the given values

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

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

sdk/lib/math/vector2.js, line 123

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/lib/math/vector2.js, line 261

Returns a POJO of this Vector2

Returns:
Type Description
Object

toString(){String}

sdk/lib/math/vector2.js, line 269

Returns a string representation of this vector

Returns:
Type Description
String

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

sdk/lib/math/vector2.js, line 289

Creates a new Vector2 instance from the given Object

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