@univerjs/engine-render v0.5.4


Class: Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:27

Implements

Constructors

new Vector2()

new Vector2(x, y): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:33

Creates a new Vector2 from the given x and y coordinates

Parameters

ParameterTypeDefault valueDescription
xnumber0defines the first coordinate
ynumber0defines the second coordinate

Returns

Vector2

Properties

PropertyModifierTypeDefault valueDescriptionDefined in
xpublicnumber0defines the first coordinatepackages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:35
ypublicnumber0defines the second coordinatepackages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:37

Methods

add()

add(otherVector): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:505

Add another vector with the current one

Parameters

ParameterTypeDescription
otherVectorDeepImmutableObject<Vector2>defines the other vector

Returns

Vector2

a new Vector2 set with the addition of the current Vector2 and the given one coordinates


addByPoint()

addByPoint(x, y): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:521

Parameters

ParameterType
xnumber
ynumber

Returns

Vector2


addInPlace()

addInPlace(otherVector): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:530

Set the Vector2 coordinates by adding the given Vector2 coordinates

Parameters

ParameterTypeDescription
otherVectorDeepImmutableObject<Vector2>defines the other vector

Returns

Vector2

the current updated Vector2


addToRef()

addToRef(otherVector, result): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:515

Sets the “result” coordinates with the addition of the current Vector2 and the given one coordinates

Parameters

ParameterTypeDescription
otherVectorDeepImmutableObject<Vector2>defines the other vector
resultVector2defines the target vector

Returns

Vector2

the unmodified current Vector2


asArray()

asArray(): number[]

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:461

Copy the current vector to an array

Returns

number[]

a new array with 2 elements: the Vector2 coordinates.


clone()

clone(): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:828

Gets a new Vector2 copied from the Vector2

Returns

Vector2

a new Vector2


copyFrom()

copyFrom(source): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:472

Sets the Vector2 coordinates with the given Vector2 coordinates

Parameters

ParameterTypeDescription
sourceDeepImmutableObject<Vector2>defines the source Vector2

Returns

Vector2

the current updated Vector2


copyFromFloats()

copyFromFloats(x, y): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:484

Sets the Vector2 coordinates with the given floats

Parameters

ParameterTypeDescription
xnumberdefines the first coordinate
ynumberdefines the second coordinate

Returns

Vector2

the current updated Vector2


divide()

divide(otherVector): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:619

Returns a new Vector2 set with the Vector2 coordinates divided by the given one coordinates

Parameters

ParameterTypeDescription
otherVectorVector2defines the other vector

Returns

Vector2

a new Vector2


divideInPlace()

divideInPlace(otherVector): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:640

Divides the current Vector2 coordinates by the given ones

Parameters

ParameterTypeDescription
otherVectorDeepImmutableObject<Vector2>defines the other vector

Returns

Vector2

the current updated Vector2


divideToRef()

divideToRef(otherVector, result): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:629

Sets the “result” coordinates with the Vector2 divided by the given one coordinates

Parameters

ParameterTypeDescription
otherVectorDeepImmutableObject<Vector2>defines the other vector
resultVector2defines the target vector

Returns

Vector2

the unmodified current Vector2


equals()

equals(otherVector): boolean

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:722

Gets a boolean if two vectors are equals

Parameters

ParameterTypeDescription
otherVectorDeepImmutableObject<Vector2>defines the other vector

Returns

boolean

true if the given vector coordinates strictly equal the current Vector2 ones


floor()

floor(): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:731

Gets a new Vector2 from current Vector2 floored values eg (1.2, 2.31) returns (1, 2)

Returns

Vector2

a new Vector2


fract()

fract(): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:740

Gets a new Vector2 from current Vector2 fractional values eg (1.2, 2.31) returns (0.2, 0.31)

Returns

Vector2

a new Vector2


fromArray()

fromArray(array, index): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:452

Update the current vector from an array

Parameters

ParameterTypeDefault valueDescription
arrayFloatArrayundefineddefines the destination array
indexnumber0defines the offset in the destination array

Returns

Vector2

the current Vector3


getClassName()

getClassName(): string

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:418

Gets class name

Returns

string

the string “Vector2”


getHashCode()

getHashCode(): number

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:426

Gets current vector hash code

Returns

number

the Vector2 hash code as a number


length()

length(): number

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:801

Gets the length of the vector

Returns

number

the vector length (float)


lengthSquared()

lengthSquared(): number

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:809

Gets the vector squared length

Returns

number

the vector squared length (float)


multiply()

multiply(otherVector): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:588

