PINE LIBRARY
Vector2Array

Library "Vector2Array"
functions to handle vector2 Array operations.
.
references:
docs.unity3d.com/ScriptReference/Vector2.html
gist.github.com/winduptoy/a1aa09c3499e09edbd33
github.com/dogancoruh/Javascript-Vector2/blob/master/js/vector2.js
gist.github.com/Dalimil/3daf2a0c531d7d030deb37a7bfeff454
gist.github.com/jeantimex/7fa22744e0c45e5df770b532f696af2d
gist.github.com/volkansalma/2972237
.
from(source, prop_sep, vect_sep)
Generate array of vector2 from string.
Parameters:
source: string Source string of the vectors.
prop_sep: string Separator character of the vector properties (x`,`y).
vect_sep: string Separator character of the vectors ((x,y)`;`(x,y)).
Returns: array<Vector2>.
max(vectors)
Combination of the highest elements in column of a array of vectors.
Parameters:
vectors: array<Vector2.Vector2>, Array of Vector2 objects.
Returns: Vector2.Vector2, Vector2 object.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = max(array.from(a, b, c)) , plot(d.x)`
min(vectors)
Combination of the lowest elements in column of a array of vectors.
Parameters:
vectors: array<Vector2.Vector2>, Array of Vector2 objects.
Returns: Vector2.Vector2, Vector2 object.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = min(array.from(a, b, c)) , plot(d.x)`
sum(vectors)
Total sum of all vectors.
Parameters:
vectors: array<Vector2.Vector2>, ID of the vector2 array.
Returns: Vector2.Vector2, vector2 object.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = sum(array.from(a, b, c)) , plot(d.x)`
center(vectors)
Finds the vector center of the array.
Parameters:
vectors: array<Vector2.Vector2>, ID of the vector2 array.
Returns: Vector2.Vector2, vector2 object.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = center(array.from(a, b, c)) , plot(d.x)`
rotate(vectors, center, degree)
Rotate Array vectors around origin vector by a angle.
Parameters:
vectors: array<Vector2.Vector2>, ID of the vector2 array.
center: Vector2.Vector2 , Vector2 object. Center of the rotation.
degree: float , Angle value.
Returns: rotated points array.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = rotate(array.from(a, b, c), b, 45.0)`
scale(vectors, center, rate)
Scale Array vectors based on a origin vector perspective.
Parameters:
vectors: array<Vector2.Vector2>, ID of the vector2 array.
center: Vector2.Vector2 , Vector2 object. Origin center of the transformation.
rate: float , Rate to apply transformation.
Returns: rotated points array.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = scale(array.from(a, b, c), b, 1.25)`
move(vectors, center, rate)
Move Array vectors by a rate of the distance to center position (LERP).
Parameters:
vectors: array<Vector2.Vector2>, ID of the vector2 array.
center
rate
Returns: Moved points array.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = move(array.from(a, b, c), b, 1.25)`
to_string(id, separator)
Reads a array of vectors into a string, of the form `[ (x, y), ... ]`.
Parameters:
id: array<Vector2.Vector2>, ID of the vector2 array.
separator: string separator for cell splitting.
Returns: string Translated complex array into string.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = to_string(array.from(a, b, c))`
to_string(id, format, separator)
Reads a array of vectors into a string, of the form `[ (x, y), ... ]`.
Parameters:
id: array<Vector2.Vector2>, ID of the vector2 array.
format: string , Format to apply transformation.
separator: string , Separator for cell splitting.
Returns: string Translated complex array into string.
-> usage:
`a = Vector2.from(1.234) , b = Vector2.from(2.23), c = Vector2.from(3.1234), d = to_string(array.from(a, b, c), "#.##")`
functions to handle vector2 Array operations.
.
references:
docs.unity3d.com/ScriptReference/Vector2.html
gist.github.com/winduptoy/a1aa09c3499e09edbd33
github.com/dogancoruh/Javascript-Vector2/blob/master/js/vector2.js
gist.github.com/Dalimil/3daf2a0c531d7d030deb37a7bfeff454
gist.github.com/jeantimex/7fa22744e0c45e5df770b532f696af2d
gist.github.com/volkansalma/2972237
.
from(source, prop_sep, vect_sep)
Generate array of vector2 from string.
Parameters:
source: string Source string of the vectors.
prop_sep: string Separator character of the vector properties (x`,`y).
vect_sep: string Separator character of the vectors ((x,y)`;`(x,y)).
Returns: array<Vector2>.
max(vectors)
Combination of the highest elements in column of a array of vectors.
Parameters:
vectors: array<Vector2.Vector2>, Array of Vector2 objects.
Returns: Vector2.Vector2, Vector2 object.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = max(array.from(a, b, c)) , plot(d.x)`
min(vectors)
Combination of the lowest elements in column of a array of vectors.
Parameters:
vectors: array<Vector2.Vector2>, Array of Vector2 objects.
Returns: Vector2.Vector2, Vector2 object.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = min(array.from(a, b, c)) , plot(d.x)`
sum(vectors)
Total sum of all vectors.
Parameters:
vectors: array<Vector2.Vector2>, ID of the vector2 array.
Returns: Vector2.Vector2, vector2 object.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = sum(array.from(a, b, c)) , plot(d.x)`
center(vectors)
Finds the vector center of the array.
Parameters:
vectors: array<Vector2.Vector2>, ID of the vector2 array.
Returns: Vector2.Vector2, vector2 object.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = center(array.from(a, b, c)) , plot(d.x)`
rotate(vectors, center, degree)
Rotate Array vectors around origin vector by a angle.
Parameters:
vectors: array<Vector2.Vector2>, ID of the vector2 array.
center: Vector2.Vector2 , Vector2 object. Center of the rotation.
degree: float , Angle value.
Returns: rotated points array.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = rotate(array.from(a, b, c), b, 45.0)`
scale(vectors, center, rate)
Scale Array vectors based on a origin vector perspective.
Parameters:
vectors: array<Vector2.Vector2>, ID of the vector2 array.
center: Vector2.Vector2 , Vector2 object. Origin center of the transformation.
rate: float , Rate to apply transformation.
Returns: rotated points array.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = scale(array.from(a, b, c), b, 1.25)`
move(vectors, center, rate)
Move Array vectors by a rate of the distance to center position (LERP).
Parameters:
vectors: array<Vector2.Vector2>, ID of the vector2 array.
center
rate
Returns: Moved points array.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = move(array.from(a, b, c), b, 1.25)`
to_string(id, separator)
Reads a array of vectors into a string, of the form `[ (x, y), ... ]`.
Parameters:
id: array<Vector2.Vector2>, ID of the vector2 array.
separator: string separator for cell splitting.
Returns: string Translated complex array into string.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = to_string(array.from(a, b, c))`
to_string(id, format, separator)
Reads a array of vectors into a string, of the form `[ (x, y), ... ]`.
Parameters:
id: array<Vector2.Vector2>, ID of the vector2 array.
format: string , Format to apply transformation.
separator: string , Separator for cell splitting.
Returns: string Translated complex array into string.
-> usage:
`a = Vector2.from(1.234) , b = Vector2.from(2.23), c = Vector2.from(3.1234), d = to_string(array.from(a, b, c), "#.##")`
Biblioteca do Pine
No verdadeiro espirito do TradingView, o autor desse código Pine o publicou como uma biblioteca de código aberto, para que outros programadores Pine da nossa comunidade possam reusa-los. Parabéns ao autor! Você pode usar essa biblioteca privadamente ou em outras publicações de código aberto, mas a reutilização desse código em publicações é regida pelas Regras da Casa.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.
Biblioteca do Pine
No verdadeiro espirito do TradingView, o autor desse código Pine o publicou como uma biblioteca de código aberto, para que outros programadores Pine da nossa comunidade possam reusa-los. Parabéns ao autor! Você pode usar essa biblioteca privadamente ou em outras publicações de código aberto, mas a reutilização desse código em publicações é regida pelas Regras da Casa.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.