Project

General

Profile

OpenSpace3D libs
OpenSpace 3D libraries for plugITs and OS3D developer
Loading...
Searching...
No Matches

Functions

 isCoordInRect (x, y, rect)
 Test if the coordinates are in the rectangle.
 
 minf (a, b)
 Get the smallest float value.
 
 ftori (val)
 Convert a float value to a rounded int value (float to rounded integer)
 
 zeroVector (vec)
 Test if a vector is set to 0.
 
 zeroVectorF (vec)
 Test if a float vector is set to 0.
 
 vectorIsZero (vec)
 Test if a vector is set to 0.
 
 vector2dIsZero (vec)
 Test if a 2d vector is set to 0.
 
 vectorIsZeroF (vec)
 Test if a float vector is set to 0.
 
 vector2dIsZeroF (vec)
 Test if a 2d float vector is set to 0.
 
 vectorEqual (vec1, vec2)
 Test if two vectors are equal.
 
 vectorEqualF (vec1, vec2)
 Test if two float vectors are equal.
 
 normalizeVectorF (vec)
 Normalize a float vector.
 
 vectorAverageF (vec)
 Get the average of a vector.
 
 vectorCubeF (vec)
 Get the cube of a vector.
 
 getVectorLength (vec1)
 Get a vector length.
 
 getVectorLengthF (vec1)
 Get a vector length.
 
 getVector4LengthF (vec1)
 Get a vector 4 length.
 
 getVectorDistance (vec1, vec2)
 Get the distance between 2 vectors.
 
 getVector2dDistance (vec1, vec2)
 Get the distance between 2 2D vectors.
 
 getVectorDistanceF (vec1, vec2)
 Get the distance between 2 vectors.
 
 crossVector (vec1, vec2)
 Cross product of two vectors.
 
 crossVectorF (vec1, vec2)
 Cross product of two vectors.
 
 dotVector (vec1, vec2)
 Dot product of two vectors.
 
 dotVectorF (vec1, vec2)
 Dot product of two vectors.
 
 getVectorAngle (vec1, vec2)
 Get the angle between 2 vectors in radian.
 
 getVector2dAngle (vec1, vec2)
 Get the angle between 2 2D vectors in degree.
 
 getVectorAngleF (vec1, vec2)
 Get the angle between 2 vectors in radian.
 
 getVectorOrientedAngleF (vec1, vec2, planenormal)
 Get the oriented angle between 2 vectors in radian, between pi and -pi.
 
 minVector (vec1, vec2)
 Min of two vectors.
 
 minVectorF (vec1, vec2)
 Min of two vectors.
 
 minVector2F (vec1, vec2)
 Min of two vectors 2.
 
 maxVector (vec1, vec2)
 Max of two vectors.
 
 maxVectorF (vec1, vec2)
 Max of two vectors.
 
 maxVector2F (vec1, vec2)
 Max of two vectors.
 
 subVector (vec1, vec2)
 Substract two vectors.
 
 subVectorF (vec1, vec2)
 Substract two float vectors.
 
 subVector2 (vec1, vec2)
 Substract two vectors 2.
 
 subVector2F (vec1, vec2)
 Substract two float vectors 2.
 
 addVector (vec1, vec2)
 Add two vectors.
 
 addVectorF (vec1, vec2)
 Add two float vectors.
 
 addVector2 (vec1, vec2)
 Add two vectors.
 
 addVector2F (vec1, vec2)
 Add two float vectors 2.
 
 divideVector (vec1, vec2)
 Divide two vectors.
 
 divideVectorF (vec1, vec2)
 Divide two float vectors.
 
 divideVector2 (vec1, vec2)
 Divide two vectors 2.
 
 divideVector2F (vec1, vec2)
 Divide two float vectors 2.
 
 multiplyVector (vec1, vec2)
 Multiply two vectors.
 
 multiplyVector2 (vec1, vec2)
 Multiply two vectors 2.
 
 multiplyVectorF (vec1, vec2)
 Multiply two float vectors.
 
 multiplyVector2F (vec1, vec2)
 Multiply two float vectors 2.
 
 projectVector (vec1, vec2)
 Project an int vector onto another int vector.
 
 projectVectorF (vec1, vec2)
 Project a float vector onto another float vector.
 
 projectVectorOnPlane (vec, planenormal)
 Project an int vector onto a plane defined by its int normal vector.
 
 projectVectorOnPlaneF (vec, planenormal)
 Project a float vector onto a plane defined by its float normal vector.
 
 vectorPlaneIntersectionF (vec, vecpoint, planenormal, planepoint)
 Intersection point between a plane and a vector.
 
 getPlaneNormalF (point1, point2, point3)
 Get a plane normal from 3 points belonging to the plane.
 
 getVectorXF (vec)
 Get vector X value.
 
 getVectorYF (vec)
 Get vector Y value.
 
 getVectorZF (vec)
 Get vector Z value.
 
 getShortestAngle (p, q)
 Get the shortest angle.
 
 quatInverse (quat)
 Get quaternion inverse.
 
 lookAtPYR (src, target, flipz)
 LookAt function that return pitch yaw roll in radian.
 