Returns a new Vector2 set with the multiplication of the current Vector2 and the given one coordinates

Parameters

ParameterTypeDescription
otherVectorDeepImmutableObject<Vector2>defines the other vector

Returns

Vector2

a new Vector2


multiplyByFloats()

multiplyByFloats(x, y): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:610

Gets a new Vector2 set with the Vector2 coordinates multiplied by the given floats

Parameters

ParameterTypeDescription
xnumberdefines the first coordinate
ynumberdefines the second coordinate

Returns

Vector2

a new Vector2


multiplyInPlace()

multiplyInPlace(otherVector): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:577

Multiplies in place the current Vector2 coordinates by the given ones

Parameters

ParameterTypeDescription
otherVectorDeepImmutableObject<Vector2>defines the other vector

Returns

Vector2

the current updated Vector2


multiplyToRef()

multiplyToRef(otherVector, result): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:598

Sets “result” coordinates with the multiplication of the current Vector2 and the given one coordinates

Parameters

ParameterTypeDescription
otherVectorDeepImmutableObject<Vector2>defines the other vector
resultVector2defines the target vector

Returns

Vector2

the unmodified current Vector2


negate()

negate(): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:648

Gets a new Vector2 with current Vector2 negated coordinates

Returns

Vector2

a new Vector2


negateInPlace()

negateInPlace(): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:656

Negate this vector in place

Returns

Vector2

this


negateToRef()

negateToRef(result): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:667

Negate the current Vector2 and stores the result in the given vector “result” coordinates

Parameters

ParameterTypeDescription
resultVector2defines the Vector3 object where to store the result

Returns

Vector2

the current Vector2


normalize()

normalize(): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:819

Normalize the vector

Returns

Vector2

the current updated Vector2


rotate()

rotate(angle): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:749

Rotate the current vector into a given result vector

Parameters

ParameterTypeDescription
anglenumberdefines the rotation angle

Returns

Vector2

the current vector


rotateByPoint()

rotateByPoint(angle, originPoint): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:774

Parameters

ParameterType
anglenumber
originPointVector2

Returns

Vector2


rotateToRef()

rotateToRef(angle, result): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:765

Rotate the current vector into a given result vector

Parameters

ParameterTypeDescription
anglenumberdefines the rotation angle
resultVector2defines the result vector where to store the rotated vector

Returns

Vector2

the current vector


scale()

scale(scale): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:687

Returns a new Vector2 scaled by “scale” from the current Vector2

Parameters

ParameterTypeDescription
scalenumberdefines the scaling factor

Returns

Vector2

a new Vector2


scaleAndAddToRef()

scaleAndAddToRef(scale, result): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:711

Scale the current Vector2 values by a factor and add the result to a given Vector2

Parameters

ParameterTypeDescription
scalenumberdefines the scale factor
resultVector2defines the Vector2 object where to store the result

Returns

Vector2

the unmodified current Vector2


scaleInPlace()

scaleInPlace(scale): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:676

Multiply the Vector2 coordinates by scale

Parameters

ParameterTypeDescription
scalenumberdefines the scaling factor

Returns

Vector2

the current updated Vector2


scaleToRef()

scaleToRef(scale, result): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:699

Scale the current Vector2 values by a factor to a given Vector2

Parameters

ParameterTypeDescription
scalenumberdefines the scale factor
resultVector2defines the Vector2 object where to store the result

Returns

Vector2

the unmodified current Vector2


set()

set(x, y): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:496

Sets the Vector2 coordinates with the given floats

Parameters

ParameterTypeDescription
xnumberdefines the first coordinate
ynumberdefines the second coordinate

Returns

Vector2

the current updated Vector2


subtract()

subtract(otherVector): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:541

Gets a new Vector2 set with the subtracted coordinates of the given one from the current Vector2

Parameters

ParameterTypeDescription
otherVectorVector2defines the other vector

Returns

Vector2

a new Vector2


subtractByPoint()

subtractByPoint(x, y): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:545

Parameters

ParameterType
xnumber
ynumber

Returns

Vector2


subtractInPlace()

subtractInPlace(otherVector): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:566

Sets the current Vector2 coordinates by subtracting from it the given one coordinates

Parameters

ParameterTypeDescription
otherVectorDeepImmutableObject<Vector2>defines the other vector

Returns

Vector2

the current updated Vector2


subtractToRef()

subtractToRef(otherVector, result): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:555

Sets the “result” coordinates with the subtraction of the given one from the current Vector2 coordinates.

Parameters

