Library "Vector2"
Representation of two dimensional vectors or points.
This structure is used to represent positions in two dimensional space or vectors,
for example in spacial coordinates in 2D space.
~~~
references:
docs.unity3d.com/Scr...ference/Vector2.html
gist.github.com/wind...a1aa09c3499e09edbd33
github.com/dogancoru...master/js/vector2.js
gist.github.com/Dali...7d030deb37a7bfeff454
gist.github.com/jean...5e5df770b532f696af2d
gist.github.com/volkansalma/2972237
~~~

new(x, y)
  Create a new Vector2 object.
  Parameters:
    x: float . The x value of the vector, default=0.
    y: float . The y value of the vector, default=0.
  Returns: Vector2. Vector2 object.
-> usage:
`unitx = Vector2.new(1.0) , plot(unitx.x)`

from(value)
  Assigns value to a new vector `x,y` elements.
  Parameters:
    value: float, x and y value of the vector.
  Returns: Vector2. Vector2 object.
-> usage:
`one = Vector2.from(1.0), plot(one.x)`

from(value, element_sep, open_par, close_par)
  Assigns value to a new vector `x,y` elements.
  Parameters:
    value: string . The `x` and `y` value of the vector in a `x,y` or `(x,y)` format, spaces and parentesis will be removed automatically.
    element_sep: string . Element separator character, default=`,`.
    open_par: string . Open parentesis character, default=`(`.
    close_par: string . Close parentesis character, default=`)`.
  Returns: Vector2. Vector2 object.
-> usage:
`one = Vector2.from("1.0,2"), plot(one.x)`

copy(this)
  Creates a deep copy of a vector.
  Parameters:
    this: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = Vector2.new(1.0) , b = a.copy() , plot(b.x)`

down()
  Vector in the form `(0, -1)`.
  Returns: Vector2. Vector2 object.

left()
  Vector in the form `(-1, 0)`.
  Returns: Vector2. Vector2 object.

right()
  Vector in the form `(1, 0)`.
  Returns: Vector2. Vector2 object.

up()
  Vector in the form `(0, 1)`.
  Returns: Vector2. Vector2 object.

one()
  Vector in the form `(1, 1)`.
  Returns: Vector2. Vector2 object.

zero()
  Vector in the form `(0, 0)`.
  Returns: Vector2. Vector2 object.

minus_one()
  Vector in the form `(-1, -1)`.
  Returns: Vector2. Vector2 object.

unit_x()
  Vector in the form `(1, 0)`.
  Returns: Vector2. Vector2 object.

unit_y()
  Vector in the form `(0, 1)`.
  Returns: Vector2. Vector2 object.

nan()
  Vector in the form `(float(na), float(na))`.
  Returns: Vector2. Vector2 object.

xy(this)
  Return the values of `x` and `y` as a tuple.
  Parameters:
    this: Vector2 . Vector2 object.
  Returns: .
-> usage:
`a = Vector2.new(1.0, 1.0) , = a.xy() , plot(ax)`

length_squared(this)
  Length of vector `a` in the form. `a.x^2 + a.y^2`, for comparing vectors this is computationaly lighter.
  Parameters:
    this: Vector2 . Vector2 object.
  Returns: float. Squared length of vector.
-> usage:
`a = Vector2.new(1.0, 1.0) , plot(a.length_squared())`

length(this)
  Magnitude of vector `a` in the form. `sqrt(a.x^2 + a.y^2)`
  Parameters:
    this: Vector2 . Vector2 object.
  Returns: float. Length of vector.
-> usage:
`a = Vector2.new(1.0, 1.0) , plot(a.length())`

normalize(a)
  Vector normalized with a magnitude of 1, in the form. `a / length(a)`.
  Parameters:
    a: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = normalize(Vector2.new(3.0, 2.0)) , plot(a.y)`

isNA(this)
  Checks if any of the components is `na`.
  Parameters:
    this: Vector2 . Vector2 object.
  Returns: bool.
usage:
p = Vector2.new(1.0, na) , plot(isNA(p)?1:0)