Detailed Description

Vector tools

Function Documentation

◆ isCoordInRect()

isCoordInRect ( ,
,
rect   
)

Test if the coordinates are in the rectangle.

Prototype: fun [I I [I I I I]] I

Parameters
I: x coord
I: y coord
[II I I] : rectangle x y width height
Returns
I : return 1 if the coords are in the rectangle

◆ minf()

minf ( ,
 
)

Get the smallest float value.

Prototype: fun [F F] F

Parameters
F: first value
F: second value
Returns
F : the smallest value

◆ ftori()

ftori ( val  )

Convert a float value to a rounded int value (float to rounded integer)

Prototype: fun [F] I

Parameters
F: float value
Returns
I : rounded int value

◆ zeroVector()

zeroVector ( vec  )

Test if a vector is set to 0.

Prototype: fun [[I I I]] I

Parameters
[II I] : int vector
Returns
I : 1 if the vector is 0, 0 otherwise

◆ zeroVectorF()

zeroVectorF ( vec  )

Test if a float vector is set to 0.

Prototype: fun [[F F F]] I

Parameters
[FF F] : float vector
Returns
I : 1 if the vector is 0, 0 otherwise

◆ vectorIsZero()

vectorIsZero ( vec  )

Test if a vector is set to 0.

Prototype: fun [[I I I]] I

Parameters
[II I] : int vector
Returns
I : 1 if the vector is 0, 0 otherwise

◆ vector2dIsZero()

vector2dIsZero ( vec  )

Test if a 2d vector is set to 0.

Prototype: fun [[I I]] I

Parameters
[II] : int vector
Returns
I : 1 if the vector is 0, 0 otherwise

◆ vectorIsZeroF()

vectorIsZeroF ( vec  )

Test if a float vector is set to 0.

Prototype: fun [[F F F]] I

Parameters
[FF F] : float vector
Returns
I : 1 if the vector is 0, 0 otherwise

◆ vector2dIsZeroF()

vector2dIsZeroF ( vec  )

Test if a 2d float vector is set to 0.

Prototype: fun [[F F]] I

Parameters
[FF] : float vector
Returns
I : 1 if the vector is 0, 0 otherwise

◆ vectorEqual()

vectorEqual ( vec1  ,
vec2   
)

Test if two vectors are equal.

Prototype: fun [[I I I] [I I I]] I

Parameters
[II I] : first int vector
[II I] : second int vector
Returns
I : 1 if the two vectors are equal, 0 otherwise

◆ vectorEqualF()

vectorEqualF ( vec1  ,
vec2   
)

Test if two float vectors are equal.

Prototype: fun [[F F F] [F F F]] I

Parameters
[FF F] : first float vector
[FF F] : second float vector
Returns
I : 1 if the two vectors are equal, 0 otherwise

◆ normalizeVectorF()

normalizeVectorF ( vec  )

Normalize a float vector.

Prototype: fun [[F F F]] [F F F]

Parameters
[FF F] : float vector
Returns
[F F F] : normalized float vector

◆ vectorAverageF()

vectorAverageF ( vec  )

Get the average of a vector.

Prototype: fun [[F F F]] F

Parameters
[FF F] : float vector
Returns
F : average

◆ vectorCubeF()

vectorCubeF ( vec  )

Get the cube of a vector.

Prototype: fun [[F F F]] F

Parameters
[FF F] : float vector
Returns
F : cube (x * y * z)

◆ getVectorLength()

getVectorLength ( vec1  )

Get a vector length.

Prototype: fun [[I I I]] F

