VisimBox 1.0 VisimBox 3d simulation and visualisation ToolBox

- Main Page
- Packages
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Static Public Member Functions | Static Public Attributes
VisiMath.MathTools Class Reference

Various float math tools. More...

List of all members.

## Static Public Member Functions
static int | NearestPower2 (int value)
| Returns nearest higher number then parameter which is power of 2.
static void | NearestTextureSize (ref int width, ref int height)
| Changes size of the texture to nearest power of two.
static float | Sqrt (float val)
| Float square root.
static float | InverseSqrFast (float x)
| Computes fast inverse sqr.
static float | Pow (float a, float b)
| Returns a ^ b.
static bool | IsAlmostZero (float val)
| returns true if number is almost zero (defined by Epsilon)
static float | Abs (float val)
| Returns absolute value.
static float | Min (float val1, float val2)
| Returns smaller value.
static float | Min (float val1, float val2, float val3)
| Returns smaller value.
static float | Min (Vector3 vec)
| returns minimal value inside vector3
static Vector3 | Min (ref Vector3 vec1, ref Vector3 vec2)
| Creates minimal vector from two vectors. result has lowest values from both vectors)
static Vector3 | Max (ref Vector3 vec1, ref Vector3 vec2)
| Creates maximal vector from two vectors. result has maximal values from both vectors)
static float | Max (float val1, float val2)
| Returns bigger value.
static float | Max (float val1, float val2, float val3)
| Returns bigger value.
static float | Max (Vector3 vec)
| returns Maximal value inside vector3
static void | ClampToUnit (ref float val)
| Clamps float value to unit - 0 to 1.
static float | ClampToUnit (float val)
| Clamps float value to unit - 0 to 1.
static float | Clamp (float val, float min, float max)
| Returns clamped float value.
static void | Clamp (ref float val, float min, float max)
| Clamps float value.
static int | Clamp (int val, int min, int max)
| Returns clamped int value.
static int | ClampMin (int val, int min)
| Returns clamped int value.
static int | ClampMax (int val, int max)
| Returns clamped int value.
static float | ClampMin (float val, float min)
| Returns float value clamped to minimal allowed.
static void | ClampMin (ref float val, float min)
| Returns float value clamped to minimal allowed.
static void | ClampMax (ref float val, float max)
| Returns float value clamped to maximum allowed.
static float | ClampMax (float val, float max)
| Returns float value clamped to maximum allowed.
static float | Floor (float val)
| Returns largest integer less or equal to val.
static void | Floor (ref float val)
| Floors (changes to larges integer less or equal) val.
static float | FractionalPart (float val)
| returns fractional part of the value
static void | Swap (ref float val1, ref float val2)
| Swaps two float values.
static void | Swap (ref int val1, ref int val2)
| Swaps two integer values.
static bool | AlmostEqual (float val1, float val2, float epsilon=0.00001f)
| Checks two float values for equality with epsilon.
static float | Sin (float angle)
| Returns float sinus.
static float | Cos (float angle)
| Returns float cosinus.
static float | ASin (float value)
| Arcus sinus.
static float | ACos (float value)
| Arcus cosinus.
static float | ATan (float value)
| Arcus Tangens.
static float | ATan2 (float value1, float value2)
| Arcus Tangens 2.
static float | RadToDeg (float radians, bool clamp=false)
| Converts degrees to radians.
static float | DegToRad (float degrees, bool clamp=false)
| converts radians to degrees
static Vector3 | DegToRad (Vector3 rot)
| Converts rotational vector in degrees to radians.
static void | DegToRad (ref Vector3 rot)
| Converts rotational vector in degrees to radians.
static Vector3 | RadToDeg (Vector3 rot)
| Converts rotational vector in radians to degrees.
static void | RadToDeg (ref Vector3 rot)
| Converts rotational vector in radians to degrees.
static float | ClampRotation (float angle)
| Clamps rotation to -2pi to 2pi.
static void | ClampRotation (ref float angle)
| Clamps rotation to -2pi to 2pi.
static Vector3 | ClampRotation (Vector3 rot)
| Clamps rotation RPY vector to -2pi to 2pi.
static void | ClampRotation (ref Vector3 rot)
| Clamps rotation RPY vector to -2pi to 2pi.
static float | Bias (float val)
| Calculates bias.
static float | Gain (float a, float b)
| Calculates gain.
static float | Lerp (float t, float a, float b)
| Calculates linear interpolation from a to b.
static float | Interp (float t, float a, float b)
| Interpolation.
static float | BicubInterp (float tx, float ty, float v0, float v1, float v2, float v3)
| Bicubic interpolation.
static float | TricubInterp (float tx, float ty, float tz, float v0, float v1, float v2, float v3, float v4, float v5, float v6, float v7)
| Tricubic interpolation.
static float | CosInterp (float t, float a, float b)
| Calculates cosine interpolation from a to b.
static float | CubicInterp (float t, float v0, float v1, float v2, float v3)
| Returns cubic interpolation between v1 and v2 from four values.
static bool | PointOnLine (ref Vector3 l1, ref Vector3 l2, ref Vector3 pos, out float t)
| Checks if point lies on the inifinite line and sets t to line parameter. Parameter can be used to decide if the point is in some part of the line boundry.
static bool | PointOnLine (ref Vector3 l1, ref Vector3 l2, ref Vector3 pos)
| Checks if point lies on the inifinite line.
static bool | PointOnLineSegment (Vector3 l1, Vector3 l2, Vector3 pos)
| Checks if point lies on the linesegment.
static bool | PointOnLineSegment (ref Vector3 l1, ref Vector3 l2, ref Vector3 pos)
| Checks if point lies on the linesegment.
static bool | PointInTriangle (Vector3 v1, Vector3 v2, Vector3 v3, Vector3 p)
| Returns true if point is inside the triangle.
static bool | PointInTriangle (ref Vector3 v1, ref Vector3 v2, ref Vector3 v3, ref Vector3 p)
| Returns true if point is inside the triangle.
static void | CalcTriNormal (ref Vector3 v1, ref Vector3 v2, ref Vector3 v3, out Vector3 norm, bool normalize=true)
| Calculates normal of the triangle (position must be in clockwise order)
static Vector3 | CalcTriNormal (ref Vector3 v1, ref Vector3 v2, ref Vector3 v3, bool normalize=true)
| Calculates normal of the triangle (position must be in clockwise order)
static Vector3 | CalcTriNormal (Vector3 v1, Vector3 v2, Vector3 v3, bool normalize=true)
| Calculates normal of the triangle (position must be in clockwise order)
static float | DistanceVectorLineSegment (Vector3 l1, Vector3 l2, Vector3 pos)
| Returns distance of the position from the linesegment.
static float | DistanceVectorLineSegment (ref Vector3 l1, ref Vector3 l2, ref Vector3 pos)
| Returns distance of the position from the linesegment.
static float | DistanceVectorLineSegment (ref Vector3 l1, ref Vector3 l2, ref Vector3 pos, out float r)
| Returns distance of the position from the linesegment.
static float | DistanceVectorLine (ref Vector3 l1, ref Vector3 l2, ref Vector3 pos)
| Returns distance of the position from the infinite line.
static float | DistanceVectorRay (ref Vector3 orig, ref Vector3 dir, ref Vector3 pos, bool frontOnly=true)
| Returns distance of the position from the ray.
static float | DistanceVectorTriangle (Vector3 first, Vector3 second, Vector3 third, Vector3 vec)
| Calculates distance of the vector from the triangle.
static float | DistanceVectorTriangle (ref Vector3 first, ref Vector3 second, ref Vector3 third, ref Vector3 vec)
| Calculates distance of the vector from the triangle.
static float | DistanceVectorQuad (ref Vector3 first, ref Vector3 second, ref Vector3 third, ref Vector3 fourth, ref Vector3 vec)
| Calculates distance of the vector from the quad.
static float | DistanceVectorQuad (Vector3 first, Vector3 second, Vector3 third, Vector3 fourth, Vector3 vec)
| Calculates distance of the vector from the quad.
static float | DistanceVectorSphere (ref Vector3 center, float radius, ref Vector3 pos)
| Calculates distance between point and sphere.
static float | DistanceVectorSphere (Vector3 center, float radius, Vector3 pos)
| Calculates distance between point and sphere.
static float | DistanceVectorPlane (ref Vector3 point, ref Vector3 normal, ref Vector3 pos)
| Returns distance between vector and plane.
static float | DistanceVectorPlane (Vector3 point, Vector3 normal, Vector3 pos)
| Returns distance between vector and plane.
static float | DistanceRayTriangle (Vector3 orig, Vector3 dir, Vector3 first, Vector3 second, Vector3 third, bool frontOnly=true)
| Calculates distance of the ray to the triangle (0 if intersection)
static float | DistanceRayTriangle (ref Vector3 orig, ref Vector3 dir, ref Vector3 first, ref Vector3 second, ref Vector3 third, bool frontOnly=true)
| Calculates distance of the ray to the triangle (0 if intersection)
static float | DistanceRayToLineSegment (Vector3 orig, Vector3 dir, Vector3 l1, Vector3 l2, bool frontOnly=true)
| Computes distance of the ray to the line segment.
static float | DistanceRayToLineSegment (ref Vector3 orig1, ref Vector3 norm1, ref Vector3 orig2, ref Vector3 targ2, bool frontOnly=true)
static float | DistanceRayToLineSegment (ref Vector3 orig1, ref Vector3 norm1, ref Vector3 orig2, ref Vector3 targ2, out float t, bool frontOnly=true)
| Computes distance of the ray to the line segment.
static float | DistanceTwoRays (Vector3 orig1, Vector3 norm1, Vector3 orig2, Vector3 norm2, bool frontOnly=true)
| Computes distance of two rays.
static float | DistanceTwoRays (ref Vector3 orig1, ref Vector3 norm1, ref Vector3 orig2, ref Vector3 norm2, bool frontOnly=true)
| Computes distance of two rays.
static float | DistanceTwoRays (ref Vector3 orig1, ref Vector3 norm1, ref Vector3 orig2, ref Vector3 norm2, out float s, bool frontOnly=true)
| Computes distance of two rays.
static float | DistanceRayQuad (ref Vector3 orig1, ref Vector3 norm1, ref Vector3 p1, ref Vector3 p2, ref Vector3 p3, ref Vector3 p4, bool frontOnly=true)
| Returns distance of the ray to quad.
static float | DistanceTwoLines (ref Vector3 orig1, ref Vector3 dir1, ref Vector3 orig2, ref Vector3 dir2)
| Calculates distance between two lines.
static float | DistanceTwoLines (ref Vector3 orig1, ref Vector3 norm1, ref Vector3 orig2, ref Vector3 norm2, out float s, out float t)
| Calculates distance of two lines.
static float | DistanceTwoLineSegments (ref Vector3 orig1, ref Vector3 targ1, ref Vector3 orig2, ref Vector3 targ2)
| Calculates distance of two line segments.
static float | DistanceTwoLineSegments (Vector3 orig1, Vector3 targ1, Vector3 orig2, Vector3 targ2)
| Calculates distance of two line segments.
static float | DistanceTwoLineSegments (ref Vector3 orig1, ref Vector3 targ1, ref Vector3 orig2, ref Vector3 targ2, out float s, out float t)
| Calculates distance of two line segments.
static float | DistanceLineSegmentTriangle (Vector3 l1, Vector3 l2, Vector3 p1, Vector3 p2, Vector3 p3)
| Returns distance between Line segment and triangle.
static float | DistanceLineSegmentTriangle (ref Vector3 l1, ref Vector3 l2, ref Vector3 p1, ref Vector3 p2, ref Vector3 p3)
| Returns distance between Line segment and triangle.
static float | DistanceLineSegmentQuad (ref Vector3 l1, ref Vector3 l2, ref Vector3 p1, ref Vector3 p2, ref Vector3 p3, ref Vector3 p4)
| Returns distance between Line segment and quad.
static float | DistanceLineSegmentQuad (Vector3 l1, Vector3 l2, Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4)
| Returns distance between Line segment and quad.
static float | DistanceLineSegmentSphere (Vector3 l1, Vector3 l2, Vector3 center, float radius)
| Returns distance between Line segment and triangle.
static float | DistanceLineSegmentSphere (ref Vector3 l1, ref Vector3 l2, ref Vector3 center, float radius)
| Returns distance between Line segment and triangle.
static float | DistanceTwoTriangles (Vector3 p1, Vector3 p2, Vector3 p3, Vector3 q1, Vector3 q2, Vector3 q3)
| Returns closest distance between two triangles.
static float | DistanceTwoTriangles (ref Vector3 p1, ref Vector3 p2, ref Vector3 p3, ref Vector3 q1, ref Vector3 q2, ref Vector3 q3)
| Returns closest distance between two triangles.
static float | DistanceTriangleQuad (Vector3 p1, Vector3 p2, Vector3 p3, Vector3 q1, Vector3 q2, Vector3 q3, Vector3 q4)
| Returns closest distance between triangle and quad.
static float | DistanceTriangleQuad (ref Vector3 p1, ref Vector3 p2, ref Vector3 p3, ref Vector3 q1, ref Vector3 q2, ref Vector3 q3, ref Vector3 q4)
| Returns closest distance between triangle and quad.
static float | DistanceSphereTriangle (ref Vector3 center, float radius, ref Vector3 p1, ref Vector3 p2, ref Vector3 p3)
| Returns distance between sphere and triangle.
static float | DistanceSphereTriangle (Vector3 center, float radius, Vector3 p1, Vector3 p2, Vector3 p3)
| Returns distance between sphere and triangle.
static float | DistanceSphereQuad (ref Vector3 center, float radius, ref Vector3 p1, ref Vector3 p2, ref Vector3 p3, ref Vector3 p4)
| Returns distance between sphere and quad.
static float | DistanceSphereQuad (Vector3 center, float radius, Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4)
| Returns distance between sphere and quad.
static float | DistanceTwoSpheres (ref Vector3 center1, float radius1, ref Vector3 center2, float radius2)
| Returns distance between two spheres.
static float | DistanceTwoSpheres (Vector3 center1, float radius1, Vector3 center2, float radius2)
| Returns distance between two spheres.
static bool | Intersects (ref Vector3 center, float radius, ref Vector3 min, ref Vector3 max)
| Quick check if sphere and AA box are in contact.
static bool | Intersects (ref Vector3 center, float radius, ref Vector3 min, float size)
| Quick check if sphere and regular AA box are in contact.
static bool | IntersectionSegmentCylinder (ref Vector3 line1, ref Vector3 line2, ref Vector3 caps1, ref Vector3 caps2, float radius, out float t)
| Checks for intersection between line segment and cylinder.
static bool | IntersectionSegmentCapsule (ref Vector3 line1, ref Vector3 line2, ref Vector3 caps1, ref Vector3 caps2, float radius, out float t)
| Checks for intersection between line segment and capsue.
static bool | IntersectionTriangleCapsule (ref Vector3 l1, ref Vector3 l2, ref Vector3 l3, ref Vector3 caps1, ref Vector3 caps2, float radius, out float t)
| Checks for intersection between triangle and capsue.
static bool | IntersectionSegmentSphere (ref Vector3 line1, ref Vector3 line2, ref Vector3 center, float radius, out float t)
| Checks for intersection between line segment and sphere.
static Vector3 | IntersectionRayPlane (ref Vector3 orig, ref Vector3 dir, ref Vector3 point, ref Vector3 normal)
| Intersection of ray and plane.
static bool | IntersectionRayPlane (ref Vector3 orig, ref Vector3 dir, ref Vector3 point, ref Vector3 normal, out float t, out Vector3 interspoint)
| Intersection of ray and plane.
static bool | IntersectionLinePlane (ref Vector3 orig, ref Vector3 dir, ref Vector3 point, ref Vector3 normal, out float t, out Vector3 interspoint)
| Intersection of infinite line and plane.
static Vector3 | IntersectionRayTriangle (ref Vector3 orig, ref Vector3 dir, ref Vector3 first, ref Vector3 second, ref Vector3 third, bool frontFace=false)
| Returns intersection point of ray and triangle.
static bool | IntersectionRayTriangle (Vector3 orig, Vector3 dir, Vector3 first, Vector3 second, Vector3 third, out float distance, out Vector3 inters, bool frontFace=false)
| Returns intersection point of ray and triangle and distance.
static bool | IntersectionRayTriangle (ref Vector3 orig, ref Vector3 dir, ref Vector3 first, ref Vector3 second, ref Vector3 third, out float distance, out Vector3 inters, bool frontFace=false)
| Returns intersection point of ray and triangle and distance.
static bool | IntersectionLineTriangle (ref Vector3 orig, ref Vector3 dir, ref Vector3 first, ref Vector3 second, ref Vector3 third, out float distance, out Vector3 inters)
| Returns intersection point of ray and triangle and distance.
static bool | IntersectionRayLineSegment (ref Vector3 orig, ref Vector3 dir, ref Vector3 l1, ref Vector3 l2, out float distance, out Vector3 point)
| Calculates intersection of ray and line segment.
static bool | IntersectionRayLineSegment (Vector3 orig, Vector3 dir, Vector3 l1, Vector3 l2, out float distance, out Vector3 point)
| Calculates intersection of ray and line segment.
static bool | IntersectionTwoRays (ref Vector3 orig1, ref Vector3 dir1, ref Vector3 orig2, ref Vector3 dir2, out float distance, out Vector3 point)
| Returns intersection of two rays if it exists.
static bool | IntersectionRayAABox (ref Vector3 orig1, ref Vector3 dir1, ref Vector3 min, ref Vector3 max, out float distance, out Vector3 point)
| Returns intersection of ray and Axis alligned box.
static bool | IntersectionSphereTriangle (ref Vector3 center, float radius, ref Vector3 p1, ref Vector3 p2, ref Vector3 p3)
| Calculates intersection of the sphere and triangle - creates ColTriangle, it's faster to use it directly!
static bool | ContainsFully (ref Vector3 min1, ref Vector3 max1, ref Vector3 min2, ref Vector3 max2)
| Returns true if bounding box 1 fully contains box 2.
static bool | ContainsFully (ref Vector3 corner, float size, ref Vector3 min2, ref Vector3 max2)
| Returns true if regular bounding box 1 fully contains box 2.
## Static Public Attributes
static float | HalfPi = (float)Math.PI / 2
| Pi / 2.
static float | QuarterPi = (float)Math.PI / 4
| Pi / 4.
static float | Pi = (float)Math.PI
| Pi.
static float | DoublePi = (float)(Math.PI * 2)
| Pi * 2.
static float | Epsilon = 0.000001f
| Epsilon value.