add(a, b)
  Adds vector `b` to `a`, in the form `(a.x + b.x, a.y + b.y)`.
  Parameters:
    a: Vector2 . Vector2 object.
    b: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = one() , b = one() , c = add(a, b) , plot(c.x)`

add(a, b)
  Adds vector `b` to `a`, in the form `(a.x + b, a.y + b)`.
  Parameters:
    a: Vector2 . Vector2 object.
    b: float . Value.
  Returns: Vector2. Vector2 object.
-> usage:
`a = one() , b = 1.0 , c = add(a, b) , plot(c.x)`

add(a, b)
  Adds vector `b` to `a`, in the form `(a + b.x, a + b.y)`.
  Parameters:
    a: float . Value.
    b: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = 1.0 , b = one() , c = add(a, b) , plot(c.x)`

subtract(a, b)
  Subtract vector `b` from `a`, in the form `(a.x - b.x, a.y - b.y)`.
  Parameters:
    a: Vector2 . Vector2 object.
    b: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = one() , b = one() , c = subtract(a, b) , plot(c.x)`

subtract(a, b)
  Subtract vector `b` from `a`, in the form `(a.x - b, a.y - b)`.
  Parameters:
    a: Vector2 . vector2 object.
    b: float . Value.
  Returns: Vector2. Vector2 object.
-> usage:
`a = one() , b = 1.0 , c = subtract(a, b) , plot(c.x)`

subtract(a, b)
  Subtract vector `b` from `a`, in the form `(a - b.x, a - b.y)`.
  Parameters:
    a: float . value.
    b: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = 1.0 , b = one() , c = subtract(a, b) , plot(c.x)`

multiply(a, b)
  Multiply vector `a` with `b`, in the form `(a.x * b.x, a.y * b.y)`.
  Parameters:
    a: Vector2 . Vector2 object.
    b: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = one() , b = one() , c = multiply(a, b) , plot(c.x)`

multiply(a, b)
  Multiply vector `a` with `b`, in the form `(a.x * b, a.y * b)`.
  Parameters:
    a: Vector2 . Vector2 object.
    b: float . Value.
  Returns: Vector2. Vector2 object.
-> usage:
`a = one() , b = 1.0 , c = multiply(a, b) , plot(c.x)`

multiply(a, b)
  Multiply vector `a` with `b`, in the form `(a * b.x, a * b.y)`.
  Parameters:
    a: float . Value.
    b: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = 1.0 , b = one() , c = multiply(a, b) , plot(c.x)`

divide(a, b)
  Divide vector `a` with `b`, in the form `(a.x / b.x, a.y / b.y)`.
  Parameters:
    a: Vector2 . Vector2 object.
    b: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = from(3.0) , b = from(2.0) , c = divide(a, b) , plot(c.x)`

divide(a, b)
  Divide vector `a` with value `b`, in the form `(a.x / b, a.y / b)`.
  Parameters:
    a: Vector2 . Vector2 object.
    b: float . Value.
  Returns: Vector2. Vector2 object.
-> usage:
`a = from(3.0) , b = 2.0 , c = divide(a, b) , plot(c.x)`

divide(a, b)
  Divide value `a` with vector `b`, in the form `(a / b.x, a / b.y)`.
  Parameters:
    a: float . Value.
    b: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = 3.0 , b = from(2.0) , c = divide(a, b) , plot(c.x)`

negate(a)
  Negative of vector `a`, in the form `(-a.x, -a.y)`.
  Parameters:
    a: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = from(3.0) , b = a.negate , plot(b.x)`

pow(a, b)
  Raise vector `a` with exponent vector `b`, in the form `(a.x ^ b.x, a.y ^ b.y)`.
  Parameters:
    a: Vector2 . Vector2 object.
    b: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = from(3.0) , b = from(2.0) , c = pow(a, b) , plot(c.x)`

pow(a, b)
  Raise vector `a` with value `b`, in the form `(a.x ^ b, a.y ^ b)`.
  Parameters:
    a: Vector2 . Vector2 object.
    b: float . Value.
  Returns: Vector2. Vector2 object.