Parameters
[II I] : int vector
Returns
F : vector length

◆ getVectorLengthF()

getVectorLengthF ( vec1  )

Get a vector length.

Prototype: fun [[F F F]] F

Parameters
[FF F] : float vector
Returns
F : vector length

◆ getVector4LengthF()

getVector4LengthF ( vec1  )

Get a vector 4 length.

Prototype: fun [[F F F F]] F

Parameters
[FF F F] : float vector
Returns
F : vector length

◆ getVectorDistance()

getVectorDistance ( vec1  ,
vec2   
)

Get the distance between 2 vectors.

Prototype: fun [[I I I] [I I I]] F

Parameters
[II I] : int vector
[II I] : int vector
Returns
F : vector length

◆ getVector2dDistance()

getVector2dDistance ( vec1  ,
vec2   
)

Get the distance between 2 2D vectors.

Prototype: fun [[I I] [I I]] F

Parameters
[II] : int vector
[II] : int vector
Returns
F : vector length

◆ getVectorDistanceF()

getVectorDistanceF ( vec1  ,
vec2   
)

Get the distance between 2 vectors.

Prototype: fun [[F F F] [F F F]] F

Parameters
[FF F] : float vector
[FF F] : float vector
Returns
F : vector length

◆ crossVector()

crossVector ( vec1  ,
vec2   
)

Cross product of two vectors.

Prototype: fun [[I I I] [I I I]] [I I I]

Parameters
[II I] : first int vector
[II I] : second int vector
Returns
[I I I] : vector result

◆ crossVectorF()

crossVectorF ( vec1  ,
vec2   
)

Cross product of two vectors.

Prototype: fun [[F F F] [F F F]] [F F F]

Parameters
[FF F] : first float vector
[FF F] : second float vector
Returns
[F F F] : float vector result

◆ dotVector()

dotVector ( vec1  ,
vec2   
)

Dot product of two vectors.

Prototype: fun [[I I I] [I I I]] [I I I]

Parameters
[II I] : first int vector
[II I] : second int vector
Returns
F : dot product result

◆ dotVectorF()

dotVectorF ( vec1  ,
vec2   
)

Dot product of two vectors.

Prototype: fun [[F F F] [F F F]] [F F F]

Parameters
[FF F] : first float vector
[FF F] : second float vector
Returns
F : dot product result

◆ getVectorAngle()

getVectorAngle ( vec1  ,
vec2   
)

Get the angle between 2 vectors in radian.

Prototype: fun [[I I I] [I I I]] F

Parameters
[II I] : int vector
[II I] : int vector
Returns
F : angle between the 2 vectors

◆ getVector2dAngle()

getVector2dAngle ( vec1  ,
vec2   
)

Get the angle between 2 2D vectors in degree.

Prototype: fun [[I I] [I I]] F

Parameters
[II] : int vector
[II] : int vector
Returns
F : angle between the 2 vectors

◆ getVectorAngleF()

getVectorAngleF ( vec1  ,
vec2   
)

Get the angle between 2 vectors in radian.

Prototype: fun [[F F F] [F F F]] F

Parameters
[FF F] : float vector
[FF F] : float vector
Returns
F : angle between the 2 vectors

◆ getVectorOrientedAngleF()

getVectorOrientedAngleF ( vec1  ,
vec2  ,
planenormal   
)

Get the oriented angle between 2 vectors in radian, between pi and -pi.

Prototype: fun [[F F F] [F F F] [F F F]] F

Parameters
[FF F] : float vector
[FF F] : float vector
[FF F] : normal of the plane containing both vector. Used for the angle orientation
Returns
F : angle between the 2 vectors

◆ minVector()

minVector ( vec1  ,
vec2   
)

Min of two vectors.

Prototype: fun [[I I I] [I I I]] [I I I]

Parameters
[II I] : first int vector
[II I] : second int vector
Returns
[I I I] : min result

◆ minVectorF()

minVectorF ( vec1  ,
vec2   
)

Min of two vectors.

Prototype: fun [[F F F] [F F F]] [F F F]

Parameters
[FF F] : first int vector
[FF F] : second int vector
Returns
[F F F] : min result

◆ minVector2F()

minVector2F ( vec1  ,
vec2   
)

Min of two vectors 2.

Prototype: fun [[F F] [F F]] [F F]