## Detailed Description

Various float math tools.

## Member Function Documentation

static float VisiMath.MathTools.Abs | ( | float | val | ) | `[static]`

Returns absolute value.

Parameters:

  val | float value

Returns:
  ABS(val)

static float VisiMath.MathTools.ACos | ( | float | value | ) | `[static]`

Arcus cosinus.

Parameters:

  value | value

Returns:
  Acos(value)

static bool VisiMath.MathTools.AlmostEqual | ( | float | val1,
|  | float | val2,
|  | float | epsilon = `0.00001f`
| ) |  | `[static]`

Checks two float values for equality with epsilon.

Parameters:

  val1 | first value
  val2 | second value
  epsilon | required epsilon

Returns:
  True of values are almost same

static float VisiMath.MathTools.ASin | ( | float | value | ) | `[static]`

Arcus sinus.

Parameters:

  value | value

Returns:
  ASIN(value)

static float VisiMath.MathTools.ATan | ( | float | value | ) | `[static]`

Arcus Tangens.

Parameters:

  value | Value

Returns:
  Atan

static float VisiMath.MathTools.ATan2 | ( | float | value1,
|  | float | value2
| ) |  | `[static]`

Arcus Tangens 2.

Parameters:

  value1 | first value
  value2 | second value

Returns:
  Atan