-> usage:
`a = from(3.0) , b = 2.0 , c = pow(a, b) , plot(c.x)`

pow(a, b)
  Raise value `a` with vector `b`, in the form `(a ^ b.x, a ^ b.y)`.
  Parameters:
    a: float . Value.
    b: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = 3.0 , b = from(2.0) , c = pow(a, b) , plot(c.x)`

sqrt(a)
  Square root of the elements in a vector.
  Parameters:
    a: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = from(3.0) , b = sqrt(a) , plot(b.x)`

abs(a)
  Absolute properties of the vector.
  Parameters:
    a: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = from(-3.0) , b = abs(a) , plot(b.x)`

min(a)
  Lowest element of a vector.
  Parameters:
    a: Vector2 . Vector2 object.
  Returns: float.
-> usage:
`a = new(3.0, 1.5) , b = min(a) , plot(b)`

max(a)
  Highest element of a vector.
  Parameters:
    a: Vector2 . Vector2 object.
  Returns: float.
-> usage:
`a = new(3.0, 1.5) , b = max(a) , plot(b)`

vmax(a, b)
  Highest elements of two vectors.
  Parameters:
    a: Vector2 . Vector2 object.
    b: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.0, 2.0) , b = new(2.0, 3.0) , c = vmax(a, b) , plot(c.x)`

vmax(a, b, c)
  Highest elements of three vectors.
  Parameters:
    a: Vector2 . Vector2 object.
    b: Vector2 . Vector2 object.
    c: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.0, 2.0) , b = new(2.0, 3.0) , c = new(1.5, 4.5) , d = vmax(a, b, c) , plot(d.x)`

vmin(a, b)
  Lowest elements of two vectors.
  Parameters:
    a: Vector2 . Vector2 object.
    b: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.0, 2.0) , b = new(2.0, 3.0) , c = vmin(a, b) , plot(c.x)`

vmin(a, b, c)
  Lowest elements of three vectors.
  Parameters:
    a: Vector2 . Vector2 object.
    b: Vector2 . Vector2 object.
    c: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.0, 2.0) , b = new(2.0, 3.0) , c = new(1.5, 4.5) , d = vmin(a, b, c) , plot(d.x)`

perp(a)
  Perpendicular Vector of `a`, in the form `(a.y, -a.x)`.
  Parameters:
    a: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.0, 1.5) , b = perp(a) , plot(b.x)`

floor(a)
  Compute the floor of vector `a`.
  Parameters:
    a: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.0, 1.5) , b = floor(a) , plot(b.x)`

ceil(a)
  Ceils vector `a`.
  Parameters:
    a: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.0, 1.5) , b = ceil(a) , plot(b.x)`

ceil(a, digits)
  Ceils vector `a`.
  Parameters:
    a: Vector2 . Vector2 object.
    digits: int . Digits to use as ceiling.
  Returns: Vector2. Vector2 object.

round(a)
  Round of vector elements.
  Parameters:
    a: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.0, 1.5) , b = round(a) , plot(b.x)`

round(a, precision)
  Round of vector elements.
  Parameters:
    a: Vector2 . Vector2 object.
    precision: int . Number of digits to round vector "a" elements.
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(0.123456, 1.234567) , b = round(a, 2) , plot(b.x)`

fractional(a)
  Compute the fractional part of the elements from vector `a`.
  Parameters:
    a: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.123456, 1.23456) , b = fractional(a) , plot(b.x)`

dot_product(a, b)
  dot_product product of 2 vectors, in the form `a.x * b.x + a.y * b.y.
  Parameters:
    a: Vector2 . Vector2 object.
    b: Vector2 . Vector2 object.
  Returns: float.
-> usage:
`a = new(3.0, 1.5) , b = from(2.0) , c = dot_product(a, b) , plot(c)`

cross_product(a, b)
  cross product of 2 vectors, in the form `a.x * b.y - a.y * b.x`.
  Parameters:
    a: Vector2 . Vector2 object.
    b: Vector2 . Vector2 object.
  Returns: float.
-> usage:
`a = new(3.0, 1.5) , b = from(2.0) , c = cross_product(a, b) , plot(c)`

