@univerjs/engine-render v0.5.0-beta.1Docs


Class: Vector2

Implements

Constructors

new Vector2()

new Vector2(x, y): Vector2

Creates a new Vector2 from the given x and y coordinates

Parameters

ParameterTypeDefault valueDescription
xnumber0defines the first coordinate
ynumber0defines the second coordinate

Returns

Vector2

Defined in

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

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

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

Defined in

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


addByPoint()

addByPoint(x, y): Vector2

Parameters

ParameterType
xnumber
ynumber

Returns

Vector2

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

ParameterTypeDescription
otherVectorDeepImmutableObject<Vector2>defines the other vector

Returns

Vector2

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

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

Returns

Vector2

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

Vector2

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

ParameterTypeDescription
sourceDeepImmutableObject<Vector2>defines the source Vector2

Returns

Vector2

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

ParameterTypeDescription
xnumberdefines the first coordinate
ynumberdefines the second coordinate

Returns

Vector2

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

ParameterTypeDescription
otherVectorVector2defines the other vector

Returns

Vector2

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

ParameterTypeDescription
otherVectorDeepImmutableObject<Vector2>defines the other vector

Returns

Vector2

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

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

Returns

Vector2

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

ParameterTypeDescription
otherVectorDeepImmutableObject<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

Vector2

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

Vector2

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

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

Returns

Vector2

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

ParameterTypeDescription
otherVectorDeepImmutableObject<Vector2>defines the other vector

Returns

Vector2

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

ParameterTypeDescription
xnumberdefines the first coordinate
ynumberdefines the second coordinate

Returns

Vector2

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

ParameterTypeDescription
otherVectorDeepImmutableObject<Vector2>defines the other vector

Returns

Vector2

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

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

Returns

Vector2

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

Vector2

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

Vector2

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

ParameterTypeDescription
resultVector2defines the Vector3 object where to store the result

Returns

Vector2

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

Vector2

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

ParameterTypeDescription
anglenumberdefines the rotation angle

Returns

Vector2

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

ParameterType
anglenumber
originPointVector2

Returns

Vector2

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

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

Returns

Vector2

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

ParameterTypeDescription
scalenumberdefines the scaling factor

Returns

Vector2

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

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

Returns

Vector2

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

ParameterTypeDescription
scalenumberdefines the scaling factor

Returns

Vector2

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

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

Returns

Vector2

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

ParameterTypeDescription
xnumberdefines the first coordinate
ynumberdefines the second coordinate

Returns

Vector2

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

ParameterTypeDescription
otherVectorVector2defines the other vector

Returns

Vector2

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

ParameterType
xnumber
ynumber

Returns

Vector2

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

ParameterTypeDescription
otherVectorDeepImmutableObject<Vector2>defines the other vector

Returns

Vector2

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

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

Returns

Vector2

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

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

Returns

Vector2

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

ParameterType
anglenumber

Returns

Vector2

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

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

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

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

Returns

Vector2

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

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

Returns

Vector2

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

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

Defined in

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


create()

static create(x, y): Vector2

Parameters

ParameterType
xnumber
ynumber

Returns

Vector2

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

ParameterTypeDescription
value1DeepImmutableObject<Vector2>defines first vector
value2DeepImmutableObject<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

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

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

ParameterTypeDescription
value1DeepImmutableObject<Vector2>defines first vector
value2DeepImmutableObject<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

ParameterTypeDescription
leftDeepImmutableObject<Vector2>defines first vector
rightDeepImmutableObject<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

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

Returns

Vector2

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

ParameterTypeDescription
arrayArrayLike<number>defines the data source
offsetnumberdefines the offset in the data source
resultVector2defines 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

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

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

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

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

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

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

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

Returns

Vector2

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

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

Returns

Vector2

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

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

Returns

Vector2

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

ParameterTypeDescription
vectorDeepImmutableObject<Vector2>defines the vector to normalize

Returns

Vector2

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

ParameterTypeDescription
vectorDeepImmutableObject<Vector2>defines the vector to normalize
resultVector2defines 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

Vector2

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

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”

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

Vector2

a new Vector2

Defined in

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