static float VisiMath.MathTools.Bias | ( | float | val | ) | `[static]`

Calculates bias.

Parameters:

  val | Value

Returns:
  Bias of value

static float VisiMath.MathTools.BicubInterp | ( | float | tx,
|  | float | ty,
|  | float | v0,
|  | float | v1,
|  | float | v2,
|  | float | v3
| ) |  | `[static]`

Bicubic interpolation.

Parameters:

  tx |
  ty |
  v0 |
  v1 |
  v2 |
  v3 |

Returns:

static Vector3 VisiMath.MathTools.CalcTriNormal | ( | ref Vector3 | v1,
|  | ref Vector3 | v2,
|  | ref Vector3 | v3,
|  | bool | normalize = `true`
| ) |  | `[static]`

Calculates normal of the triangle (position must be in clockwise order)

Parameters:

  v1 | First corner
  v2 | Second corner
  v3 | Third corner
  normalize | if set to false, normal won't be normalized after calculation! (usable for some applications)

Returns:
  Normal of the triangle face

static Vector3 VisiMath.MathTools.CalcTriNormal | ( | Vector3 | v1,
|  | Vector3 | v2,
|  | Vector3 | v3,
|  | bool | normalize = `true`
| ) |  | `[static]`

Calculates normal of the triangle (position must be in clockwise order)

Parameters:

  v1 | First corner
  v2 | Second corner
  v3 | Third corner
  normalize | if set to false, normal won't be normalized after calculation! (usable for some applications)

Returns:
  Normal of the triangle face

static void VisiMath.MathTools.CalcTriNormal | ( | ref Vector3 | v1,
|  | ref Vector3 | v2,
|  | ref Vector3 | v3,
|  | out Vector3 | norm,
|  | bool | normalize = `true`
| ) |  | `[static]`

Calculates normal of the triangle (position must be in clockwise order)

Parameters:

  v1 | First corner
  v2 | Second corner
  v3 | Third corner
  normalize | if set to false, normal won't be normalized after calculation! (usable for some applications)
  norm | Normal will be saved here

static float VisiMath.MathTools.Clamp | ( | float | val,
|  | float | min,
|  | float | max
| ) |  | `[static]`

Returns clamped float value.

Parameters:

  val | value to be clamped
  min | minimal possible value
  max | maximal possible value

Returns:
  Clamped float value

static void VisiMath.MathTools.Clamp | ( | ref float | val,
|  | float | min,
|  | float | max
| ) |  | `[static]`

Clamps float value.

Parameters:

  val | value to be clamped
  min | minimal possible value
  max | maximal possible value

static int VisiMath.MathTools.Clamp | ( | int | val,
|  | int | min,
|  | int | max
| ) |  | `[static]`

Returns clamped int value.

Parameters:

  val | value to be clamped
  min | minimal possible value
  max | maximal possible value

Returns:
  Clamped int value

static int VisiMath.MathTools.ClampMax | ( | int | val,
|  | int | max
| ) |  | `[static]`

Returns clamped int value.

Parameters:

  val | value to be clamped
  max | maximal possible value

Returns:
  Clamped int value

static float VisiMath.MathTools.ClampMax | ( | float | val,
|  | float | max
| ) |  | `[static]`

Returns float value clamped to maximum allowed.

Parameters:

  val | value to be clamped
  max | maximal possible value

Returns:
  Clamped float value

static void VisiMath.MathTools.ClampMax | ( | ref float | val,
|  | float | max
| ) |  | `[static]`

Returns float value clamped to maximum allowed.

Parameters:

  val | value to be clamped
  max | maximal possible value

static int VisiMath.MathTools.ClampMin | ( | int | val,
|  | int | min
| ) |  | `[static]`

Returns clamped int value.

Parameters:

  val | value to be clamped
  min | minimal possible value

Returns:
  Clamped int value

static float VisiMath.MathTools.ClampMin | ( | float | val,
|  | float | min
| ) |  | `[static]`

Returns float value clamped to minimal allowed.

Parameters:

  val | value to be clamped
  min | minimal possible value

Returns:
  Clamped float value

static void VisiMath.MathTools.ClampMin | ( | ref float | val,
|  | float | min
| ) |  | `[static]`

Returns float value clamped to minimal allowed.

Parameters:

  val | value to be clamped
  min | minimal possible value

static float VisiMath.MathTools.ClampRotation | ( | float | angle | ) | `[static]`

Clamps rotation to -2pi to 2pi.

Parameters:

  angle | angle

Returns:
  clamped angle

static void VisiMath.MathTools.ClampRotation | ( | ref float | angle | ) | `[static]`

Clamps rotation to -2pi to 2pi.

Parameters:

  angle | angle

static Vector3 VisiMath.MathTools.ClampRotation | ( | Vector3 | rot | ) | `[static]`

Clamps rotation RPY vector to -2pi to 2pi.

Parameters:

  rot | rotation vector

Returns:
  Clamped version

static void VisiMath.MathTools.ClampRotation | ( | ref Vector3 | rot | ) | `[static]`

Clamps rotation RPY vector to -2pi to 2pi.

Parameters:

  rot | rotation vector

static void VisiMath.MathTools.ClampToUnit | ( | ref float | val | ) | `[static]`

Clamps float value to unit - 0 to 1.

Parameters:

  val | Unit to be clamped

static float VisiMath.MathTools.ClampToUnit | ( | float | val | ) | `[static]`

Clamps float value to unit - 0 to 1.

Parameters:

  val | Unit to be clamped

Returns:
  Clamped value

static bool VisiMath.MathTools.ContainsFully | ( | ref Vector3 | corner,
|  | float | size,
|  | ref Vector3 | min2,
|  | ref Vector3 | max2
| ) |  | `[static]`

Returns true if regular bounding box 1 fully contains box 2.

Parameters:

  corner | Minimum corner of regular bb1
  size | Size of bb1
  min2 | Minimum corner of bb2
  max2 | Maximum corner of bb2