equals(a, b)
  Compares two vectors
  Parameters:
    a: Vector2 . Vector2 object.
    b: Vector2 . Vector2 object.
  Returns: bool. Representing the equality.
-> usage:
`a = new(3.0, 1.5) , b = from(2.0) , c = equals(a, b) ? 1 : 0 , plot(c)`

sin(a)
  Compute the sine of argument vector `a`.
  Parameters:
    a: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.0, 1.5) , b = sin(a) , plot(b.x)`

cos(a)
  Compute the cosine of argument vector `a`.
  Parameters:
    a: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.0, 1.5) , b = cos(a) , plot(b.x)`

tan(a)
  Compute the tangent of argument vector `a`.
  Parameters:
    a: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.0, 1.5) , b = tan(a) , plot(b.x)`

atan2(x, y)
  Approximation to atan2 calculation, arc tangent of `y/x` in the range (-pi,pi) radians.
  Parameters:
    x: float . The x value of the vector.
    y: float . The y value of the vector.
  Returns: float. Value with angle in radians. (negative if quadrante 3 or 4)
-> usage:
`a = new(3.0, 1.5) , b = atan2(a.x, a.y) , plot(b)`

atan2(a)
  Approximation to atan2 calculation, arc tangent of `y/x` in the range (-pi,pi) radians.
  Parameters:
    a: Vector2 . Vector2 object.
  Returns: float, value with angle in radians. (negative if quadrante 3 or 4)
-> usage:
`a = new(3.0, 1.5) , b = atan2(a) , plot(b)`

distance(a, b)
  Distance between vector `a` and `b`.
  Parameters:
    a: Vector2 . Vector2 object.
    b: Vector2 . Vector2 object.
  Returns: float.
-> usage:
`a = new(3.0, 1.5) , b = from(2.0) , c = distance(a, b) , plot(c)`

rescale(a, length)
  Rescale a vector to a new magnitude.
  Parameters:
    a: Vector2 . Vector2 object.
    length: float . Magnitude.
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.0, 1.5) , b = 2.0 , c = rescale(a, b) , plot(c.x)`

rotate(a, radians)
  Rotates vector by a angle.
  Parameters:
    a: Vector2 . Vector2 object.
    radians: float . Angle value in radians.
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.0, 1.5) , b = 2.0 , c = rotate(a, b) , plot(c.x)`

rotate_degree(a, degree)
  Rotates vector by a angle.
  Parameters:
    a: Vector2 . Vector2 object.
    degree: float . Angle value in degrees.
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.0, 1.5) , b = 45.0 , c = rotate_degree(a, b) , plot(c.x)`

rotate_around(this, center, angle)
  Rotates vector `target` around `origin` by angle value.
  Parameters:
    this
    center: Vector2 . Vector2 object.
    angle: float . Angle value in degrees.
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.0, 1.5) , b = from(2.0) , c = rotate_around(a, b, 45.0) , plot(c.x)`

perpendicular_distance(a, b, c)
  Distance from point `a` to line between `b` and `c`.
  Parameters:
    a: Vector2 . Vector2 object.
    b: Vector2 . Vector2 object.
    c: Vector2 . Vector2 object.
  Returns: float.
-> usage:
`a = new(1.5, 2.6) , b = from(1.0) , c = from(3.0) , d = perpendicular_distance(a, b, c) , plot(d.x)`

project(a, axis)
  Project a vector onto another.
  Parameters:
    a: Vector2 . Vector2 object.
    axis: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.0, 1.5) , b = from(2.0) , c = project(a, b) , plot(c.x)`

projectN(a, axis)
  Project a vector onto a vector of unit length.
  Parameters:
    a: Vector2 . Vector2 object.
    axis: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.0, 1.5) , b = from(2.0) , c = projectN(a, b) , plot(c.x)`

reflect(a, axis)
  Reflect a vector on another.
  Parameters:
    a: Vector2 . Vector2 object.
    axis
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.0, 1.5) , b = from(2.0) , c = reflect(a, b) , plot(c.x)`

