@univerjs/engine-render v0.5.0-beta.1 • Docs
Class: Vector2
Implements
Constructors
new Vector2()
new Vector2(x, y): Vector2
Creates a new Vector2 from the given x and y coordinates
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
x | number | 0 | defines the first coordinate |
y | number | 0 | defines the second coordinate |
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:33
Properties
Property | Modifier | Type | Default value | Description | Defined in |
---|---|---|---|---|---|
x | public | number | 0 | defines the first coordinate | packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:35 |
y | public | number | 0 | defines the second coordinate | packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:37 |
Methods
add()
add(otherVector): Vector2
Add another vector with the current one
Parameters
Parameter | Type | Description |
---|---|---|
otherVector | DeepImmutableObject <Vector2 > | defines the other vector |
Returns
a new Vector2 set with the addition of the current Vector2 and the given one coordinates
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:505
addByPoint()
addByPoint(x, y): Vector2
Parameters
Parameter | Type |
---|---|
x | number |
y | number |
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:521
addInPlace()
addInPlace(otherVector): Vector2
Set the Vector2 coordinates by adding the given Vector2 coordinates
Parameters
Parameter | Type | Description |
---|---|---|
otherVector | DeepImmutableObject <Vector2 > | defines the other vector |
Returns
the current updated Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:530
addToRef()
addToRef(otherVector, result): Vector2
Sets the “result” coordinates with the addition of the current Vector2 and the given one coordinates
Parameters
Parameter | Type | Description |
---|---|---|
otherVector | DeepImmutableObject <Vector2 > | defines the other vector |
result | Vector2 | defines the target vector |
Returns
the unmodified current Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:515
asArray()
asArray(): number[]
Copy the current vector to an array
Returns
number
[]
a new array with 2 elements: the Vector2 coordinates.
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:461
clone()
clone(): Vector2
Gets a new Vector2 copied from the Vector2
Returns
a new Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:828
copyFrom()
copyFrom(source): Vector2
Sets the Vector2 coordinates with the given Vector2 coordinates
Parameters
Parameter | Type | Description |
---|---|---|
source | DeepImmutableObject <Vector2 > | defines the source Vector2 |
Returns
the current updated Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:472
copyFromFloats()
copyFromFloats(x, y): Vector2
Sets the Vector2 coordinates with the given floats
Parameters
Parameter | Type | Description |
---|---|---|
x | number | defines the first coordinate |
y | number | defines the second coordinate |
Returns
the current updated Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:484
divide()
divide(otherVector): Vector2
Returns a new Vector2 set with the Vector2 coordinates divided by the given one coordinates
Parameters
Parameter | Type | Description |
---|---|---|
otherVector | Vector2 | defines the other vector |
Returns
a new Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:619
divideInPlace()
divideInPlace(otherVector): Vector2
Divides the current Vector2 coordinates by the given ones
Parameters
Parameter | Type | Description |
---|---|---|
otherVector | DeepImmutableObject <Vector2 > | defines the other vector |
Returns
the current updated Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:640
divideToRef()
divideToRef(otherVector, result): Vector2
Sets the “result” coordinates with the Vector2 divided by the given one coordinates
Parameters
Parameter | Type | Description |
---|---|---|
otherVector | DeepImmutableObject <Vector2 > | defines the other vector |
result | Vector2 | defines the target vector |
Returns
the unmodified current Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:629
equals()
equals(otherVector): boolean
Gets a boolean if two vectors are equals
Parameters
Parameter | Type | Description |
---|---|---|
otherVector | DeepImmutableObject <Vector2 > | defines the other vector |
Returns
boolean
true if the given vector coordinates strictly equal the current Vector2 ones
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:722
floor()
floor(): Vector2
Gets a new Vector2 from current Vector2 floored values eg (1.2, 2.31) returns (1, 2)
Returns
a new Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:731
fract()
fract(): Vector2
Gets a new Vector2 from current Vector2 fractional values eg (1.2, 2.31) returns (0.2, 0.31)
Returns
a new Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:740
fromArray()
fromArray(array, index): Vector2
Update the current vector from an array
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
array | FloatArray | undefined | defines the destination array |
index | number | 0 | defines the offset in the destination array |
Returns
the current Vector3
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:452
getClassName()
getClassName(): string
Gets class name
Returns
string
the string “Vector2”
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:418
getHashCode()
getHashCode(): number
Gets current vector hash code
Returns
number
the Vector2 hash code as a number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:426
length()
length(): number
Gets the length of the vector
Returns
number
the vector length (float)
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:801
lengthSquared()
lengthSquared(): number
Gets the vector squared length
Returns
number
the vector squared length (float)
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:809
multiply()
multiply(otherVector): Vector2
Returns a new Vector2 set with the multiplication of the current Vector2 and the given one coordinates
Parameters
Parameter | Type | Description |
---|---|---|
otherVector | DeepImmutableObject <Vector2 > | defines the other vector |
Returns
a new Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:588
multiplyByFloats()
multiplyByFloats(x, y): Vector2
Gets a new Vector2 set with the Vector2 coordinates multiplied by the given floats
Parameters
Parameter | Type | Description |
---|---|---|
x | number | defines the first coordinate |
y | number | defines the second coordinate |
Returns
a new Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:610
multiplyInPlace()
multiplyInPlace(otherVector): Vector2
Multiplies in place the current Vector2 coordinates by the given ones
Parameters
Parameter | Type | Description |
---|---|---|
otherVector | DeepImmutableObject <Vector2 > | defines the other vector |
Returns
the current updated Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:577
multiplyToRef()
multiplyToRef(otherVector, result): Vector2
Sets “result” coordinates with the multiplication of the current Vector2 and the given one coordinates
Parameters
Parameter | Type | Description |
---|---|---|
otherVector | DeepImmutableObject <Vector2 > | defines the other vector |
result | Vector2 | defines the target vector |
Returns
the unmodified current Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:598
negate()
negate(): Vector2
Gets a new Vector2 with current Vector2 negated coordinates
Returns
a new Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:648
negateInPlace()
negateInPlace(): Vector2
Negate this vector in place
Returns
this
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:656
negateToRef()
negateToRef(result): Vector2
Negate the current Vector2 and stores the result in the given vector “result” coordinates
Parameters
Parameter | Type | Description |
---|---|---|
result | Vector2 | defines the Vector3 object where to store the result |
Returns
the current Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:667
normalize()
normalize(): Vector2
Normalize the vector
Returns
the current updated Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:819
rotate()
rotate(angle): Vector2
Rotate the current vector into a given result vector
Parameters
Parameter | Type | Description |
---|---|---|
angle | number | defines the rotation angle |
Returns
the current vector
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:749
rotateByPoint()
rotateByPoint(angle, originPoint): Vector2
Parameters
Parameter | Type |
---|---|
angle | number |
originPoint | Vector2 |
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:774
rotateToRef()
rotateToRef(angle, result): Vector2
Rotate the current vector into a given result vector
Parameters
Parameter | Type | Description |
---|---|---|
angle | number | defines the rotation angle |
result | Vector2 | defines the result vector where to store the rotated vector |
Returns
the current vector
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:765
scale()
scale(scale): Vector2
Returns a new Vector2 scaled by “scale” from the current Vector2
Parameters
Parameter | Type | Description |
---|---|---|
scale | number | defines the scaling factor |
Returns
a new Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:687
scaleAndAddToRef()
scaleAndAddToRef(scale, result): Vector2
Scale the current Vector2 values by a factor and add the result to a given Vector2
Parameters
Parameter | Type | Description |
---|---|---|
scale | number | defines the scale factor |
result | Vector2 | defines the Vector2 object where to store the result |
Returns
the unmodified current Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:711
scaleInPlace()
scaleInPlace(scale): Vector2
Multiply the Vector2 coordinates by scale
Parameters
Parameter | Type | Description |
---|---|---|
scale | number | defines the scaling factor |
Returns
the current updated Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:676
scaleToRef()
scaleToRef(scale, result): Vector2
Scale the current Vector2 values by a factor to a given Vector2
Parameters
Parameter | Type | Description |
---|---|---|
scale | number | defines the scale factor |
result | Vector2 | defines the Vector2 object where to store the result |
Returns
the unmodified current Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:699
set()
set(x, y): Vector2
Sets the Vector2 coordinates with the given floats
Parameters
Parameter | Type | Description |
---|---|---|
x | number | defines the first coordinate |
y | number | defines the second coordinate |
Returns
the current updated Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:496
subtract()
subtract(otherVector): Vector2
Gets a new Vector2 set with the subtracted coordinates of the given one from the current Vector2
Parameters
Parameter | Type | Description |
---|---|---|
otherVector | Vector2 | defines the other vector |
Returns
a new Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:541
subtractByPoint()
subtractByPoint(x, y): Vector2
Parameters
Parameter | Type |
---|---|
x | number |
y | number |
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:545
subtractInPlace()
subtractInPlace(otherVector): Vector2
Sets the current Vector2 coordinates by subtracting from it the given one coordinates
Parameters
Parameter | Type | Description |
---|---|---|
otherVector | DeepImmutableObject <Vector2 > | defines the other vector |
Returns
the current updated Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:566
subtractToRef()
subtractToRef(otherVector, result): Vector2
Sets the “result” coordinates with the subtraction of the given one from the current Vector2 coordinates.
Parameters
Parameter | Type | Description |
---|---|---|
otherVector | DeepImmutableObject <Vector2 > | defines the other vector |
result | Vector2 | defines the target vector |
Returns
the unmodified current Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:555
toArray()
toArray(array, index): Vector2
Sets the Vector2 coordinates in the given array or Float32Array from the given index.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
array | FloatArray | undefined | defines the source array |
index | number | 0 | defines the offset in source array |
Returns
the current Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:440
toString()
toString(): string
Gets a string with the Vector2 coordinates
Returns
string
a string with the Vector2 coordinates
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:410
transformCoordinateOnRotate()
transformCoordinateOnRotate(angle): Vector2
Parameters
Parameter | Type |
---|---|
angle | number |
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:786
CatmullRom()
static CatmullRom(
value1,
value2,
value3,
value4,
amount): Vector2
Gets a new Vector2 located for “amount” (float) on the CatmullRom spline defined by the given four Vector2
Parameters
Parameter | Type | Description |
---|---|---|
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
a new Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:90
Center()
static Center(value1, value2): Vector2
Gets a new Vector2 located at the center of the vectors “value1” and “value2”
Parameters
Parameter | Type | Description |
---|---|---|
value1 | DeepImmutableObject <Vector2 > | defines first vector |
value2 | DeepImmutableObject <Vector2 > | defines second vector |
Returns
a new Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:361
CenterToRef()
static CenterToRef(
value1,
value2,
ref): Vector2
Gets the center of the vectors “value1” and “value2” and stores the result in the vector “ref”
Parameters
Parameter | Type | Description |
---|---|---|
value1 | DeepImmutableObject <Vector2 > | defines first vector |
value2 | DeepImmutableObject <Vector2 > | defines second vector |
ref | DeepImmutableObject <Vector2 > | defines third vector |
Returns
ref
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:372
Clamp()
static Clamp(
value,
min,
max): Vector2
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
Parameters
Parameter | Type | Description |
---|---|---|
value | DeepImmutableObject <Vector2 > | defines the value to clamp |
min | DeepImmutableObject <Vector2 > | defines the lower limit |
max | DeepImmutableObject <Vector2 > | defines the upper limit |
Returns
a new Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:126
create()
static create(x, y): Vector2
Parameters
Parameter | Type |
---|---|
x | number |
y | number |
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:402
Distance()
static Distance(value1, value2): number
Gets the distance between the vectors “value1” and “value2”
Parameters
Parameter | Type | Description |
---|---|---|
value1 | DeepImmutableObject <Vector2 > | defines first vector |
value2 | DeepImmutableObject <Vector2 > | defines second vector |
Returns
number
the distance between vectors
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:339
DistanceOfPointFromSegment()
static DistanceOfPointFromSegment(
p,
segA,
segB): number
Gets the shortest distance (float) between the point “p” and the segment defined by the two points “segA” and “segB”.
Parameters
Parameter | Type | Description |
---|---|---|
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
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:387
DistanceSquared()
static DistanceSquared(value1, value2): number
Returns the squared distance between the vectors “value1” and “value2”
Parameters
Parameter | Type | Description |
---|---|---|
value1 | DeepImmutableObject <Vector2 > | defines first vector |
value2 | DeepImmutableObject <Vector2 > | defines second vector |
Returns
number
the squared distance between vectors
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:349
Dot()
static Dot(left, right): number
Gets the dot product of the vector “left” and the vector “right”
Parameters
Parameter | Type | Description |
---|---|---|
left | DeepImmutableObject <Vector2 > | defines first vector |
right | DeepImmutableObject <Vector2 > | defines second vector |
Returns
number
the dot product (float)
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:240
FromArray()
static FromArray(array, offset): Vector2
Gets a new Vector2 set from the given index element of the given array
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
array | DeepImmutableObject <ArrayLike <number >> | undefined | defines the data source |
offset | number | 0 | defines the offset in the data source |
Returns
a new Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:66
FromArrayToRef()
static FromArrayToRef(
array,
offset,
result): void
Sets “result” from the given index element of the given array
Parameters
Parameter | Type | Description |
---|---|---|
array | ArrayLike <number > | defines the data source |
offset | number | defines the offset in the data source |
result | Vector2 | defines the target vector |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:76
Hermite()
static Hermite(
value1,
tangent1,
value2,
tangent2,
amount): Vector2
Returns a new Vector2 located for “amount” (float) on the Hermite spline defined by the vectors “value1”, “value2”, “tangent1”, “tangent2”
Parameters
Parameter | Type | Description |
---|---|---|
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
a new Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:147
Hermite1stDerivative()
static Hermite1stDerivative(
value1,
tangent1,
value2,
tangent2,
time): Vector2
Returns a new Vector2 which is the 1st derivative of the Hermite spline defined by the vectors “value1”, “value2”, “tangent1”, “tangent2”.
Parameters
Parameter | Type | Description |
---|---|---|
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
1st derivative
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:176
Hermite1stDerivativeToRef()
static Hermite1stDerivativeToRef(
value1,
tangent1,
value2,
tangent2,
time,
result): void
Returns a new Vector2 which is the 1st derivative of the Hermite spline defined by the vectors “value1”, “value2”, “tangent1”, “tangent2”.
Parameters
Parameter | Type | Description |
---|---|---|
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
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:199
Lerp()
static Lerp(
start,
end,
amount): Vector2
Returns a new Vector2 located for “amount” (float) on the linear interpolation between the vector “start” adn the vector “end”.
Parameters
Parameter | Type | Description |
---|---|---|
start | DeepImmutableObject <Vector2 > | defines the start vector |
end | DeepImmutableObject <Vector2 > | defines the end vector |
amount | number | defines the interpolation factor |
Returns
a new Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:228
Maximize()
static Maximize(left, right): Vector2
Gets a new Vector2 set with the maximal coordinate values from the “left” and “right” vectors
Parameters
Parameter | Type | Description |
---|---|---|
left | DeepImmutableObject <Vector2 > | defines 1st vector |
right | DeepImmutableObject <Vector2 > | defines 2nd vector |
Returns
a new Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:289
Minimize()
static Minimize(left, right): Vector2
Gets a new Vector2 set with the minimal coordinate values from the “left” and “right” vectors
Parameters
Parameter | Type | Description |
---|---|---|
left | DeepImmutableObject <Vector2 > | defines 1st vector |
right | DeepImmutableObject <Vector2 > | defines 2nd vector |
Returns
a new Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:277
Normalize()
static Normalize(vector): Vector2
Returns a new Vector2 equal to the normalized given vector
Parameters
Parameter | Type | Description |
---|---|---|
vector | DeepImmutableObject <Vector2 > | defines the vector to normalize |
Returns
a new Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:249
NormalizeToRef()
static NormalizeToRef(vector, result): void
Normalize a given vector into a second one
Parameters
Parameter | Type | Description |
---|---|---|
vector | DeepImmutableObject <Vector2 > | defines the vector to normalize |
result | Vector2 | defines the vector where to store the result |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:260
One()
static One(): Vector2
Gets a new Vector2(1, 1)
Returns
a new Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:56
PointInTriangle()
static PointInTriangle(
p,
p0,
p1,
p2): boolean
Determines if a given vector is included in a triangle
Parameters
Parameter | Type | Description |
---|---|---|
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”
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:319
Zero()
static Zero(): Vector2
Gets a new Vector2(0, 0)
Returns
a new Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:48