ParameterTypeDescription
otherVectorDeepImmutableObject<Vector2>defines the other vector
resultVector2defines the target vector

Returns

Vector2

the unmodified current Vector2


toArray()

toArray(array, index): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:440

Sets the Vector2 coordinates in the given array or Float32Array from the given index.

Parameters

ParameterTypeDefault valueDescription
arrayFloatArrayundefineddefines the source array
indexnumber0defines the offset in source array

Returns

Vector2

the current Vector2


toString()

toString(): string

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:410

Gets a string with the Vector2 coordinates

Returns

string

a string with the Vector2 coordinates


transformCoordinateOnRotate()

transformCoordinateOnRotate(angle): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:786

Parameters

ParameterType
anglenumber

Returns

Vector2


CatmullRom()

static CatmullRom(
   value1, 
   value2, 
   value3, 
   value4, 
   amount): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:90

Gets a new Vector2 located for “amount” (float) on the CatmullRom spline defined by the given four Vector2

Parameters

ParameterTypeDescription
value1DeepImmutableObject<Vector2>defines 1st point of control
value2DeepImmutableObject<Vector2>defines 2nd point of control
value3DeepImmutableObject<Vector2>defines 3rd point of control
value4DeepImmutableObject<Vector2>defines 4th point of control
amountnumberdefines the interpolation factor

Returns

Vector2

a new Vector2


Center()

static Center(value1, value2): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:361

Gets a new Vector2 located at the center of the vectors “value1” and “value2”

Parameters

ParameterTypeDescription
value1DeepImmutableObject<Vector2>defines first vector
value2DeepImmutableObject<Vector2>defines second vector

Returns

Vector2

a new Vector2


CenterToRef()

static CenterToRef(
   value1, 
   value2, 
   ref): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:372

Gets the center of the vectors “value1” and “value2” and stores the result in the vector “ref”

Parameters

ParameterTypeDescription
value1DeepImmutableObject<Vector2>defines first vector
value2DeepImmutableObject<Vector2>defines second vector
refDeepImmutableObject<Vector2>defines third vector

Returns

Vector2

ref


Clamp()

static Clamp(
   value, 
   min, 
   max): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:126

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

ParameterTypeDescription
valueDeepImmutableObject<Vector2>defines the value to clamp
minDeepImmutableObject<Vector2>defines the lower limit
maxDeepImmutableObject<Vector2>defines the upper limit

Returns

Vector2

a new Vector2


create()

static create(x, y): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:402

Parameters

ParameterType
xnumber
ynumber

Returns

Vector2


Distance()

static Distance(value1, value2): number

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:339

Gets the distance between the vectors “value1” and “value2”

Parameters

ParameterTypeDescription
value1DeepImmutableObject<Vector2>defines first vector
value2DeepImmutableObject<Vector2>defines second vector

Returns

number

the distance between vectors


DistanceOfPointFromSegment()

static DistanceOfPointFromSegment(
   p, 
   segA, 
   segB): number

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:387

Gets the shortest distance (float) between the point “p” and the segment defined by the two points “segA” and “segB”.

Parameters

ParameterTypeDescription
pDeepImmutableObject<Vector2>defines the middle point
segADeepImmutableObject<Vector2>defines one point of the segment
segBDeepImmutableObject<Vector2>defines the other point of the segment

Returns

number

the shortest distance


DistanceSquared()

static DistanceSquared(value1, value2): number

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:349

Returns the squared distance between the vectors “value1” and “value2”

Parameters

ParameterTypeDescription
value1DeepImmutableObject<Vector2>defines first vector
value2DeepImmutableObject<Vector2>defines second vector

Returns

number

the squared distance between vectors


Dot()

static Dot(left, right): number

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:240

Gets the dot product of the vector “left” and the vector “right”

Parameters

ParameterTypeDescription
leftDeepImmutableObject<Vector2>defines first vector
rightDeepImmutableObject<Vector2>defines second vector

Returns

number

the dot product (float)


FromArray()

static FromArray(array, offset): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:66

Gets a new Vector2 set from the given index element of the given array

Parameters

ParameterTypeDefault valueDescription
arrayDeepImmutableObject<ArrayLike<number>>undefineddefines the data source
offsetnumber0defines the offset in the data source

Returns

Vector2

a new Vector2


FromArrayToRef()

static FromArrayToRef(
   array, 
   offset, 
   result): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:76

Sets “result” from the given index element of the given array

Parameters

ParameterTypeDescription
arrayArrayLike<number>defines the data source
offsetnumberdefines the offset in the data source
resultVector2defines the target vector

Returns

void