Returns:

static bool VisiMath.MathTools.ContainsFully | ( | ref Vector3 | min1,
|  | ref Vector3 | max1,
|  | ref Vector3 | min2,
|  | ref Vector3 | max2
| ) |  | `[static]`

Returns true if bounding box 1 fully contains box 2.

Parameters:

  min1 | Minimum corner of bb1
  max1 | Maximum corner of bb1
  min2 | Minimum corner of bb2
  max2 | Maximum corner of bb2

Returns:

static float VisiMath.MathTools.Cos | ( | float | angle | ) | `[static]`

Returns float cosinus.

Parameters:

  angle | angle in radians

Returns:
  cos(angle)

static float VisiMath.MathTools.CosInterp | ( | float | t,
|  | float | a,
|  | float | b
| ) |  | `[static]`

Calculates cosine interpolation from a to b.

Parameters:

  t | interpolation parameter
  a | A point
  b | B point

Returns:
  Interpolated value

static float VisiMath.MathTools.CubicInterp | ( | float | t,
|  | float | v0,
|  | float | v1,
|  | float | v2,
|  | float | v3
| ) |  | `[static]`

Returns cubic interpolation between v1 and v2 from four values.

Parameters:

  t | interpolation parameter (0-1)
  v0 |
  v1 |
  v2 |
  v3 |

Returns:
  Interpolated value

static float VisiMath.MathTools.DegToRad | ( | float | degrees,
|  | bool | clamp = `false`
| ) |  | `[static]`

converts radians to degrees

Parameters:

  degrees | degrees
  clamp | if true, value will be clamped

Returns:
  radians

static Vector3 VisiMath.MathTools.DegToRad | ( | Vector3 | rot | ) | `[static]`

Converts rotational vector in degrees to radians.

Parameters:

  rot | Rotational vector in degrees

Returns:
  Rotational vector in radians

static void VisiMath.MathTools.DegToRad | ( | ref Vector3 | rot | ) | `[static]`

Converts rotational vector in degrees to radians.

Parameters:

  rot | Rotational vector in degrees

static float VisiMath.MathTools.DistanceLineSegmentQuad | ( | ref Vector3 | l1,
|  | ref Vector3 | l2,
|  | ref Vector3 | p1,
|  | ref Vector3 | p2,
|  | ref Vector3 | p3,
|  | ref Vector3 | p4
| ) |  | `[static]`

Returns distance between Line segment and quad.

Parameters:

  l1 | Start of the line
  l2 | End of the line
  p1 | First corner
  p2 | Second corner
  p3 | Third corner
  p4 | Fourth corner

Returns:
  Closest distance

static float VisiMath.MathTools.DistanceLineSegmentQuad | ( | Vector3 | l1,
|  | Vector3 | l2,
|  | Vector3 | p1,
|  | Vector3 | p2,
|  | Vector3 | p3,
|  | Vector3 | p4
| ) |  | `[static]`

Returns distance between Line segment and quad.

Parameters:

  l1 | Start of the line
  l2 | End of the line
  p1 | First corner
  p2 | Second corner
  p3 | Third corner
  p4 | Fourth corner

Returns:
  Closest distance

static float VisiMath.MathTools.DistanceLineSegmentSphere | ( | Vector3 | l1,
|  | Vector3 | l2,
|  | Vector3 | center,
|  | float | radius
| ) |  | `[static]`

Returns distance between Line segment and triangle.

Parameters:

  l1 | Start of the line
  l2 | End of the line
  center | Center of the sphere
  radius | Radius of the sphere

Returns:
  Closest distance

static float VisiMath.MathTools.DistanceLineSegmentSphere | ( | ref Vector3 | l1,
|  | ref Vector3 | l2,
|  | ref Vector3 | center,
|  | float | radius
| ) |  | `[static]`

Returns distance between Line segment and triangle.

Parameters:

  l1 | Start of the line
  l2 | End of the line
  center | Center of the sphere
  radius | Radius of the sphere

Returns:
  Closest distance

static float VisiMath.MathTools.DistanceLineSegmentTriangle | ( | Vector3 | l1,
|  | Vector3 | l2,
|  | Vector3 | p1,
|  | Vector3 | p2,
|  | Vector3 | p3
| ) |  | `[static]`

Returns distance between Line segment and triangle.

Parameters:

  l1 | Start of the line
  l2 | End of the line
  p1 | First corner
  p2 | Second corner
  p3 | Third corner

Returns:
  Closest distance

static float VisiMath.MathTools.DistanceLineSegmentTriangle | ( | ref Vector3 | l1,
|  | ref Vector3 | l2,
|  | ref Vector3 | p1,
|  | ref Vector3 | p2,
|  | ref Vector3 | p3
| ) |  | `[static]`

Returns distance between Line segment and triangle.

Parameters:

  l1 | Start of the line
  l2 | End of the line
  p1 | First corner
  p2 | Second corner
  p3 | Third corner

Returns:
  Closest distance

static float VisiMath.MathTools.DistanceRayQuad | ( | ref Vector3 | orig1,
|  | ref Vector3 | norm1,
|  | ref Vector3 | p1,
|  | ref Vector3 | p2,
|  | ref Vector3 | p3,
|  | ref Vector3 | p4,
|  | bool | frontOnly = `true`
| ) |  | `[static]`

Returns distance of the ray to quad.

Parameters:

  orig1 | Origin of the ray
  norm1 | Normalized direction
  p1 | corner of the quad
  p2 | corner of the quad
  p3 | corner of the quad
  p4 | corner of the quad
  frontOnly | Check only objects in front of the origin

Returns:
  Closest distance to the ray, if frontOnly and object is behind the ray, returns NaN

static float VisiMath.MathTools.DistanceRayToLineSegment | ( | Vector3 | orig,
|  | Vector3 | dir,
|  | Vector3 | l1,
|  | Vector3 | l2,
|  | bool | frontOnly = `true`
| ) |  | `[static]`

Computes distance of the ray to the line segment.

Parameters:

  orig | Origin of the ray
  dir | Normalized direction
  l1 | First point of the line
  l2 | Second point of the line
  frontOnly | Check only objects in front of the origin

Returns:
  Closest distance to the ray, if frontOnly and object is behind the ray, returns NaN

static float VisiMath.MathTools.DistanceRayToLineSegment | ( | ref Vector3 | orig1,
|  | ref Vector3 | norm1,
|  | ref Vector3 | orig2,
|  | ref Vector3 | targ2,
|  | bool | frontOnly = `true`
| ) |  | `[static]`

Computes distance of the ray to the line segment

Parameters:

  orig1 | Origin of the ray
  norm1 | Normalized direction
  orig2 | First point of the line
  targ2 | Second point of the line
  frontOnly | Check only objects in front of the origin

Returns:
  Closest distance to the ray, if frontOnly and object is behind the ray, returns NaN

static float VisiMath.MathTools.DistanceRayToLineSegment | ( | ref Vector3 | orig1,
|  | ref Vector3 | norm1,
|  | ref Vector3 | orig2,
|  | ref Vector3 | targ2,
|  | out float | t,
|  | bool | frontOnly = `true`
| ) |  | `[static]`

Computes distance of the ray to the line segment.

Parameters:

  orig1 | Origin of the ray
  norm1 | Normalized direction
  orig2 | First point of the line
  targ2 | Second point of the line
  frontOnly | Check only objects in front of the origin
  t | t parameter of the ray

Returns:
  Closest distance to the ray, if frontOnly and object is behind the ray, returns NaN

static float VisiMath.MathTools.DistanceRayTriangle | ( | Vector3 | orig,
|  | Vector3 | dir,
|  | Vector3 | first,
|  | Vector3 | second,
|  | Vector3 | third,
|  | bool | frontOnly = `true`
| ) |  | `[static]`

Calculates distance of the ray to the triangle (0 if intersection)

Parameters:

  orig | Origin of ray
  dir | Normalized direction of ray
  first | First triangle vertice
  second | Second triangle vertice
  third | Third triangle vertice
  frontOnly | Check only objects in front of the origin

Returns:
  Closest distance to the ray, if frontOnly and object is behind the ray, returns NaN

static float VisiMath.MathTools.DistanceRayTriangle | ( | ref Vector3 | orig,
|  | ref Vector3 | dir,
|  | ref Vector3 | first,
|  | ref Vector3 | second,
|  | ref Vector3 | third,
|  | bool | frontOnly = `true`
| ) |  | `[static]`

Calculates distance of the ray to the triangle (0 if intersection)

Parameters:

  orig | Origin of ray
  dir | Normalized direction of ray
  first | First triangle vertice
  second | Second triangle vertice
  third | Third triangle vertice
  frontOnly | Check only objects in front of the origin

