# SceneScript Class Vec2
Utility class which holds a 2 dimensional value pair: x and y.
# Properties
# x: Number
Value of first component.
# y: Number
Value of second component.
# Constructors
# constructor(x: Number, y: Number): Vec2
Constructor that sets x and y respectively.
# constructor(): Vec2
Empty constructor sets all components to 0.
# constructor(value: Number): Vec2
Sets both x and y members to parameter value.
# constructor(value: String): Vec2
Will parse the first two numbers from the string and set x and y respectively.
# constructor(value: Vec3): Vec2
Will use x and y from value and set members respectively.
# Functions
# length(): Number
Returns length of the vector.
# lengthSqr(): Number
Returns squared length of the vector. This is more efficient, so if you only need a binary comparison, use this.
# distance(other: Vec2): Number;
Distance to another vector.
# distanceSqr(other: Vec2): Number;
Distance squared to another vector (more efficient for simple comparisons in your code).
# normalize(): Vec2
Normalizes the vector and returns the result as a new object.
# copy(): Vec2
Makes a copy.
# equals(other: Vec2): Boolean;
Checks if one vector is equal (with epsilon) to another vector.
# isFinite(): Boolean;
Checks if all components are finite numbers.
# negate(): Vec2;
Returns the vector negated component-wise
# add(value: Number|Vec2): Vec2
Adds parameter to both components and returns result as a new object.
# subtract(value: Number|Vec2): Vec2
Subtracts parameter to both components and returns result as a new object.
# multiply(value: Number|Vec2): Vec2
Multiplies both components with parameter and returns result as a new object.
# divide(value: Number|Vec2): Vec2
Divides both components by parameter and returns result as a new object. Does not check for zero division.
# dot(value: Vec2): Number
Computes dot product with vector value.
# reflect(normal: Vec2): Vec2
Returns reflection vector along normal. Make sure that normal is normalized.
# mix(other: Vec2, amount: Number): Vec2
Interpolate between this vector and another vector of the same dimension. You can set the interpolation using the amount parameter, it accepts values between 0.00 and 1.00 where 1.00 represents the other vector. By setting it to 0.5, for example, you will interpolate halfway between this and the other vector.
# min(value: Vec2): Vec2
Return the smaller value per component of two vectors.
# max(value: Vec2): Vec2;
Return the larger value per component of two vectors.
# clamp(min: Number|Vec2, max: Number|Vec2): Vec2;
Clamps each component between min and max bounds (each may be a scalar or a vector).
# perpendicular(): Vec2
Returns perpendicular copy of the vector.
# abs(): Vec2
Returns absolute values for each vector component.
# sign(): Vec2
Returns sign of each vector component.
# round(): Vec2
Rounds each vector component.
# floor(): Vec2
Returns floor value of each vector component.
# ceil(): Vec2
Returns ceil value of each vector component.
# fract(): Vec2;
Returns the fractional part of each component (x - floor(x)).
# mod(value: Number|Vec2): Vec2;
Modulo per component following GLSL semantics: x - y * floor(x / y).
# step(edge: Number|Vec2): Vec2;
Per-component step: returns 0 where this < edge, 1 otherwise.
# smoothStep(min: Number|Vec2, max: Number|Vec2): Vec2;
Per-component smooth interpolation between min and max edges.
# toString(): String
Concatenates components with a space in-between so that it can also be parsed again.