Parameters
[FF] : first int vector
[FF] : second int vector
Returns
[F F] : min result

◆ maxVector()

maxVector ( vec1  ,
vec2   
)

Max of two vectors.

Prototype: fun [[I I I] [I I I]] [I I I]

Parameters
[II I] : first int vector
[II I] : second int vector
Returns
[I I I] : max result

◆ maxVectorF()

maxVectorF ( vec1  ,
vec2   
)

Max of two vectors.

Prototype: fun [[F F F] [F F F]] [F F F]

Parameters
[FF F] : first int vector
[FF F] : second int vector
Returns
[F F F] : max result

◆ maxVector2F()

maxVector2F ( vec1  ,
vec2   
)

Max of two vectors.

Prototype: fun [[F F] [F F]] [F F]

Parameters
[FF] : first int vector
[FF] : second int vector
Returns
[F F] : max result

◆ subVector()

subVector ( vec1  ,
vec2   
)

Substract two vectors.

Prototype: fun [[I I I] [I I I]] [I I I]

Parameters
[II I] : first int vector
[II I] : second int vector
Returns
[I I I] : vector result

◆ subVectorF()

subVectorF ( vec1  ,
vec2   
)

Substract two float vectors.

Prototype: fun [[F F F] [F F F]] [F F F]

Parameters
[FF F] : first float vector
[FF F] : second float vector
Returns
[F F F] : float vector result

◆ subVector2()

subVector2 ( vec1  ,
vec2   
)

Substract two vectors 2.

Prototype: fun [[I I] [I I]] [I I]

Parameters
[II] : first int vector
[II] : second int vector
Returns
[I I] : vector result

◆ subVector2F()

subVector2F ( vec1  ,
vec2   
)

Substract two float vectors 2.

Prototype: fun [[F F] [F F]] [F F]

Parameters
[FF] : first float vector
[FF] : second float vector
Returns
[F F] : float vector result

◆ addVector()

addVector ( vec1  ,
vec2   
)

Add two vectors.

Prototype: fun [[I I I] [I I I]] [I I I]

Parameters
[II I] : first int vector
[II I] : second int vector
Returns
[I I I] : vector result

◆ addVectorF()

addVectorF ( vec1  ,
vec2   
)

Add two float vectors.

Prototype: fun [[F F F] [F F F]] [F F F]

Parameters
[FF F] : first float vector
[FF F] : second float vector
Returns
[F F F] : float vector result

◆ addVector2()

addVector2 ( vec1  ,
vec2   
)

Add two vectors.

Prototype: fun [[I I] [I I]] [I I]

Parameters
[II] : first int vector
[II] : second int vector
Returns
[I I] : vector result

◆ addVector2F()

addVector2F ( vec1  ,
vec2   
)

Add two float vectors 2.

Prototype: fun [[F F] [F F]] [F F]

Parameters
[FF] : first float vector
[FF] : second float vector
Returns
[F F] : float vector result

◆ divideVector()

divideVector ( vec1  ,
vec2   
)

Divide two vectors.

Prototype: fun [[I I I] [I I I]] [I I I]

Parameters
[II I] : first int vector
[II I] : second int vector
Returns
[I I I] : vector result

◆ divideVectorF()

divideVectorF ( vec1  ,
vec2   
)

Divide two float vectors.

Prototype: fun [[F F F] [F F F]] [F F F]

Parameters
[FF F] : first float vector
[FF F] : second float vector
Returns
[F F F] : float vector result

◆ divideVector2()

divideVector2 ( vec1  ,
vec2   
)

Divide two vectors 2.

Prototype: fun [[I I] [I I]] [I I]

Parameters
[II] : first int vector
[II] : second int vector
Returns
[I I] : vector result

◆ divideVector2F()

divideVector2F ( vec1  ,
vec2   
)

Divide two float vectors 2.

Prototype: fun [[F F] [F F]] [F F]

Parameters
[FF] : first float vector
[FF] : second float vector
Returns
[F F] : float vector result

◆ multiplyVector()

multiplyVector ( vec1  ,
vec2   
)

Multiply two vectors.

Prototype: fun [[I I I] [I I I]] [I I I]

Parameters
[II I] : first int vector
[II I] : second int vector
Returns
[I I I] : vector result

◆ multiplyVector2()

multiplyVector2 ( vec1  ,
vec2   
)

Multiply two vectors 2.