Returns:
  Closest distance to the ray, if frontOnly and object is behind the ray, returns NaN

static float VisiMath.MathTools.DistanceSphereQuad | ( | ref Vector3 | center,
|  | float | radius,
|  | ref Vector3 | p1,
|  | ref Vector3 | p2,
|  | ref Vector3 | p3,
|  | ref Vector3 | p4
| ) |  | `[static]`

Returns distance between sphere and quad.

Parameters:

  center | center of the sphere
  radius | Radius
  p1 | Corner of the quad
  p2 | Corner of the quad
  p3 | Corner of the quad
  p4 | Corner of the quad

Returns:
  closest distance

static float VisiMath.MathTools.DistanceSphereQuad | ( | Vector3 | center,
|  | float | radius,
|  | Vector3 | p1,
|  | Vector3 | p2,
|  | Vector3 | p3,
|  | Vector3 | p4
| ) |  | `[static]`

Returns distance between sphere and quad.

Parameters:

  center | center of the sphere
  radius | Radius
  p1 | Corner of the quad
  p2 | Corner of the quad
  p3 | Corner of the quad
  p4 | Corner of the quad

Returns:
  closest distance

static float VisiMath.MathTools.DistanceSphereTriangle | ( | ref Vector3 | center,
|  | float | radius,
|  | ref Vector3 | p1,
|  | ref Vector3 | p2,
|  | ref Vector3 | p3
| ) |  | `[static]`

Returns distance between sphere and triangle.

Parameters:

  center | center of the sphere
  radius | Radius
  p1 | Corner of the triangle
  p2 | Corner of the triangle
  p3 | Corner of the triangle

Returns:
  closest distance

static float VisiMath.MathTools.DistanceSphereTriangle | ( | Vector3 | center,
|  | float | radius,
|  | Vector3 | p1,
|  | Vector3 | p2,
|  | Vector3 | p3
| ) |  | `[static]`

Returns distance between sphere and triangle.

Parameters:

  center | center of the sphere
  radius | Radius
  p1 | Corner of the triangle
  p2 | Corner of the triangle
  p3 | Corner of the triangle

Returns:
  closest distance

static float VisiMath.MathTools.DistanceTriangleQuad | ( | ref Vector3 | p1,
|  | ref Vector3 | p2,
|  | ref Vector3 | p3,
|  | ref Vector3 | q1,
|  | ref Vector3 | q2,
|  | ref Vector3 | q3,
|  | ref Vector3 | q4
| ) |  | `[static]`

Returns closest distance between triangle and quad.

Parameters:

  p1 | Triangle 1 corner 1
  p2 | Triangle 1 corner 2
  p3 | Triangle 1 corner 3
  q1 | quad corner 1
  q2 | quad corner 2
  q3 | quad corner 3
  q4 | quad corner 4

Returns:
  Closest distance

static float VisiMath.MathTools.DistanceTriangleQuad | ( | Vector3 | p1,
|  | Vector3 | p2,
|  | Vector3 | p3,
|  | Vector3 | q1,
|  | Vector3 | q2,
|  | Vector3 | q3,
|  | Vector3 | q4
| ) |  | `[static]`

Returns closest distance between triangle and quad.

Parameters:

  p1 | Triangle 1 corner 1
  p2 | Triangle 1 corner 2
  p3 | Triangle 1 corner 3
  q1 | quad corner 1
  q2 | quad corner 2
  q3 | quad corner 3
  q4 | quad corner 4

Returns:
  Closest distance

static float VisiMath.MathTools.DistanceTwoLines | ( | ref Vector3 | orig1,
|  | ref Vector3 | dir1,
|  | ref Vector3 | orig2,
|  | ref Vector3 | dir2
| ) |  | `[static]`

Calculates distance between two lines.

Parameters:

  orig1 | Origin of the first line
  dir1 | Direction of the first line
  orig2 | Origin of the second line
  dir2 | Direction of the second line

Returns:
  Distance between lines

static float VisiMath.MathTools.DistanceTwoLines | ( | ref Vector3 | orig1,
|  | ref Vector3 | norm1,
|  | ref Vector3 | orig2,
|  | ref Vector3 | norm2,
|  | out float | s,
|  | out float | t
| ) |  | `[static]`

Calculates distance of two lines.

Parameters:

  orig1 | Origin of the first line
  norm1 | Normal of the first line
  orig2 | Origin of the second line
  norm2 | Normal of the second line
  s | Will be filled with parameter for first line
  t | Will be filled with parameter for second line

Returns:
  Distance of lines

static float VisiMath.MathTools.DistanceTwoLineSegments | ( | Vector3 | orig1,
|  | Vector3 | targ1,
|  | Vector3 | orig2,
|  | Vector3 | targ2
| ) |  | `[static]`

Calculates distance of two line segments.

Parameters:

  orig1 | Origin of the first line
  targ1 | End point of the first line
  orig2 | Origin of the second line
  targ2 | End point of the second line

Returns:
  Distance of lines

static float VisiMath.MathTools.DistanceTwoLineSegments | ( | ref Vector3 | orig1,
|  | ref Vector3 | targ1,
|  | ref Vector3 | orig2,
|  | ref Vector3 | targ2
| ) |  | `[static]`

Calculates distance of two line segments.

Parameters:

  orig1 | Origin of the first line
  targ1 | End point of the first line
  orig2 | Origin of the second line
  targ2 | End point of the second line

Returns:
  Distance of lines

static float VisiMath.MathTools.DistanceTwoLineSegments | ( | ref Vector3 | orig1,
|  | ref Vector3 | targ1,
|  | ref Vector3 | orig2,
|  | ref Vector3 | targ2,
|  | out float | s,
|  | out float | t
| ) |  | `[static]`

Calculates distance of two line segments.

Parameters:

  orig1 | Origin of the first line
  targ1 | End point of the first line
  orig2 | Origin of the second line
  targ2 | End point of the second line
  s | Will be filled with parameter for first line
  t | Will be filled with parameter for second line

Returns:
  Distance of lines

static float VisiMath.MathTools.DistanceTwoRays | ( | Vector3 | orig1,
|  | Vector3 | norm1,
|  | Vector3 | orig2,
|  | Vector3 | norm2,
|  | bool | frontOnly = `true`
| ) |  | `[static]`

Computes distance of two rays.

Parameters:

  orig1 | Origin of the ray
  norm1 | Normalized direction
  orig2 | Origin of the ray 2
  norm2 | Normalized direction of the ray 2
  frontOnly | Check only objects in front of the origin

Returns:
  Closest distance to the ray, if frontOnly and object is behind the ray, returns NaN

static float VisiMath.MathTools.DistanceTwoRays | ( | ref Vector3 | orig1,
|  | ref Vector3 | norm1,
|  | ref Vector3 | orig2,
|  | ref Vector3 | norm2,
|  | bool | frontOnly = `true`
| ) |  | `[static]`

Computes distance of two rays.

Parameters:

  orig1 | Origin of the ray
  norm1 | Normalized direction
  orig2 | Origin of the ray 2
  norm2 | Normalized direction of the ray 2
  frontOnly | Check only objects in front of the origin

Returns:
  Closest distance to the ray, if frontOnly and object is behind the ray, returns NaN

static float VisiMath.MathTools.DistanceTwoRays | ( | ref Vector3 | orig1,
|  | ref Vector3 | norm1,
|  | ref Vector3 | orig2,
|  | ref Vector3 | norm2,
|  | out float | s,
|  | bool | frontOnly = `true`
| ) |  | `[static]`

Computes distance of two rays.

Parameters:

  orig1 | Origin of the ray
  norm1 | Normalized direction
  orig2 | Origin of the ray 2
  norm2 | Normalized direction of the ray 2
  frontOnly | Check only objects in front of the origin
  s | Parameter for the closest point of the first ray

Returns:
  Closest distance to the ray, if frontOnly and object is behind the ray, returns NaN

static float VisiMath.MathTools.DistanceTwoSpheres | ( | ref Vector3 | center1,
|  | float | radius1,
|  | ref Vector3 | center2,
|  | float | radius2
| ) |  | `[static]`

Returns distance between two spheres.

Parameters:

  center1 | Center of sphere 1
  radius1 | Radius of sphere 1
  center2 | Center of sphere 2
  radius2 | Radius of sphere 2

Returns:
  Distance between spheres

static float VisiMath.MathTools.DistanceTwoSpheres | ( | Vector3 | center1,
|  | float | radius1,
|  | Vector3 | center2,
|  | float | radius2
| ) |  | `[static]`

Returns distance between two spheres.