Hermite()

static Hermite(
   value1, 
   tangent1, 
   value2, 
   tangent2, 
   amount): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:147

Returns a new Vector2 located for “amount” (float) on the Hermite spline defined by the vectors “value1”, “value2”, “tangent1”, “tangent2”

Parameters

ParameterTypeDescription
value1DeepImmutableObject<Vector2>defines the 1st control point
tangent1DeepImmutableObject<Vector2>defines the outgoing tangent
value2DeepImmutableObject<Vector2>defines the 2nd control point
tangent2DeepImmutableObject<Vector2>defines the incoming tangent
amountnumberdefines the interpolation factor

Returns

Vector2

a new Vector2


Hermite1stDerivative()

static Hermite1stDerivative(
   value1, 
   tangent1, 
   value2, 
   tangent2, 
   time): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:176

Returns a new Vector2 which is the 1st derivative of the Hermite spline defined by the vectors “value1”, “value2”, “tangent1”, “tangent2”.

Parameters

ParameterTypeDescription
value1DeepImmutableObject<Vector2>defines the first control point
tangent1DeepImmutableObject<Vector2>defines the first tangent
value2DeepImmutableObject<Vector2>defines the second control point
tangent2DeepImmutableObject<Vector2>defines the second tangent
timenumberdefine where the derivative must be done

Returns

Vector2

1st derivative


Hermite1stDerivativeToRef()

static Hermite1stDerivativeToRef(
   value1, 
   tangent1, 
   value2, 
   tangent2, 
   time, 
   result): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:199

Returns a new Vector2 which is the 1st derivative of the Hermite spline defined by the vectors “value1”, “value2”, “tangent1”, “tangent2”.

Parameters

ParameterTypeDescription
value1DeepImmutableObject<Vector2>defines the first control point
tangent1DeepImmutableObject<Vector2>defines the first tangent
value2DeepImmutableObject<Vector2>defines the second control point
tangent2DeepImmutableObject<Vector2>defines the second tangent
timenumberdefine where the derivative must be done
resultVector2define where the derivative will be stored

Returns

void


Lerp()

static Lerp(
   start, 
   end, 
   amount): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:228

Returns a new Vector2 located for “amount” (float) on the linear interpolation between the vector “start” adn the vector “end”.

Parameters

ParameterTypeDescription
startDeepImmutableObject<Vector2>defines the start vector
endDeepImmutableObject<Vector2>defines the end vector
amountnumberdefines the interpolation factor

Returns

Vector2

a new Vector2


Maximize()

static Maximize(left, right): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:289

Gets a new Vector2 set with the maximal coordinate values from the “left” and “right” vectors

Parameters

ParameterTypeDescription
leftDeepImmutableObject<Vector2>defines 1st vector
rightDeepImmutableObject<Vector2>defines 2nd vector

Returns

Vector2

a new Vector2


Minimize()

static Minimize(left, right): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:277

Gets a new Vector2 set with the minimal coordinate values from the “left” and “right” vectors

Parameters

ParameterTypeDescription
leftDeepImmutableObject<Vector2>defines 1st vector
rightDeepImmutableObject<Vector2>defines 2nd vector

Returns

Vector2

a new Vector2


Normalize()

static Normalize(vector): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:249

Returns a new Vector2 equal to the normalized given vector

Parameters

ParameterTypeDescription
vectorDeepImmutableObject<Vector2>defines the vector to normalize

Returns

Vector2

a new Vector2


NormalizeToRef()

static NormalizeToRef(vector, result): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:260

Normalize a given vector into a second one

Parameters

ParameterTypeDescription
vectorDeepImmutableObject<Vector2>defines the vector to normalize
resultVector2defines the vector where to store the result

Returns

void


One()

static One(): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:56

Gets a new Vector2(1, 1)

Returns

Vector2

a new Vector2


PointInTriangle()

static PointInTriangle(
   p, 
   p0, 
   p1, 
   p2): boolean

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:319

Determines if a given vector is included in a triangle

Parameters

ParameterTypeDescription
pDeepImmutableObject<Vector2>defines the vector to test
p0DeepImmutableObject<Vector2>defines 1st triangle point
p1DeepImmutableObject<Vector2>defines 2nd triangle point
p2DeepImmutableObject<Vector2>defines 3rd triangle point

Returns

boolean

true if the point “p” is in the triangle defined by the vectors “p0”, “p1”, “p2”


Zero()

static Zero(): Vector2

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/basics/vector2.ts:48

Gets a new Vector2(0, 0)

Returns

Vector2

a new Vector2