Prototype: fun [[I I] [I I]] [I I]

Parameters
[II] : first int vector
[II] : second int vector
Returns
[I I] : vector result

◆ multiplyVectorF()

multiplyVectorF ( vec1  ,
vec2   
)

Multiply two float vectors.

Prototype: fun [[F F F] [F F F]] [F F F]

Parameters
[FF F] : first float vector
[FF F] : second float vector
Returns
[F F F] : float vector result

◆ multiplyVector2F()

multiplyVector2F ( vec1  ,
vec2   
)

Multiply two float vectors 2.

Prototype: fun [[F F] [F F]] [F F]

Parameters
[FF] : first float vector
[FF] : second float vector
Returns
[F F] : float vector result

◆ projectVector()

projectVector ( vec1  ,
vec2   
)

Project an int vector onto another int vector.

Prototype: fun [[I I I] [I I I]] [F F F]

Parameters
[II I] : int vector to project
[II I] : int vector on which the vector is projected
Returns
[F F F] : vector result, nil if the second vector is the zero vector

◆ projectVectorF()

projectVectorF ( vec1  ,
vec2   
)

Project a float vector onto another float vector.

Prototype: fun [[F F F] [F F F]] [F F F]

Parameters
[FF F] : float vector to project
[FF F] : float vector on which the vector is projected
Returns
[F F F] : float vector result, nil if the second vector is the zero vector

◆ projectVectorOnPlane()

projectVectorOnPlane ( vec  ,
planenormal   
)

Project an int vector onto a plane defined by its int normal vector.

Prototype: fun [[I I I] [I I I]] [F F F]

Parameters
[II I] : int vector to project
[II I] : normal vector of the plane
Returns
[F F F] : vector result, nil if the normal is the zero vector

◆ projectVectorOnPlaneF()

projectVectorOnPlaneF ( vec  ,
planenormal   
)

Project a float vector onto a plane defined by its float normal vector.

Prototype: fun [[F F F] [F F F]] [F F F]

Parameters
[FF F] : float vector to project
[FF F] : normal vector of the plane
Returns
[F F F] : float vector result, nil if the normal is the zero vector

◆ vectorPlaneIntersectionF()

vectorPlaneIntersectionF ( vec  ,
vecpoint  ,
planenormal  ,
planepoint   
)

Intersection point between a plane and a vector.

Prototype: fun [[F F F] [F F F] [F F F] [F F F]] [F F F]

Parameters
[FF F] : float vector
[FF F] : float point lying on the vector
[FF F] : plane normal float vector
[FF F] : float point lying on the plane
Returns
[F F F] : intersection point, nil if it does not exist

◆ getPlaneNormalF()

getPlaneNormalF ( point1  ,
point2  ,
point3   
)

Get a plane normal from 3 points belonging to the plane.

Prototype: fun [[F F F][F F F][F F F]] [F F F]

Parameters
[FF F] : first point coordinates
[FF F] : second point coordinates
[FF F] : third point coordinates
Returns
[F F F] : plane normal

◆ getVectorXF()

getVectorXF ( vec  )

Get vector X value.

Prototype: fun [[F F F]] F

Parameters
[FF F] : float vector
Returns
F : X float result

◆ getVectorYF()

getVectorYF ( vec  )

Get vector Y value.

Prototype: fun [[F F F]] F

Parameters
[FF F] : float vector
Returns
F : Y float result

◆ getVectorZF()

getVectorZF ( vec  )

Get vector Z value.

Prototype: fun [[F F F]] F

Parameters
[FF F] : float vector
Returns
F : Z float result

◆ getShortestAngle()

getShortestAngle ( ,
 
)

Get the shortest angle.

Prototype: fun [F] F

Parameters
F: angle in degree
Returns
F : the shortest angle in degree

◆ quatInverse()

quatInverse ( quat  )

Get quaternion inverse.

Prototype: fun [[F F F F]] [F F F F]

Parameters
[FF F F] : quaternion
Returns
[F F F F] : the inversed quaternion

◆ lookAtPYR()

lookAtPYR ( src  ,
target  ,
flipz   
)

LookAt function that return pitch yaw roll in radian.

Prototype: fun [[F F F] [F F F] [F F F]] [F F F]

Parameters
[FF F] : source vector
[FF F] : target vector
Returns
[F F F] : pitch yaw roll in radian