Parameters:

  center1 | Center of sphere 1
  radius1 | Radius of sphere 1
  center2 | Center of sphere 2
  radius2 | Radius of sphere 2

Returns:
  Distance between spheres

static float VisiMath.MathTools.DistanceTwoTriangles | ( | Vector3 | p1,
|  | Vector3 | p2,
|  | Vector3 | p3,
|  | Vector3 | q1,
|  | Vector3 | q2,
|  | Vector3 | q3
| ) |  | `[static]`

Returns closest distance between two triangles.

Parameters:

  p1 | Triangle 1 corner 1
  p2 | Triangle 1 corner 2
  p3 | Triangle 1 corner 3
  q1 | Triangle 2 corner 1
  q2 | Triangle 2 corner 2
  q3 | Triangle 2 corner 3

Returns:
  Closest distance

static float VisiMath.MathTools.DistanceTwoTriangles | ( | ref Vector3 | p1,
|  | ref Vector3 | p2,
|  | ref Vector3 | p3,
|  | ref Vector3 | q1,
|  | ref Vector3 | q2,
|  | ref Vector3 | q3
| ) |  | `[static]`

Returns closest distance between two triangles.

Parameters:

  p1 | Triangle 1 corner 1
  p2 | Triangle 1 corner 2
  p3 | Triangle 1 corner 3
  q1 | Triangle 2 corner 1
  q2 | Triangle 2 corner 2
  q3 | Triangle 2 corner 3

Returns:
  Closest distance

static float VisiMath.MathTools.DistanceVectorLine | ( | ref Vector3 | l1,
|  | ref Vector3 | l2,
|  | ref Vector3 | pos
| ) |  | `[static]`

Returns distance of the position from the infinite line.

Parameters:

  l1 | One point on the line
  l2 | Second point of the line
  pos | Position vector

Returns:
  Distance

static float VisiMath.MathTools.DistanceVectorLineSegment | ( | Vector3 | l1,
|  | Vector3 | l2,
|  | Vector3 | pos
| ) |  | `[static]`

Returns distance of the position from the linesegment.

Parameters:

  l1 | First end of the line
  l2 | Second end of the line
  pos | Position vector

Returns:
  Distance

static float VisiMath.MathTools.DistanceVectorLineSegment | ( | ref Vector3 | l1,
|  | ref Vector3 | l2,
|  | ref Vector3 | pos
| ) |  | `[static]`

Returns distance of the position from the linesegment.

Parameters:

  l1 | First end of the line
  l2 | Second end of the line
  pos | Position vector

Returns:
  Distance

static float VisiMath.MathTools.DistanceVectorLineSegment | ( | ref Vector3 | l1,
|  | ref Vector3 | l2,
|  | ref Vector3 | pos,
|  | out float | r
| ) |  | `[static]`

Returns distance of the position from the linesegment.

Parameters:

  l1 | First end of the line
  l2 | Second end of the line
  pos | Position vector
  r | Will be set to parameter on the line

Returns:
  Distance

static float VisiMath.MathTools.DistanceVectorPlane | ( | ref Vector3 | point,
|  | ref Vector3 | normal,
|  | ref Vector3 | pos
| ) |  | `[static]`

Returns distance between vector and plane.

Parameters:

  point | Point on the plane
  normal | NORMALIZED Plane normal
  pos | Vector

Returns:
  Distance

static float VisiMath.MathTools.DistanceVectorPlane | ( | Vector3 | point,
|  | Vector3 | normal,
|  | Vector3 | pos
| ) |  | `[static]`

Returns distance between vector and plane.

Parameters:

  point | Point on the plane
  normal | Plane normal
  pos | Vector

Returns:
  Distance

static float VisiMath.MathTools.DistanceVectorQuad | ( | ref Vector3 | first,
|  | ref Vector3 | second,
|  | ref Vector3 | third,
|  | ref Vector3 | fourth,
|  | ref Vector3 | vec
| ) |  | `[static]`

Calculates distance of the vector from the quad.

Parameters:

  first | First corner
  second | Second corner
  third | Third corner
  fourth | Fourth corner
  vec | Position

Returns:
  Distance

static float VisiMath.MathTools.DistanceVectorQuad | ( | Vector3 | first,
|  | Vector3 | second,
|  | Vector3 | third,
|  | Vector3 | fourth,
|  | Vector3 | vec
| ) |  | `[static]`

Calculates distance of the vector from the quad.

Parameters:

  first | First corner
  second | Second corner
  third | Third corner
  fourth | Fourth corner
  vec | Position

Returns:
  Distance

static float VisiMath.MathTools.DistanceVectorRay | ( | ref Vector3 | orig,
|  | ref Vector3 | dir,
|  | ref Vector3 | pos,
|  | bool | frontOnly = `true`
| ) |  | `[static]`

Returns distance of the position from the ray.

Parameters:

  orig | Origin of the ray
  dir | Normalized direction of the ray
  pos | Position vector
  frontOnly | Check only front of the ray

Returns:
  Distance

static float VisiMath.MathTools.DistanceVectorSphere | ( | Vector3 | center,
|  | float | radius,
|  | Vector3 | pos
| ) |  | `[static]`

Calculates distance between point and sphere.

Parameters:

  center | Center of the sphere
  radius | Radius of the sphere
  pos | Vector

Returns:
  Distance

static float VisiMath.MathTools.DistanceVectorSphere | ( | ref Vector3 | center,
|  | float | radius,
|  | ref Vector3 | pos
| ) |  | `[static]`

Calculates distance between point and sphere.

Parameters:

  center | Center of the sphere
  radius | Radius of the sphere
  pos | Vector

Returns:
  Distance

static float VisiMath.MathTools.DistanceVectorTriangle | ( | ref Vector3 | first,
|  | ref Vector3 | second,
|  | ref Vector3 | third,
|  | ref Vector3 | vec
| ) |  | `[static]`

Calculates distance of the vector from the triangle.

Parameters:

  first | First corner
  second | Second corner
  third | Third corner
  vec | Position

Returns:
  Distance

static float VisiMath.MathTools.DistanceVectorTriangle | ( | Vector3 | first,
|  | Vector3 | second,
|  | Vector3 | third,
|  | Vector3 | vec
| ) |  | `[static]`

Calculates distance of the vector from the triangle.

Parameters:

  first | First corner
  second | Second corner
  third | Third corner
  vec | Position

Returns:
  Distance

static float VisiMath.MathTools.Floor | ( | float | val | ) | `[static]`

Returns largest integer less or equal to val.

Parameters:

  val | Float value

Returns:
  Floored value

static void VisiMath.MathTools.Floor | ( | ref float | val | ) | `[static]`

Floors (changes to larges integer less or equal) val.

Parameters:

  val | Float value

static float VisiMath.MathTools.FractionalPart | ( | float | val | ) | `[static]`

returns fractional part of the value

Parameters:

  val | Float value

Returns:
  Fractional part

static float VisiMath.MathTools.Gain | ( | float | a,
|  | float | b
| ) |  | `[static]`

Calculates gain.

Parameters:

  a |
  b |

Returns:

static float VisiMath.MathTools.Interp | ( | float | t,
|  | float | a,
|  | float | b
| ) |  | `[static]`

Interpolation.

Parameters:

  t | Interpolation parameter
  a | First value
  b | Second value

Returns:
  Interpolated value

static bool VisiMath.MathTools.IntersectionLinePlane | ( | ref Vector3 | orig,
|  | ref Vector3 | dir,
|  | ref Vector3 | point,
|  | ref Vector3 | normal,
|  | out float | t,
|  | out Vector3 | interspoint
| ) |  | `[static]`

Intersection of infinite line and plane.

Parameters:

  orig | Origin of line
  dir | Normalized direction of line
  point | Point on the plane
  normal | Normal of the plane
  interspoint | Will be filled with intersection point
  t | Parameter of the ray (distance from origin)

Returns:
  True, if intersection exists

static bool VisiMath.MathTools.IntersectionLineTriangle | ( | ref Vector3 | orig,
|  | ref Vector3 | dir,
|  | ref Vector3 | first,
|  | ref Vector3 | second,
|  | ref Vector3 | third,
|  | out float | distance,
|  | out Vector3 | inters
| ) |  | `[static]`

Returns intersection point of ray and triangle and distance.

Parameters:

  orig | Origin of ray
  dir | Normalized direction of line
  first | First triangle vertice
  second | Second triangle vertice
  third | Third triangle vertice
  distance | Will be set to distance
  inters | Will be set to intersection point

Returns:
  True if intersection exists

static bool VisiMath.MathTools.IntersectionRayAABox | ( | ref Vector3 | orig1,
|  | ref Vector3 | dir1,
|  | ref Vector3 | min,
|  | ref Vector3 | max,
|  | out float | distance,
|  | out Vector3 | point
| ) |  | `[static]`

