Class Vector2WithInfo
Hierarchy
- Vector2
- Vector2WithInfo
Index
Constructors
Properties
Accessors
Methods
- add
- add
In Place - add
To Ref - add
Vector3 - as
Array - clone
- copy
From - copy
From Floats - divide
- divide
In Place - divide
To Ref - equals
- equals
With Epsilon - floor
- fract
- from
Array - get
Class Name - get
Hash Code - length
- length
Squared - multiply
- multiply
By Floats - multiply
In Place - multiply
To Ref - negate
- negate
In Place - negate
To Ref - normalize
- rotate
To Ref - scale
- scale
And Add To Ref - scale
In Place - scale
To Ref - set
- subtract
- subtract
In Place - subtract
To Ref - to
Array - to
String - Catmull
Rom - Center
- Center
To Ref - Clamp
- Distance
- Distance
Of Point From Segment - Distance
Squared - Dot
- From
Array - From
Array To Ref - Hermite
- Hermite1st
Derivative - Hermite1st
Derivative To Ref - Lerp
- Maximize
- Minimize
- Normalize
- Normalize
To Ref - One
- Point
In Triangle - Transform
- Transform
To Ref - Zero
Constructors
constructor
Creates a new Vector2WithInfo
Parameters
source: Vector2
defines the vector2 data to transport
Optional buttonIndex: number
defines the current mouse button index
Returns Vector2WithInfo
Properties
button IndexSearch playground for buttonIndex
defines the current mouse button index
xSearch playground for x
defines the first coordinate
ySearch playground for y
defines the second coordinate
Accessors
Static Zero Read Only
Gets a zero Vector2 that must not be updated
Returns DeepImmutableObject<Vector2>
Methods
addSearch playground for add
Add another vector with the current one Example Playground https://playground.babylonjs.com/#QYBWV4#11
Parameters
otherVector: DeepImmutableObject<Vector2>
defines the other vector
Returns Vector2
a new Vector2 set with the addition of the current Vector2 and the given one coordinates
add In PlaceSearch playground for addInPlace
Set the Vector2 coordinates by adding the given Vector2 coordinates Example Playground https://playground.babylonjs.com/#QYBWV4#13
Parameters
otherVector: DeepImmutableObject<Vector2>
defines the other vector
Returns Vector2
the current updated Vector2
add To RefSearch playground for addToRef
Sets the "result" coordinates with the addition of the current Vector2 and the given one coordinates Example Playground https://playground.babylonjs.com/#QYBWV4#12
Parameters
otherVector: DeepImmutableObject<Vector2>
defines the other vector
result: Vector2
defines the target vector
Returns Vector2
the unmodified current Vector2
add Vector3Search playground for addVector3
Gets a new Vector2 by adding the current Vector2 coordinates to the given Vector3 x, y coordinates Example Playground https://playground.babylonjs.com/#QYBWV4#14
Parameters
otherVector: Vector3
defines the other vector
Returns Vector2
a new Vector2
as ArraySearch playground for asArray
Copy the current vector to an array Example Playground https://playground.babylonjs.com/#QYBWV4#40
Returns number[]
a new array with 2 elements: the Vector2 coordinates.
cloneSearch playground for clone
Gets a new Vector2 copied from the Vector2 Example Playground https://playground.babylonjs.com/#QYBWV4#20
Returns Vector2
a new Vector2
copy FromSearch playground for copyFrom
Sets the Vector2 coordinates with the given Vector2 coordinates Example Playground https://playground.babylonjs.com/#QYBWV4#24
Parameters
source: DeepImmutableObject<Vector2>
defines the source Vector2
Returns Vector2
the current updated Vector2
copy From FloatsSearch playground for copyFromFloats
Sets the Vector2 coordinates with the given floats Example Playground https://playground.babylonjs.com/#QYBWV4#25
Parameters
x: number
defines the first coordinate
y: number
defines the second coordinate
Returns Vector2
the current updated Vector2
divideSearch playground for divide
Returns a new Vector2 set with the Vector2 coordinates divided by the given one coordinates Example Playground https://playground.babylonjs.com/#QYBWV4#27
Parameters
otherVector: Vector2
defines the other vector
Returns Vector2
a new Vector2
divide In PlaceSearch playground for divideInPlace
Divides the current Vector2 coordinates by the given ones Example Playground https://playground.babylonjs.com/#QYBWV4#28
Parameters
otherVector: DeepImmutableObject<Vector2>
defines the other vector
Returns Vector2
the current updated Vector2
divide To RefSearch playground for divideToRef
Sets the "result" coordinates with the Vector2 divided by the given one coordinates Example Playground https://playground.babylonjs.com/#QYBWV4#30
Parameters
otherVector: DeepImmutableObject<Vector2>
defines the other vector
result: Vector2
defines the target vector
Returns Vector2
the unmodified current Vector2
equalsSearch playground for equals
Gets a boolean if two vectors are equals Example Playground https://playground.babylonjs.com/#QYBWV4#31
Parameters
otherVector: DeepImmutableObject<Vector2>
defines the other vector
Returns boolean
true if the given vector coordinates strictly equal the current Vector2 ones
equals With EpsilonSearch playground for equalsWithEpsilon
Gets a boolean if two vectors are equals (using an epsilon value) Example Playground https://playground.babylonjs.com/#QYBWV4#32
Parameters
otherVector: DeepImmutableObject<Vector2>
defines the other vector
Optional epsilon: number
defines the minimal distance to consider equality
Returns boolean
true if the given vector coordinates are close to the current ones by a distance of epsilon.
floorSearch playground for floor
Gets a new Vector2 from current Vector2 floored values Example Playground https://playground.babylonjs.com/#QYBWV4#35 eg (1.2, 2.31) returns (1, 2)
Returns Vector2
a new Vector2
fractSearch playground for fract
Gets a new Vector2 from current Vector2 fractional values Example Playground https://playground.babylonjs.com/#QYBWV4#34 eg (1.2, 2.31) returns (0.2, 0.31)
Returns Vector2
a new Vector2
from ArraySearch playground for fromArray
Update the current vector from an array Example Playground https://playground.babylonjs.com/#QYBWV4#39
Parameters
array: FloatArray
defines the destination array
Optional index: number
defines the offset in the destination array
Returns Vector2
the current Vector3
get Class NameSearch playground for getClassName
Gets class name
Returns string
the string "Vector2"
get Hash CodeSearch playground for getHashCode
Gets current vector hash code
Returns number
the Vector2 hash code as a number
lengthSearch playground for length
Gets the length of the vector
Returns number
the vector length (float)
length SquaredSearch playground for lengthSquared
Gets the vector squared length
Returns number
the vector squared length (float)
multiplySearch playground for multiply
Returns a new Vector2 set with the multiplication of the current Vector2 and the given one coordinates Example Playground https://playground.babylonjs.com/#QYBWV4#42
Parameters
otherVector: DeepImmutableObject<Vector2>
defines the other vector
Returns Vector2
a new Vector2
multiply By FloatsSearch playground for multiplyByFloats
Gets a new Vector2 set with the Vector2 coordinates multiplied by the given floats Example Playground https://playground.babylonjs.com/#QYBWV4#89
Parameters
x: number
defines the first coordinate
y: number
defines the second coordinate
Returns Vector2
a new Vector2
multiply In PlaceSearch playground for multiplyInPlace
Multiplies in place the current Vector2 coordinates by the given ones Example Playground https://playground.babylonjs.com/#QYBWV4#43
Parameters
otherVector: DeepImmutableObject<Vector2>
defines the other vector
Returns Vector2
the current updated Vector2
multiply To RefSearch playground for multiplyToRef
Sets "result" coordinates with the multiplication of the current Vector2 and the given one coordinates Example Playground https://playground.babylonjs.com/#QYBWV4#44
Parameters
otherVector: DeepImmutableObject<Vector2>
defines the other vector
result: Vector2
defines the target vector
Returns Vector2
the unmodified current Vector2
negateSearch playground for negate
Gets a new Vector2 with current Vector2 negated coordinates Example Playground https://playground.babylonjs.com/#QYBWV4#22
Returns Vector2
a new Vector2
negate In PlaceSearch playground for negateInPlace
Negate this vector in place Example Playground https://playground.babylonjs.com/#QYBWV4#23
Returns Vector2
this
negate To RefSearch playground for negateToRef
Negate the current Vector2 and stores the result in the given vector "result" coordinates Example Playground https://playground.babylonjs.com/#QYBWV4#41
Parameters
result: Vector2
defines the Vector3 object where to store the result
Returns Vector2
the result
normalizeSearch playground for normalize
Normalize the vector Example Playground https://playground.babylonjs.com/#QYBWV4#48
Returns Vector2
the current updated Vector2
rotate To RefSearch playground for rotateToRef
Rotate the current vector into a given result vector Example Playground https://playground.babylonjs.com/#QYBWV4#49
Parameters
angle: number
defines the rotation angle
result: Vector2
defines the result vector where to store the rotated vector
Returns Vector2WithInfo
the current vector
scaleSearch playground for scale
Returns a new Vector2 scaled by "scale" from the current Vector2 Example Playground https://playground.babylonjs.com/#QYBWV4#52
Parameters
scale: number
defines the scaling factor
Returns Vector2
a new Vector2
scale And Add To RefSearch playground for scaleAndAddToRef
Scale the current Vector2 values by a factor and add the result to a given Vector2 Example Playground https://playground.babylonjs.com/#QYBWV4#58
Parameters
scale: number
defines the scale factor
result: Vector2
defines the Vector2 object where to store the result
Returns Vector2
the unmodified current Vector2
scale In PlaceSearch playground for scaleInPlace
Multiply the Vector2 coordinates by Example Playground https://playground.babylonjs.com/#QYBWV4#59
Parameters
scale: number
defines the scaling factor
Returns Vector2
the current updated Vector2
scale To RefSearch playground for scaleToRef
Scale the current Vector2 values by a factor to a given Vector2 Example Playground https://playground.babylonjs.com/#QYBWV4#57
Parameters
scale: number
defines the scale factor
result: Vector2
defines the Vector2 object where to store the result
Returns Vector2
the unmodified current Vector2
setSearch playground for set
Sets the Vector2 coordinates with the given floats Example Playground https://playground.babylonjs.com/#QYBWV4#62
Parameters
x: number
defines the first coordinate
y: number
defines the second coordinate
Returns Vector2
the current updated Vector2
subtractSearch playground for subtract
Gets a new Vector2 set with the subtracted coordinates of the given one from the current Vector2 Example Playground https://playground.babylonjs.com/#QYBWV4#61
Parameters
otherVector: Vector2
defines the other vector
Returns Vector2
a new Vector2
subtract In PlaceSearch playground for subtractInPlace
Sets the current Vector2 coordinates by subtracting from it the given one coordinates Example Playground https://playground.babylonjs.com/#QYBWV4#88
Parameters
otherVector: DeepImmutableObject<Vector2>
defines the other vector
Returns Vector2
the current updated Vector2
subtract To RefSearch playground for subtractToRef
Sets the "result" coordinates with the subtraction of the given one from the current Vector2 coordinates. Example Playground https://playground.babylonjs.com/#QYBWV4#63
Parameters
otherVector: DeepImmutableObject<Vector2>
defines the other vector
result: Vector2
defines the target vector
Returns Vector2
the unmodified current Vector2
to ArraySearch playground for toArray
Sets the Vector2 coordinates in the given array or Float32Array from the given index. Example Playground https://playground.babylonjs.com/#QYBWV4#15
Parameters
array: FloatArray
defines the source array
Optional index: number
defines the offset in source array
Returns Vector2
the current Vector2
to StringSearch playground for toString
Gets a string with the Vector2 coordinates
Returns string
a string with the Vector2 coordinates
Static Catmull RomSearch playground for CatmullRom
Gets a new Vector2 located for "amount" (float) on the CatmullRom spline defined by the given four Vector2 Example Playground https://playground.babylonjs.com/#QYBWV4#65
Parameters
value1: DeepImmutableObject<Vector2>
defines 1st point of control
value2: DeepImmutableObject<Vector2>
defines 2nd point of control
value3: DeepImmutableObject<Vector2>
defines 3rd point of control
value4: DeepImmutableObject<Vector2>
defines 4th point of control
amount: number
defines the interpolation factor
Returns Vector2
a new Vector2
Static CenterSearch playground for Center
Gets a new Vector2 located at the center of the vectors "value1" and "value2" Example Playground https://playground.babylonjs.com/#QYBWV4#86 Example Playground https://playground.babylonjs.com/#QYBWV4#66
Parameters
value1: DeepImmutableObject<Vector2>
defines first vector
value2: DeepImmutableObject<Vector2>
defines second vector
Returns Vector2
a new Vector2
Static Center To RefSearch playground for CenterToRef
Gets the center of the vectors "value1" and "value2" and stores the result in the vector "ref" Example Playground https://playground.babylonjs.com/#QYBWV4#66
Parameters
value1: DeepImmutableObject<Vector2>
defines first vector
value2: DeepImmutableObject<Vector2>
defines second vector
ref: DeepImmutableObject<Vector2>
defines third vector
Returns Vector2
ref
Static ClampSearch playground for Clamp
Returns a new Vector2 set with same the coordinates than "value" ones if the vector "value" is in the square defined by "min" and "max". If a coordinate of "value" is lower than "min" coordinates, the returned Vector2 is given this "min" coordinate. If a coordinate of "value" is greater than "max" coordinates, the returned Vector2 is given this "max" coordinate Example Playground https://playground.babylonjs.com/#QYBWV4#76
Parameters
value: DeepImmutableObject<Vector2>
defines the value to clamp
min: DeepImmutableObject<Vector2>
defines the lower limit
max: DeepImmutableObject<Vector2>
defines the upper limit
Returns Vector2
a new Vector2
Static DistanceSearch playground for Distance
Gets the distance between the vectors "value1" and "value2" Example Playground https://playground.babylonjs.com/#QYBWV4#71
Parameters
value1: DeepImmutableObject<Vector2>
defines first vector
value2: DeepImmutableObject<Vector2>
defines second vector
Returns number
the distance between vectors
Static Distance Of Point From SegmentSearch playground for DistanceOfPointFromSegment
Gets the shortest distance (float) between the point "p" and the segment defined by the two points "segA" and "segB". Example Playground https://playground.babylonjs.com/#QYBWV4#77
Parameters
p: DeepImmutableObject<Vector2>
defines the middle point
segA: DeepImmutableObject<Vector2>
defines one point of the segment
segB: DeepImmutableObject<Vector2>
defines the other point of the segment
Returns number
the shortest distance
Static Distance SquaredSearch playground for DistanceSquared
Returns the squared distance between the vectors "value1" and "value2" Example Playground https://playground.babylonjs.com/#QYBWV4#72
Parameters
value1: DeepImmutableObject<Vector2>
defines first vector
value2: DeepImmutableObject<Vector2>
defines second vector
Returns number
the squared distance between vectors
Static DotSearch playground for Dot
Gets the dot product of the vector "left" and the vector "right" Example Playground https://playground.babylonjs.com/#QYBWV4#90
Parameters
left: DeepImmutableObject<Vector2>
defines first vector
right: DeepImmutableObject<Vector2>
defines second vector
Returns number
the dot product (float)
Static From ArraySearch playground for FromArray
Gets a new Vector2 set from the given index element of the given array Example Playground https://playground.babylonjs.com/#QYBWV4#79
Parameters
array: DeepImmutableObject<ArrayLike<number>>
defines the data source
Optional offset: number
defines the offset in the data source
Returns Vector2
a new Vector2
Static From Array To RefSearch playground for FromArrayToRef
Sets "result" from the given index element of the given array Example Playground https://playground.babylonjs.com/#QYBWV4#80
Parameters
array: DeepImmutableObject<ArrayLike<number>>
defines the data source
offset: number
defines the offset in the data source
result: Vector2
defines the target vector
Returns void
Static HermiteSearch playground for Hermite
Returns a new Vector2 located for "amount" (float) on the Hermite spline defined by the vectors "value1", "value2", "tangent1", "tangent2" Example Playground https://playground.babylonjs.com/#QYBWV4#81
Parameters
value1: DeepImmutableObject<Vector2>
defines the 1st control point
tangent1: DeepImmutableObject<Vector2>
defines the outgoing tangent
value2: DeepImmutableObject<Vector2>
defines the 2nd control point
tangent2: DeepImmutableObject<Vector2>
defines the incoming tangent
amount: number
defines the interpolation factor
Returns Vector2
a new Vector2
Static Hermite1st DerivativeSearch playground for Hermite1stDerivative
Returns a new Vector2 which is the 1st derivative of the Hermite spline defined by the vectors "value1", "value2", "tangent1", "tangent2". Example Playground https://playground.babylonjs.com/#QYBWV4#82
Parameters
value1: DeepImmutableObject<Vector2>
defines the first control point
tangent1: DeepImmutableObject<Vector2>
defines the first tangent
value2: DeepImmutableObject<Vector2>
defines the second control point
tangent2: DeepImmutableObject<Vector2>
defines the second tangent
time: number
define where the derivative must be done
Returns Vector2
1st derivative
Static Hermite1st Derivative To RefSearch playground for Hermite1stDerivativeToRef
Returns a new Vector2 which is the 1st derivative of the Hermite spline defined by the vectors "value1", "value2", "tangent1", "tangent2". Example Playground https://playground.babylonjs.com/#QYBWV4#83
Parameters
value1: DeepImmutableObject<Vector2>
defines the first control point
tangent1: DeepImmutableObject<Vector2>
defines the first tangent
value2: DeepImmutableObject<Vector2>
defines the second control point
tangent2: DeepImmutableObject<Vector2>
defines the second tangent
time: number
define where the derivative must be done
result: Vector2
define where the derivative will be stored
Returns void
Static LerpSearch playground for Lerp
Returns a new Vector2 located for "amount" (float) on the linear interpolation between the vector "start" adn the vector "end". Example Playground https://playground.babylonjs.com/#QYBWV4#84
Parameters
start: DeepImmutableObject<Vector2>
defines the start vector
end: DeepImmutableObject<Vector2>
defines the end vector
amount: number
defines the interpolation factor
Returns Vector2
a new Vector2
Static MaximizeSearch playground for Maximize
Gets a new Vector2 set with the maximal coordinate values from the "left" and "right" vectors Example Playground https://playground.babylonjs.com/#QYBWV4#86
Parameters
left: DeepImmutableObject<Vector2>
defines 1st vector
right: DeepImmutableObject<Vector2>
defines 2nd vector
Returns Vector2
a new Vector2
Static MinimizeSearch playground for Minimize
Gets a new Vector2 set with the minimal coordinate values from the "left" and "right" vectors Example Playground https://playground.babylonjs.com/#QYBWV4#86
Parameters
left: DeepImmutableObject<Vector2>
defines 1st vector
right: DeepImmutableObject<Vector2>
defines 2nd vector
Returns Vector2
a new Vector2
Static NormalizeSearch playground for Normalize
Returns a new Vector2 equal to the normalized given vector Example Playground https://playground.babylonjs.com/#QYBWV4#46
Parameters
vector: DeepImmutableObject<Vector2>
defines the vector to normalize
Returns Vector2
a new Vector2
Static Normalize To RefSearch playground for NormalizeToRef
Normalize a given vector into a second one Example Playground https://playground.babylonjs.com/#QYBWV4#50
Parameters
vector: DeepImmutableObject<Vector2>
defines the vector to normalize
result: Vector2
defines the vector where to store the result
Returns void
Static OneSearch playground for One
Gets a new Vector2(1, 1)
Returns Vector2
a new Vector2
Static Point In TriangleSearch playground for PointInTriangle
Determines if a given vector is included in a triangle Example Playground https://playground.babylonjs.com/#QYBWV4#87
Parameters
p: DeepImmutableObject<Vector2>
defines the vector to test
p0: DeepImmutableObject<Vector2>
defines 1st triangle point
p1: DeepImmutableObject<Vector2>
defines 2nd triangle point
p2: DeepImmutableObject<Vector2>
defines 3rd triangle point
Returns boolean
true if the point "p" is in the triangle defined by the vectors "p0", "p1", "p2"
Static TransformSearch playground for Transform
Gets a new Vector2 set with the transformed coordinates of the given vector by the given transformation matrix Example Playground https://playground.babylonjs.com/#QYBWV4#17
Parameters
vector: DeepImmutableObject<Vector2>
defines the vector to transform
transformation: DeepImmutableObject<Matrix>
defines the matrix to apply
Returns Vector2
a new Vector2
Static Transform To RefSearch playground for TransformToRef
Transforms the given vector coordinates by the given transformation matrix and stores the result in the vector "result" coordinates Example Playground https://playground.babylonjs.com/#QYBWV4#19
Parameters
vector: DeepImmutableObject<Vector2>
defines the vector to transform
transformation: DeepImmutableObject<Matrix>
defines the matrix to apply
result: Vector2
defines the target vector
Returns void
Static ZeroSearch playground for Zero
Gets a new Vector2(0, 0)
Returns Vector2
a new Vector2
Class used to transport BABYLON.Vector2 information for pointer events