|
OpenSpace3D libs
OpenSpace 3D libraries for plugITs and OS3D developer
|
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 | ( | x | , |
| y | , | ||
| 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 [I I I I] : rectangle x y width height
- Returns
- I : return 1 if the coords are in the rectangle
◆ minf()
| minf | ( | a | , |
| b | |||
| ) |
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
-
[I I 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
-
[F F 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
-
[I I 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
-
[I I] : 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
-
[F F 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
-
[F F] : 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
-
[I I I] : first int vector [I I 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
-
[F F F] : first float vector [F F 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
-
[F F 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
-
[F F F] : float vector
- Returns
- F : average
◆ vectorCubeF()
| vectorCubeF | ( | vec | ) |
Get the cube of a vector.
Prototype: fun [[F F F]] F
- Parameters
-
[F F F] : float vector
- Returns
- F : cube (x * y * z)
◆ getVectorLength()
| getVectorLength | ( | vec1 | ) |
Get a vector length.
Prototype: fun [[I I I]] F
- Parameters
-
[I I I] : int vector
- Returns
- F : vector length
◆ getVectorLengthF()
| getVectorLengthF | ( | vec1 | ) |
Get a vector length.
Prototype: fun [[F F F]] F
- Parameters
-
[F F F] : float vector
- Returns
- F : vector length
◆ getVector4LengthF()
| getVector4LengthF | ( | vec1 | ) |
Get a vector 4 length.
Prototype: fun [[F F F F]] F
- Parameters
-
[F F 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
-
[I I I] : int vector [I I 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
-
[I I] : int vector [I I] : 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
-
[F F F] : float vector [F F 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
-
[I I I] : first int vector [I I 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
-
[F F F] : first float vector [F F 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
-
[I I I] : first int vector [I I 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
-
[F F F] : first float vector [F F 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
-
[I I I] : int vector [I I 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
-
[I I] : int vector [I I] : 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
-
[F F F] : float vector [F F 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
-
[F F F] : float vector [F F F] : float vector [F F 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
-
[I I I] : first int vector [I I 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
-
[F F F] : first int vector [F F 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
-
[F F] : first int vector [F F] : 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
-
[I I I] : first int vector [I I 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
-
[F F F] : first int vector [F F 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
-
[F F] : first int vector [F F] : 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
-
[I I I] : first int vector [I I 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
-
[F F F] : first float vector [F F 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
-
[I I] : first int vector [I I] : 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
-
[F F] : first float vector [F F] : 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
-
[I I I] : first int vector [I I 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
-
[F F F] : first float vector [F F 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
-
[I I] : first int vector [I I] : 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
-
[F F] : first float vector [F F] : 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
-
[I I I] : first int vector [I I 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
-
[F F F] : first float vector [F F 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
-
[I I] : first int vector [I I] : 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
-
[F F] : first float vector [F F] : 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
-
[I I I] : first int vector [I I 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
-
[I I] : first int vector [I I] : 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
-
[F F F] : first float vector [F F 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
-
[F F] : first float vector [F F] : 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
-
[I I I] : int vector to project [I I 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
-
[F F F] : float vector to project [F F 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
-
[I I I] : int vector to project [I I 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
-
[F F F] : float vector to project [F F 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
-
[F F F] : float vector [F F F] : float point lying on the vector [F F F] : plane normal float vector [F F 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
-
[F F F] : first point coordinates [F F F] : second point coordinates [F F F] : third point coordinates
- Returns
- [F F F] : plane normal
◆ getVectorXF()
| getVectorXF | ( | vec | ) |
Get vector X value.
Prototype: fun [[F F F]] F
- Parameters
-
[F F F] : float vector
- Returns
- F : X float result
◆ getVectorYF()
| getVectorYF | ( | vec | ) |
Get vector Y value.
Prototype: fun [[F F F]] F
- Parameters
-
[F F F] : float vector
- Returns
- F : Y float result
◆ getVectorZF()
| getVectorZF | ( | vec | ) |
Get vector Z value.
Prototype: fun [[F F F]] F
- Parameters
-
[F F F] : float vector
- Returns
- F : Z float result
◆ getShortestAngle()
| getShortestAngle | ( | p | , |
| q | |||
| ) |
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
-
[F F 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
-
[F F F] : source vector [F F F] : target vector
- Returns
- [F F F] : pitch yaw roll in radian
Generated by