Returns intersection of ray and Axis alligned box.

Parameters:

  orig1 | Origin of the ray 1
  dir1 | Normalized direction of ray 1
  min | Minimal corner of AA
  max | Maximal corner of AA
  distance | Distance to intersection
  point | Intersection point

Returns:
  True if intersection exists

static bool VisiMath.MathTools.IntersectionRayLineSegment | ( | ref Vector3 | orig,
|  | ref Vector3 | dir,
|  | ref Vector3 | l1,
|  | ref Vector3 | l2,
|  | out float | distance,
|  | out Vector3 | point
| ) |  | `[static]`

Calculates intersection of ray and line segment.

Parameters:

  orig | Origin of the ray
  dir | Normalized direction
  l1 | First point of the line
  l2 | Second point of the line
  distance | Sets to distance from the origin
  point | Sets to intersection point

Returns:
  True if intersection exists

static bool VisiMath.MathTools.IntersectionRayLineSegment | ( | Vector3 | orig,
|  | Vector3 | dir,
|  | Vector3 | l1,
|  | Vector3 | l2,
|  | out float | distance,
|  | out Vector3 | point
| ) |  | `[static]`

Calculates intersection of ray and line segment.

Parameters:

  orig | Origin of the ray
  dir | Normalized direction
  l1 | First point of the line
  l2 | Second point of the line
  distance | Sets to distance from the origin
  point | Sets to intersection point

Returns:
  True if intersection exists

static bool VisiMath.MathTools.IntersectionRayPlane | ( | ref Vector3 | orig,
|  | ref Vector3 | dir,
|  | ref Vector3 | point,
|  | ref Vector3 | normal,
|  | out float | t,
|  | out Vector3 | interspoint
| ) |  | `[static]`

Intersection of ray and plane.

Parameters:

  orig | Origin of ray
  dir | Normalized direction of ray
  point | Point on the plane
  normal | Normal of the plane
  interspoint | Will be filled with intersection point
  t | Parameter of the ray (distance from origin)

Returns:
  True, if intersection exists

static Vector3 VisiMath.MathTools.IntersectionRayPlane | ( | ref Vector3 | orig,
|  | ref Vector3 | dir,
|  | ref Vector3 | point,
|  | ref Vector3 | normal
| ) |  | `[static]`

Intersection of ray and plane.

Parameters:

  orig | Origin of ray
  dir | Normalized direction of ray
  point | Point on the plane
  normal | Normal of the plane

Returns:
  Intersection point (invalid if no intersection)

static Vector3 VisiMath.MathTools.IntersectionRayTriangle | ( | ref Vector3 | orig,
|  | ref Vector3 | dir,
|  | ref Vector3 | first,
|  | ref Vector3 | second,
|  | ref Vector3 | third,
|  | bool | frontFace = `false`
| ) |  | `[static]`

Returns intersection point of ray and triangle.

Parameters:

  orig | Origin of ray
  dir | Normalized direction of ray
  first | First triangle vertice
  second | Second triangle vertice
  third | Third triangle vertice
  frontFace | Return intersection only if triangle normal faces ray

Returns:
  Intersection point

static bool VisiMath.MathTools.IntersectionRayTriangle | ( | Vector3 | orig,
|  | Vector3 | dir,
|  | Vector3 | first,
|  | Vector3 | second,
|  | Vector3 | third,
|  | out float | distance,
|  | out Vector3 | inters,
|  | bool | frontFace = `false`
| ) |  | `[static]`

Returns intersection point of ray and triangle and distance.

Parameters:

  orig | Origin of ray
  dir | Normalized direction of ray
  first | First triangle vertice
  second | Second triangle vertice
  third | Third triangle vertice
  frontFace | Return intersection only if triangle normal faces ray
  distance | Will be set to distance
  inters | Will be set to intersection point

Returns:
  True if intersection exists

static bool VisiMath.MathTools.IntersectionRayTriangle | ( | ref Vector3 | orig,
|  | ref Vector3 | dir,
|  | ref Vector3 | first,
|  | ref Vector3 | second,
|  | ref Vector3 | third,
|  | out float | distance,
|  | out Vector3 | inters,
|  | bool | frontFace = `false`
| ) |  | `[static]`

Returns intersection point of ray and triangle and distance.

Parameters:

  orig | Origin of ray
  dir | Normalized direction of ray
  first | First triangle vertice
  second | Second triangle vertice
  third | Third triangle vertice
  frontFace | Return intersection only if triangle normal faces ray
  distance | Will be set to distance
  inters | Will be set to intersection point

Returns:
  True if intersection exists

static bool VisiMath.MathTools.IntersectionSegmentCapsule | ( | ref Vector3 | line1,
|  | ref Vector3 | line2,
|  | ref Vector3 | caps1,
|  | ref Vector3 | caps2,
|  | float | radius,
|  | out float | t
| ) |  | `[static]`

Checks for intersection between line segment and capsue.

Parameters:

  line1 | Line origin
  line2 | Line end
  caps1 | Capsule origin
  caps2 | Capsule end
  radius | Radius
  t | will be set to distance from origin

Returns:
  true if intersection exists

static bool VisiMath.MathTools.IntersectionSegmentCylinder | ( | ref Vector3 | line1,
|  | ref Vector3 | line2,
|  | ref Vector3 | caps1,
|  | ref Vector3 | caps2,
|  | float | radius,
|  | out float | t
| ) |  | `[static]`

Checks for intersection between line segment and cylinder.

Parameters:

  line1 | Line origin
  line2 | Line end
  caps1 | Cylinder origin
  caps2 | Cylinder end
  radius | Radius
  t | will be set to distance from origin

Returns:
  true if intersection exists

static bool VisiMath.MathTools.IntersectionSegmentSphere | ( | ref Vector3 | line1,
|  | ref Vector3 | line2,
|  | ref Vector3 | center,
|  | float | radius,
|  | out float | t
| ) |  | `[static]`

Checks for intersection between line segment and sphere.

Parameters:

  line1 | Line origin
  line2 | Line end
  center | Sphere center
  radius | Sphere radius
  t | will be set to distance from origin

Returns:
  true if intersection exists

static bool VisiMath.MathTools.IntersectionSphereTriangle | ( | ref Vector3 | center,
|  | float | radius,
|  | ref Vector3 | p1,
|  | ref Vector3 | p2,
|  | ref Vector3 | p3
| ) |  | `[static]`

Calculates intersection of the sphere and triangle - creates ColTriangle, it's faster to use it directly!

Parameters:

  center | Center of the sphere
  radius | Radius
  p1 | Triangle point 1
  p2 | Triangle point 2
  p3 | Triangle point 3
  normal | Triangle normal

Returns:
  True if intersection

static bool VisiMath.MathTools.IntersectionTriangleCapsule | ( | ref Vector3 | l1,
|  | ref Vector3 | l2,
|  | ref Vector3 | l3,
|  | ref Vector3 | caps1,
|  | ref Vector3 | caps2,
|  | float | radius,
|  | out float | t
| ) |  | `[static]`

Checks for intersection between triangle and capsue.

Parameters:

  l1 | Triangle 1
  l2 | Triangle 2
  l3 | Triangle 3
  caps1 | Capsule origin
  caps2 | Capsule end
  radius | Radius
  t | will be set to distance from origin

Returns:
  true if intersection exists

static bool VisiMath.MathTools.IntersectionTwoRays | ( | ref Vector3 | orig1,
|  | ref Vector3 | dir1,
|  | ref Vector3 | orig2,
|  | ref Vector3 | dir2,
|  | out float | distance,
|  | out Vector3 | point
| ) |  | `[static]`

Returns intersection of two rays if it exists.

Parameters:

  orig1 | Origin of the ray 1
  dir1 | Normalized direction of ray 1
  orig2 | Origin of the ray 2
  dir2 | Normalized direction of ray 2
  distance | Sets to distance from the origin
  point | Sets to intersection point

Returns:
  True if intersection exists

static bool VisiMath.MathTools.Intersects | ( | ref Vector3 | center,
|  | float | radius,
|  | ref Vector3 | min,
|  | float | size
| ) |  | `[static]`

Quick check if sphere and regular AA box are in contact.

Parameters:

  center | Center of the sphere
  radius | Radius of the sphere
  min | Minimal corner of the aabox
  size | Size of the box

Returns:
  True if intersection

static bool VisiMath.MathTools.Intersects | ( | ref Vector3 | center,
|  | float | radius,
|  | ref Vector3 | min,
|  | ref Vector3 | max
| ) |  | `[static]`

Quick check if sphere and AA box are in contact.