reflectN(a, axis)
  Reflect a vector to a arbitrary axis.
  Parameters:
    a: Vector2 . Vector2 object.
    axis
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.0, 1.5) , b = from(2.0) , c = reflectN(a, b) , plot(c.x)`

angle(a)
  Angle in radians of a vector.
  Parameters:
    a: Vector2 . Vector2 object.
  Returns: float.
-> usage:
`a = new(3.0, 1.5) , b = angle(a) , plot(b)`

angle_unsigned(a, b)
  unsigned degree angle between 0 and +180 by given two vectors.
  Parameters:
    a: Vector2 . Vector2 object.
    b: Vector2 . Vector2 object.
  Returns: float.
-> usage:
`a = new(3.0, 1.5) , b = from(2.0) , c = angle_unsigned(a, b) , plot(c)`

angle_signed(a, b)
  Signed degree angle between -180 and +180 by given two vectors.
  Parameters:
    a: Vector2 . Vector2 object.
    b: Vector2 . Vector2 object.
  Returns: float.
-> usage:
`a = new(3.0, 1.5) , b = from(2.0) , c = angle_signed(a, b) , plot(c)`

angle_360(a, b)
  Degree angle between 0 and 360 by given two vectors
  Parameters:
    a: Vector2 . Vector2 object.
    b: Vector2 . Vector2 object.
  Returns: float.
-> usage:
`a = new(3.0, 1.5) , b = from(2.0) , c = angle_360(a, b) , plot(c)`

clamp(a, min, max)
  Restricts a vector between a min and max value.
  Parameters:
    a: Vector2 . Vector2 object.
    min
    max
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.0, 1.5) , b = from(2.0) , c = from(2.5) , d = clamp(a, b, c) , plot(d.x)`

clamp(a, min, max)
  Restricts a vector between a min and max value.
  Parameters:
    a: Vector2 . Vector2 object.
    min: float . Lower boundary value.
    max: float . Higher boundary value.
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.0, 1.5) , b = clamp(a, 2.0, 2.5) , plot(b.x)`

lerp(a, b, rate)
  Linearly interpolates between vectors a and b by rate.
  Parameters:
    a: Vector2 . Vector2 object.
    b: Vector2 . Vector2 object.
    rate: float . Value between (a:-infinity -> b:1.0), negative values will move away from b.
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.0, 1.5) , b = from(2.0) , c = lerp(a, b, 0.5) , plot(c.x)`

herp(a, b, rate)
  Hermite curve interpolation between vectors a and b by rate.
  Parameters:
    a: Vector2 . Vector2 object.
    b: Vector2 . Vector2 object.
    rate: Vector2 . Vector2 object. Value between (a:0 > 1:b).
  Returns: Vector2. Vector2 object.
-> usage:
`a = new(3.0, 1.5) , b = from(2.0) , c = from(2.5) , d = herp(a, b, c) , plot(d.x)`

transform(position, mat)
  Transform a vector by the given matrix.
  Parameters:
    position: Vector2 . Source vector.
    mat: M32 . Transformation matrix
  Returns: Vector2. Transformed vector.

transform(position, mat)
  Transform a vector by the given matrix.
  Parameters:
    position: Vector2 . Source vector.
    mat: M44 . Transformation matrix
  Returns: Vector2. Transformed vector.

transform(position, mat)
  Transform a vector by the given matrix.
  Parameters:
    position: Vector2 . Source vector.
    mat: matrix<float> . Transformation matrix, requires a 3x2 or a 4x4 matrix.
  Returns: Vector2. Transformed vector.

transform(this, rotation)
  Transform a vector by the given quaternion rotation value.
  Parameters:
    this: Vector2 . Source vector.
    rotation: Quaternion . Rotation to apply.
  Returns: Vector2. Transformed vector.

area_triangle(a, b, c)
  Find the area in a triangle of vectors.
  Parameters:
    a: Vector2 . Vector2 object.
    b: Vector2 . Vector2 object.
    c: Vector2 . Vector2 object.
  Returns: float.
-> usage:
`a = new(1.0, 2.0) , b = from(2.0) , c = from(1.0) , d = area_triangle(a, b, c) , plot(d.x)`