Parameters:

  center | Center of the sphere
  radius | Radius of the sphere
  min | Minimal corner
  max | Maximal corner

Returns:
  True if intersection

static float VisiMath.MathTools.InverseSqrFast | ( | float | x | ) | `[static]`

Computes fast inverse sqr.

Based on http://www.codemaestro.com/reviews/review00000105.html

Parameters:

  x | value

Returns:
  Aproximate inverse sqr of value

static bool VisiMath.MathTools.IsAlmostZero | ( | float | val | ) | `[static]`

returns true if number is almost zero (defined by Epsilon)

Parameters:

  val | Float value

Returns:
  True if almost zero

static float VisiMath.MathTools.Lerp | ( | float | t,
|  | float | a,
|  | float | b
| ) |  | `[static]`

Calculates linear interpolation from a to b.

Parameters:

  t | interpolation parameter
  a | A point
  b | B point

Returns:
  Interpolated value

static float VisiMath.MathTools.Max | ( | Vector3 | vec | ) | `[static]`

returns Maximal value inside vector3

Parameters:

  vec | Vector3

Returns:
  Max value from axes

static Vector3 VisiMath.MathTools.Max | ( | ref Vector3 | vec1,
|  | ref Vector3 | vec2
| ) |  | `[static]`

Creates maximal vector from two vectors. result has maximal values from both vectors)

Parameters:

  vec1 | First vector
  vec2 | Second vectr

Returns:
  Vector with maximal values

static float VisiMath.MathTools.Max | ( | float | val1,
|  | float | val2,
|  | float | val3
| ) |  | `[static]`

Returns bigger value.

Parameters:

  val1 | first value
  val2 | second value
  val3 | third value

Returns:
  Bigger of val1 and val2

static float VisiMath.MathTools.Max | ( | float | val1,
|  | float | val2
| ) |  | `[static]`

Returns bigger value.

Parameters:

  val1 | first value
  val2 | second value

Returns:
  Bigger of val1 and val2

static float VisiMath.MathTools.Min | ( | float | val1,
|  | float | val2
| ) |  | `[static]`

Returns smaller value.

Parameters:

  val1 | first value
  val2 | second value

Returns:
  Smaller of val1 and val2

static float VisiMath.MathTools.Min | ( | Vector3 | vec | ) | `[static]`

returns minimal value inside vector3

Parameters:

  vec | Vector3

Returns:
  Lowest value from axes

static float VisiMath.MathTools.Min | ( | float | val1,
|  | float | val2,
|  | float | val3
| ) |  | `[static]`

Returns smaller value.

Parameters:

  val1 | first value
  val2 | second value
  val3 | third value

Returns:
  Smaller of val1 and val2

static Vector3 VisiMath.MathTools.Min | ( | ref Vector3 | vec1,
|  | ref Vector3 | vec2
| ) |  | `[static]`

Creates minimal vector from two vectors. result has lowest values from both vectors)

Parameters:

  vec1 | First vector
  vec2 | Second vectr

Returns:
  Vector with lowest values

static int VisiMath.MathTools.NearestPower2 | ( | int | value | ) | `[static]`

Returns nearest higher number then parameter which is power of 2.

Parameters:

  value |

Returns:

static void VisiMath.MathTools.NearestTextureSize | ( | ref int | width,
|  | ref int | height
| ) |  | `[static]`

Changes size of the texture to nearest power of two.

Parameters:

  width | Width
  height | Height

static bool VisiMath.MathTools.PointInTriangle | ( | Vector3 | v1,
|  | Vector3 | v2,
|  | Vector3 | v3,
|  | Vector3 | p
| ) |  | `[static]`

Returns true if point is inside the triangle.

Parameters:

  v1 | First corner
  v2 | Second corner
  v3 | Third corner
  p | Point to check

Returns:
  True if point is inside the triangle

Uses barycentric technique (faster then sameside checking)

static bool VisiMath.MathTools.PointInTriangle | ( | ref Vector3 | v1,
|  | ref Vector3 | v2,
|  | ref Vector3 | v3,
|  | ref Vector3 | p
| ) |  | `[static]`

Returns true if point is inside the triangle.

Parameters:

  v1 | First corner
  v2 | Second corner
  v3 | Third corner
  p | Point to check

Returns:
  True if point is inside the triangle

Uses barycentric technique (faster then sameside checking)

static bool VisiMath.MathTools.PointOnLine | ( | ref Vector3 | l1,
|  | ref Vector3 | l2,
|  | ref Vector3 | pos
| ) |  | `[static]`

Checks if point lies on the inifinite line.

Parameters:

  l1 | Start of the line
  l2 | End of the line
  pos | Vector to check

Returns:
  True if point is on the line

static bool VisiMath.MathTools.PointOnLine | ( | ref Vector3 | l1,
|  | ref Vector3 | l2,
|  | ref Vector3 | pos,
|  | out float | t
| ) |  | `[static]`

Checks if point lies on the inifinite line and sets t to line parameter. Parameter can be used to decide if the point is in some part of the line boundry.

Parameters:

  l1 | Start of the line
  l2 | End of the line
  pos | Vector to check
  t | Line parameter (valid only if function returns true

Returns:
  True if point is on the line

static bool VisiMath.MathTools.PointOnLineSegment | ( | Vector3 | l1,
|  | Vector3 | l2,
|  | Vector3 | pos
| ) |  | `[static]`

Checks if point lies on the linesegment.

Parameters:

  l1 | Start of the line
  l2 | End of the line
  pos | Vector to check

Returns:
  True if point is on the line

static bool VisiMath.MathTools.PointOnLineSegment | ( | ref Vector3 | l1,
|  | ref Vector3 | l2,
|  | ref Vector3 | pos
| ) |  | `[static]`

Checks if point lies on the linesegment.

Parameters:

  l1 | Start of the line
  l2 | End of the line
  pos | Vector to check

Returns:
  True if point is on the line

static float VisiMath.MathTools.Pow | ( | float | a,
|  | float | b
| ) |  | `[static]`

Returns a ^ b.

Parameters:

  a |
  b |

Returns:
  a^b

static Vector3 VisiMath.MathTools.RadToDeg | ( | Vector3 | rot | ) | `[static]`

Converts rotational vector in radians to degrees.

Parameters:

  rot | Rotational vector in radians

Returns:
  Rotational vector in degrees

static void VisiMath.MathTools.RadToDeg | ( | ref Vector3 | rot | ) | `[static]`

Converts rotational vector in radians to degrees.

Parameters:

  rot | Rotational vector in radians

static float VisiMath.MathTools.RadToDeg | ( | float | radians,
|  | bool | clamp = `false`
| ) |  | `[static]`

Converts degrees to radians.

Parameters:

  radians | radians
  clamp | if true, value will be clamped

Returns:
  degrees

static float VisiMath.MathTools.Sin | ( | float | angle | ) | `[static]`

Returns float sinus.

Parameters:

  angle | angle in radians

Returns:
  sin(angle)

static float VisiMath.MathTools.Sqrt | ( | float | val | ) | `[static]`

Float square root.

Parameters:

  val | value for square root

Returns:
  SQRT(val)

static void VisiMath.MathTools.Swap | ( | ref int | val1,
|  | ref int | val2
| ) |  | `[static]`

Swaps two integer values.

Parameters:

  val1 | first value
  val2 | second value

static void VisiMath.MathTools.Swap | ( | ref float | val1,
|  | ref float | val2
| ) |  | `[static]`

Swaps two float values.

Parameters:

  val1 | first value
  val2 | second value

static float VisiMath.MathTools.TricubInterp | ( | float | tx,
|  | float | ty,
|  | float | tz,
|  | float | v0,
|  | float | v1,
|  | float | v2,
|  | float | v3,
|  | float | v4,
|  | float | v5,
|  | float | v6,
|  | float | v7
| ) |  | `[static]`

Tricubic interpolation.

Parameters:

  tx |
  ty |
  tz |
  v0 |
  v1 |
  v2 |
  v3 |
  v4 |
  v5 |
  v6 |
  v7 |

Returns:

## Member Data Documentation

float VisiMath.MathTools.DoublePi = (float)(Math.PI * 2)`[static]`

Pi * 2.

float VisiMath.MathTools.Epsilon = 0.000001f`[static]`

Epsilon value.

float VisiMath.MathTools.HalfPi = (float)Math.PI / 2`[static]`

Pi / 2.

float VisiMath.MathTools.Pi = (float)Math.PI`[static]`

Pi.

float VisiMath.MathTools.QuarterPi = (float)Math.PI / 4`[static]`

Pi / 4.

The documentation for this class was generated from the following file:

- MathTools.cs

All Classes Namespaces Files Functions Variables Enumerations Properties Events