random(max)
  2D random value.
  Parameters:
    max: Vector2 . Vector2 object. Vector upper boundary.
  Returns: Vector2. Vector2 object.
-> usage:
`a = from(2.0) , b = random(a) , plot(b.x)`

random(max)
  2D random value.
  Parameters:
    max: float, Vector upper boundary.
  Returns: Vector2. Vector2 object.
-> usage:
`a = random(2.0) , plot(a.x)`

random(min, max)
  2D random value.
  Parameters:
    min: Vector2 . Vector2 object. Vector lower boundary.
    max: Vector2 . Vector2 object. Vector upper boundary.
  Returns: Vector2. Vector2 object.
-> usage:
`a = from(1.0) , b = from(2.0) , c = random(a, b) , plot(c.x)`

random(min, max)
  2D random value.
  Parameters:
    min: Vector2 . Vector2 object. Vector lower boundary.
    max: Vector2 . Vector2 object. Vector upper boundary.
  Returns: Vector2. Vector2 object.
-> usage:
`a = random(1.0, 2.0) , plot(a.x)`

noise(a)
  2D Noise based on Morgan McGuire @morgan3d.
  Parameters:
    a: Vector2 . Vector2 object.
  Returns: Vector2. Vector2 object.
-> usage:
`a = from(2.0) , b = noise(a) , plot(b.x)`

to_string(a)
  Converts vector `a` to a string format, in the form `"(x, y)"`.
  Parameters:
    a: Vector2 . Vector2 object.
  Returns: string. In `"(x, y)"` format.
-> usage:
`a = from(2.0) , l = barstate.islast ? label.new(bar_index, 0.0, to_string(a)) : label(na)`

to_string(a, format)
  Converts vector `a` to a string format, in the form `"(x, y)"`.
  Parameters:
    a: Vector2 . Vector2 object.
    format: string . Format to apply transformation.
  Returns: string. In `"(x, y)"` format.
-> usage:
`a = from(2.123456) , l = barstate.islast ? label.new(bar_index, 0.0, to_string(a, "#.##")) : label(na)`

to_array(a)
  Converts vector to a array format.
  Parameters:
    a: Vector2 . Vector2 object.
  Returns: array<float>.
-> usage:
`a = from(2.0) , b = to_array(a) , plot(array.get(b, 0))`

to_barycentric(this, a, b, c)
  Captures the barycentric coordinate of a cartesian position in the triangle plane.
  Parameters:
    this: Vector2 . Source cartesian coordinate position.
    a: Vector2 . Triangle corner `a` vertice.
    b: Vector2 . Triangle corner `b` vertice.
    c: Vector2 . Triangle corner `c` vertice.
  Returns: bool.

from_barycentric(this, a, b, c)
  Captures the cartesian coordinate of a barycentric position in the triangle plane.
  Parameters:
    this: Vector2 . Source barycentric coordinate position.
    a: Vector2 . Triangle corner `a` vertice.
    b: Vector2 . Triangle corner `b` vertice.
    c: Vector2 . Triangle corner `c` vertice.
  Returns: bool.

to_complex(this)
  Translate a Vector2 structure to complex.
  Parameters:
    this: Vector2 . Source vector.
  Returns: Complex.

to_polar(this)
  Translate a Vector2 cartesian coordinate into polar coordinates.
  Parameters:
    this: Vector2 . Source vector.
  Returns: Pole. The returned angle is in radians.
ספריית Pine

ברוח TradingView אמיתית, המחבר פרסם את קוד Pine זה כספריית קוד פתוח כך שמתכנתי Pine אחרים מהקהילה שלנו יוכלו לעשות בו שימוש חוזר. כל הכבוד למחבר! אתה יכול להשתמש בספרייה זו באופן פרטי או בפרסומים אחרים בקוד פתוח, אך השימוש החוזר בקוד זה בפרסום כפוף לכללי הבית.

כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.

רוצה להשתמש בספרייה זו?

העתק את השורה הבאה והדבק אותה בסקריפט שלך.