Math Extension’s Free Functions

Scalar Math_aspectFromFov ( in Scalar fovX, in Scalar fovY )

computes the aspect ratio based on two field of view angles in radians


Boolean Math_badDivisor ( in Complex s )


Boolean Math_badDivisor ( in Complex_d s )


Boolean Math_badDivisor ( in Float32 s )

Returns true if a divisor is outside the safe range of Float32 divisor values


Boolean Math_badDivisor ( in Float64 s )

Returns true if a divisor is outside the safe range of Float64 divisor values


Color Math_clamp ( in Color val, in Scalar minval, in Scalar maxval )

Clamps a Color value by min and max


Float64 Math_clamp ( in Float64 val, in Float64 minval, in Float64 maxval )

Clamps a Float64 value by min and max


RGB Math_clamp ( in RGB val, in Scalar minval, in Scalar maxval )

Clamps a RGB value by min and max


RGBA Math_clamp ( in RGBA val, in Scalar minval, in Scalar maxval )

Clamps a RGBA value by min and max


Scalar Math_clamp ( in Scalar val, in Scalar minval, in Scalar maxval )

Clamps a scalar value by min and max


Vec2 Math_clamp ( in Vec2 val, in Scalar minval, in Scalar maxval )

Clamps a Vec2 value by min and max


Vec2_d Math_clamp ( in Vec2_d val, in Scalar minval, in Scalar maxval )

Clamps a Vec2_d value by min and max


Vec2_i Math_clamp ( in Vec2_i val, in Scalar minval, in Scalar maxval )

Clamps a Vec2_i value by min and max


Vec3 Math_clamp ( in Vec3 val, in Scalar minval, in Scalar maxval )

Clamps a Vec3 value by min and max


Vec3_d Math_clamp ( in Vec3_d val, in Scalar minval, in Scalar maxval )

Clamps a Vec3_d value by min and max


Vec3_i Math_clamp ( in Vec3_i val, in Scalar minval, in Scalar maxval )

Clamps a Vec3_i value by min and max


Vec4 Math_clamp ( in Vec4 val, in Scalar minval, in Scalar maxval )

Clamps a Vec4 value by min and max


Vec4_d Math_clamp ( in Vec4_d val, in Scalar minval, in Scalar maxval )

Clamps a Vec4_d value by min and max


Vec4_i Math_clamp ( in Vec4_i val, in Scalar minval, in Scalar maxval )

Clamps a Vec4_i value by min and max


Scalar Math_degToRad ( in Scalar val )

Converts degrees to radians


Scalar Math_fovXtoY ( in Scalar fovX, in Scalar aspect )

computes the vertical field of view angle in radians given a horizontal field of view in radians and an aspect


Scalar Math_fovYtoX ( in Scalar fovY, in Scalar aspect )

computes the horizontal field of view angle in radians given a vertical field of view in radians and an aspect


Float32 Math_lawOfCosine ( in Float32 a, in Float32 b, in Float32 c )

Returns the law of cosine result


Float64 Math_linearInterpolate ( in Float64 val1, in Float64 val2, in Float64 t )

Linearly interpolates a Float64 value with another based on a blend (0.0 to 1.0)


Scalar Math_linearInterpolate ( in Scalar val1, in Scalar val2, in Scalar t )

Linearly interpolates a scalar value with another based on a blend (0.0 to 1.0)


Color Math_max ( in Color val1, in Color val2 )

Returns the minimum of two Color values


Float64 Math_max ( in Float64 val1, in Float64 val2 )

Returns the maximum of two Float64 values


RGB Math_max ( in RGB val1, in RGB val2 )

Returns the minimum of two RGB values


RGBA Math_max ( in RGBA val1, in RGBA val2 )

Returns the minimum of two RGBA values


Scalar Math_max ( in Scalar val1, in Scalar val2 )

Returns the maximum of two scalar values


Vec2 Math_max ( in Vec2 val1, in Vec2 val2 )

Returns the minimum of two Vec2 values


Vec2_d Math_max ( in Vec2_d val1, in Vec2_d val2 )

Returns the minimum of two Vec2_d values


Vec2_i Math_max ( in Vec2_i val1, in Vec2_i val2 )

Returns the minimum of two Vec2_i values


Vec3 Math_max ( in Vec3 val1, in Vec3 val2 )

Returns the minimum of two Vec3 values


Vec3_d Math_max ( in Vec3_d val1, in Vec3_d val2 )

Returns the minimum of two Vec3_d values


Vec3_i Math_max ( in Vec3_i val1, in Vec3_i val2 )

Returns the minimum of two Vec3_i values


Vec4 Math_max ( in Vec4 val1, in Vec4 val2 )

Returns the minimum of two Vec4 values


Vec4_d Math_max ( in Vec4_d val1, in Vec4_d val2 )

Returns the minimum of two Vec4_d values


Vec4_i Math_max ( in Vec4_i val1, in Vec4_i val2 )

Returns the minimum of two Vec4_i values


Color Math_min ( in Color val1, in Color val2 )

Returns the minimum of two Color values


Float64 Math_min ( in Float64 val1, in Float64 val2 )

Returns the minimum of two Float64 values


RGB Math_min ( in RGB val1, in RGB val2 )

Returns the minimum of two RGB values


RGBA Math_min ( in RGBA val1, in RGBA val2 )

Returns the minimum of two RGBA values


Scalar Math_min ( in Scalar val1, in Scalar val2 )

Returns the minimum of two scalar values


Vec2 Math_min ( in Vec2 val1, in Vec2 val2 )

Returns the minimum of two Vec2 values


Vec2_d Math_min ( in Vec2_d val1, in Vec2_d val2 )

Returns the minimum of two Vec2_d values


Vec2_i Math_min ( in Vec2_i val1, in Vec2_i val2 )

Returns the minimum of two Vec2_i values


Vec3 Math_min ( in Vec3 val1, in Vec3 val2 )

Returns the minimum of two Vec3 values


Vec3_d Math_min ( in Vec3_d val1, in Vec3_d val2 )

Returns the minimum of two Vec3_d values


Vec3_i Math_min ( in Vec3_i val1, in Vec3_i val2 )

Returns the minimum of two Vec3_i values


Vec4 Math_min ( in Vec4 val1, in Vec4 val2 )

Returns the minimum of two Vec4 values


Vec4_d Math_min ( in Vec4_d val1, in Vec4_d val2 )

Returns the minimum of two Vec4_d values


Vec4_i Math_min ( in Vec4_i val1, in Vec4_i val2 )

Returns the minimum of two Vec4_i values


Scalar Math_radToDeg ( in Scalar val )

Converts radians to degrees


Math_reportBadDivisor ( in Complex s, in String contextDesc )


Math_reportBadDivisor ( in Complex_d s, in String contextDesc )


Math_reportBadDivisor ( in Float32 s, in String contextDesc )

Reports a Float32 bad divisor warning message


Math_reportBadDivisor ( in Float64 s, in String contextDesc )

Reports a Float64 bad divisor warning message


Math_reportWarning ( in String desc )

Reports a mathematical warning and a call stack for the warning.


Scalar abs ( in Complex z )

Return the absolute value of this complex number


Float64 abs ( in Complex_d z )

Return the absolute value of this complex number


Float64 cbrt ( in Float64 v )

Returns the cube root of the given value.


Vec2 checkLineIntersection ( in Vec2 p0, in Vec2 p1, in Vec2 p2, in Vec2 p3 )

Returns the intersection point of two lines formed by p0 and p1 as well as p2 and p3. Returns :ref:`Vec2 <vec2>`(SCALAR_INFINITE) if there is no intersection.


Vec2_d checkLineIntersection ( in Vec2_d p0, in Vec2_d p1, in Vec2_d p2, in Vec2_d p3 )

Returns the intersection point of two lines formed by p0 and p1 as well as p2 and p3. Returns :ref:`Vec2_d <vec2_d>`(SCALAR_INFINITE) if there is no intersection.


Vec2_i checkLineIntersection ( in Vec2_i p0, in Vec2_i p1, in Vec2_i p2, in Vec2_i p3 )

Returns the intersection point of two lines formed by p0 and p1 as well as p2 and p3. Returns :ref:`Vec2_i <vec2_i>`(SCALAR_INFINITE) if there is no intersection.


Vec2 checkSegmentIntersection ( in Vec2 p0, in Vec2 p1, in Vec2 p2, in Vec2 p3 )

Returns the intersection point of two segments formed by p0 and p1 as well as p2 and p3. Returns :ref:`Vec2 <vec2>`(SCALAR_INFINITE) if there is no intersection.


Vec2_d checkSegmentIntersection ( in Vec2_d p0, in Vec2_d p1, in Vec2_d p2, in Vec2_d p3 )

Returns the intersection point of two segments formed by p0 and p1 as well as p2 and p3. Returns :ref:`Vec2_d <vec2_d>`(SCALAR_INFINITE) if there is no intersection.


Vec2_i checkSegmentIntersection ( in Vec2_i p0, in Vec2_i p1, in Vec2_i p2, in Vec2_i p3 )

Returns the intersection point of two segments formed by p0 and p1 as well as p2 and p3. Returns :ref:`Vec2_i <vec2_i>`(SCALAR_INFINITE) if there is no intersection.


Boolean checkTriangleOverlap ( in Vec2 a0, in Vec2 a1, in Vec2 a2, in Vec2 b0, in Vec2 b1, in Vec2 b2, in Scalar tolerance )

returns true if two triangles formed by a0, a1, a2 and b0, b1, b2 overlap given a tolerance distance.


Scalar closestPointToLineRatio ( in Vec3 P, in Vec3 lineP0, in Vec3 lineP1 )

Returns the line ratio for the closest line location from point P


Float64 closestPointToLineRatio ( in Vec3_d P, in Vec3_d lineP0, in Vec3_d lineP1 )

Returns the line ratio for the closest line location from point P


SInt32 closestPointToLineRatio ( in Vec3_i P, in Vec3_i lineP0, in Vec3_i lineP1 )

Returns the line ratio for the closest line location from point P


Vec3 closestSegmentPoint ( in Vec3 P, in Vec3 segmentP0, in Vec3 segmentP1, out Scalar ratio )

Returns the closest point this position to a line segment defined by the start and end points


Vec3_d closestSegmentPoint ( in Vec3_d P, in Vec3_d segmentP0, in Vec3_d segmentP1, out Float64 ratio )

Returns the closest point this position to a line segment defined by the start and end points


Vec3_i closestSegmentPoint ( in Vec3_i P, in Vec3_i segmentP0, in Vec3_i segmentP1, out SInt32 ratio )

Returns the closest point this position to a line segment defined by the start and end points


Float32 cosh ( in Float32 x )

the hyperbolic of cos for Float32


Float64 cosh ( in Float64 x )

the hyperbolic of cos for Float64


Float32 coth ( in Float32 x )

the hyperbolic of cotangent for Float32


Float64 coth ( in Float64 x )

the hyperbolic of cotangent for Float64


Float32 csch ( in Float32 x )

the hyperbolic secant for Float32


Float64 csch ( in Float64 x )

the hyperbolic secant for Float64


Scalar distFromPointToLine ( in Vec3 P, in Vec3 lineP0, in Vec3 lineP1 )

Returns the distance of this vector to a line defined by two points on the line


Float64 distFromPointToLine ( in Vec3_d P, in Vec3_d lineP0, in Vec3_d lineP1 )

Returns the distance of this vector to a line defined by two points on the line


SInt32 distFromPointToLine ( in Vec3_i P, in Vec3_i lineP0, in Vec3_i lineP1 )

Returns the distance of this vector to a line defined by two points on the line


Scalar distFromPointToSegment ( in Vec3 P, in Vec3 segmentP0, in Vec3 segmentP1 )

Returns the distance of this position to a line segment defined by the start and end points


Float64 distFromPointToSegment ( in Vec3_d P, in Vec3_d segmentP0, in Vec3_d segmentP1 )

Returns the distance of this position to a line segment defined by the start and end points


SInt32 distFromPointToSegment ( in Vec3_i P, in Vec3_i segmentP0, in Vec3_i segmentP1 )

Returns the distance of this position to a line segment defined by the start and end points


Scalar distanceFromLineToLine ( in Vec2 l1_p0, in Vec2 l1_p1, in Vec2 l2_p0, in Vec2 l2_p1, out Scalar l1_t, out Scalar l2_t )

dist3D_Line_to_Line(): Input: two 3D lines L1 and L2 Return: the shortest distance between L1 and L2


Float64 distanceFromLineToLine ( in Vec2_d l1_p0, in Vec2_d l1_p1, in Vec2_d l2_p0, in Vec2_d l2_p1, out Float64 l1_t, out Float64 l2_t )

dist3D_Line_to_Line(): Input: two 3D lines L1 and L2 Return: the shortest distance between L1 and L2


SInt32 distanceFromLineToLine ( in Vec2_i l1_p0, in Vec2_i l1_p1, in Vec2_i l2_p0, in Vec2_i l2_p1, out SInt32 l1_t, out SInt32 l2_t )

dist3D_Line_to_Line(): Input: two 3D lines L1 and L2 Return: the shortest distance between L1 and L2


Scalar distanceFromLineToLine ( in Vec3 l1_p0, in Vec3 l1_p1, in Vec3 l2_p0, in Vec3 l2_p1, out Scalar l1_t, out Scalar l2_t )

dist3D_Line_to_Line(): Input: two 3D lines L1 and L2 Return: the shortest distance between L1 and L2


Float64 distanceFromLineToLine ( in Vec3_d l1_p0, in Vec3_d l1_p1, in Vec3_d l2_p0, in Vec3_d l2_p1, out Float64 l1_t, out Float64 l2_t )

dist3D_Line_to_Line(): Input: two 3D lines L1 and L2 Return: the shortest distance between L1 and L2


SInt32 distanceFromLineToLine ( in Vec3_i l1_p0, in Vec3_i l1_p1, in Vec3_i l2_p0, in Vec3_i l2_p1, out SInt32 l1_t, out SInt32 l2_t )

dist3D_Line_to_Line(): Input: two 3D lines L1 and L2 Return: the shortest distance between L1 and L2


Integer findCubicRoots ( in Float64 coeff[4], out Float64 roots[3] )

Finds the roots of a cubic equation equation. Solves: coeff[3] * x^3 + coeff[2] * x^2 + coeff[1] * x + coeff[0] = 0 returns: 3 - 3 real roots 1 - 1 real root (2 complex conjugate)

coeff The 4 coeffients to the cubic equation.
re The roots of the cubic equation


Integer findQuadraticRoots ( in Float64 coeff[3], out Float64 re[2] )

Finds the roots of a quadratic equation. return(2): 2 real roots return(1): 1 real, Scalar root return(0): 2 complex roots

注釈

The imaginary component may be NULL if not desired.

coeff The 3 coeffients to the quadratic equation.
re The roots of the quadratic equation


Float32 fract ( in Float32 val )

Returns the fractional component of the Float32 value.


Float64 fract ( in Float64 val )

Returns the fractional component of the Float64 value.


Vec2[] getConvexHull ( in Vec2 points[] )

Returns the counter clockwise convex hull for an array of Vec2 This uses the Graham Scan algorithm


getMinimumBoundingRectangle ( in Vec2 points[], out Vec2 center, out Vec2 dimensions, out Scalar rotation )

Returns the smallest surrounding rectangle as the center of the rectangle, it’s dimensions and a rotation angle.


Boolean isZero ( in Float64 x )

Returns true if the provided Scalar value zero is within the Float32 precision range.


Color mathRandomColor ( in Size seed, in Size index, in Float32 min, in Float32 max )


Float32 mathRandomFloat32 ( in Size seed, in Size index )

Generate an element of a sequence of uniformly-distributed random Float32s in the interval [0, 1)

注釈

Each sequence is periodic with period length of 536,870,912. However, sequence seed + 1 overlaps with sequence seed after 1,048,576 elements, so take care using different sequences.

seed The sequence number
index The index within the sequence
/*
** Example: mathRandomFloat32
*/

require Math;
  
operator entry() {

  // generate 10 random Float32s from sequence 18
  Float32 values[10];
  for (Index i = 0; i < 10; ++i)
    values[i] = mathRandomFloat32(18, i);
  report(values);
  
}

/*
** Output:

[+0.183593,+0.043108,+0.965611,+0.885396,+0.503129,+0.618249,+0.895992,+0.403536,+0.911989,+0.762784]

*/


Float32 mathRandomFloat32 ( in Size seed, in Size index, in Float32 min, in Float32 max )


Float32[] mathRandomFloat32Array ( in UInt32 count, in Size seed, in Size seedShift, in Size indexShift, in Scalar min, in Scalar max )


Float32[] mathRandomFloat32ArrayById ( in Size seed[], in Size id[], in Scalar min, in Scalar max )


Float64 mathRandomFloat64 ( in Size seed, in Size index )

Generate an element of a sequence of uniformly-distributed random Float64s in the interval [0, 1)

注釈

Each sequence is periodic with period length of 536,870,912. However, sequence seed + 1 overlaps with sequence seed after 1,048,576 elements, so take care using different sequences.

seed The sequence number
index The index within the sequence
/*
** Example: mathRandomFloat64
*/

require Math;
  
operator entry() {

  // generate 10 random Float64s from sequence 18
  Float64 values[10];
  for (Index i = 0; i < 10; ++i)
    values[i] = mathRandomFloat64(18, i);
  report(values);
  
}

/*
** Output:

[+1.8359375e-1,+4.310880787670612e-2,+0.965611558407545,+0.885396970435977,+0.503128997981548,+0.618249962106347,+0.895992670208215,+4.03536593541503e-1,+0.911989316344261,+0.76278487034142]

*/


Float64 mathRandomFloat64 ( in Size seed, in Size index, in Float64 min, in Float64 max )


Float64[] mathRandomFloat64Array ( in UInt32 count, in Size seed, in Size seedShift, in Size indexShift, in Scalar min, in Scalar max )


Integer mathRandomInteger ( in Size seed, in Size index )

Generate an element of a sequence of uniformly-distributed random Integers between 0 and 2^29-1 (inclusive)

注釈

Each sequence is periodic with period length of 536,870,912. However, sequence seed + 1 overlaps with sequence seed after 1,048,576 elements, so take care using different sequences.

seed The sequence number
index The index within the sequence
/*
** Example: mathRandomInteger
*/

require Math;
  
operator entry() {

      // generate 10 random Integers from sequence 18
      Integer values[10];
      for (Index i = 0; i < 10; ++i)
        values[i] = mathRandomInteger(18, i);
      report(values);
  
}

/*
** Output:

[98566144,23143865,518408758,475343879,270115324,331920421,481032402,216647059,489620536,409517009]

*/


Integer[] mathRandomIntegerArray ( in UInt32 count, in Size seed, in Size seedShift, in Size indexShift )


Mat33 mathRandomMat33 ( in Size seed, in Size index, in Float32 min, in Float32 max )


Mat33_d mathRandomMat33_d ( in Size seed, in Size index, in Float32 min, in Float32 max )


Mat33_i mathRandomMat33_i ( in Size seed, in Size index, in Float32 min, in Float32 max )


Mat44 mathRandomMat44 ( in Size seed, in Size index, in Float32 min, in Float32 max )


Quat mathRandomQuat ( in Size seed, in Size index, in Float32 min, in Float32 max )


Quat_d mathRandomQuat_d ( in Size seed, in Size index, in Float32 min, in Float32 max )


Quat_i mathRandomQuat_i ( in Size seed, in Size index, in Float32 min, in Float32 max )


RGB mathRandomRGB ( in Size seed, in Size index, in Float32 min, in Float32 max )


RGBA mathRandomRGBA ( in Size seed, in Size index, in Float32 min, in Float32 max )


SInt32 mathRandomSInt32 ( in Size seed, in Size index, in SInt32 min, in SInt32 max )


Scalar mathRandomScalar ( in Size seed, in Size index )

An alias for mathRandomFloat32


Scalar mathRandomScalar ( in Size seed, in Size index, in Scalar min, in Scalar max )


Scalar[] mathRandomScalarArray ( in UInt32 count, in Size seed, in Size seedShift, in Size indexShift, in Scalar min, in Scalar max )


UInt32 mathRandomUInt32 ( in Size seed, in Size index, in UInt32 min, in UInt32 max )


Vec2 mathRandomVec2 ( in Size seed, in Size index, in Float32 min, in Float32 max )


Vec2_d mathRandomVec2_d ( in Size seed, in Size index, in Float32 min, in Float32 max )


Vec2_i mathRandomVec2_i ( in Size seed, in Size index, in Float32 min, in Float32 max )


Vec3 mathRandomVec3 ( in Size seed, in Size index, in Float32 min, in Float32 max )


Vec3_d mathRandomVec3_d ( in Size seed, in Size index, in Float32 min, in Float32 max )


Vec3_i mathRandomVec3_i ( in Size seed, in Size index, in Float32 min, in Float32 max )


Vec4 mathRandomVec4 ( in Size seed, in Size index, in Float32 min, in Float32 max )


Vec4_d mathRandomVec4_d ( in Size seed, in Size index, in Float32 min, in Float32 max )


Vec4_i mathRandomVec4_i ( in Size seed, in Size index, in Float32 min, in Float32 max )


Float32 perlinNoise ( in Float32 ix, in Float32 iy, in Float32 iz )

Three-dimensional perlin noise function.


Float32 perlinTurbulenceFloat32 ( in Vec3 pos, in Float32 time, in Vec3 c, in Vec3 a, in Vec3 tf, in Vec3 sf )


Vec3 perlinTurbulenceVec3 ( in Vec3 pos, in Float32 time, in Vec3 c, in Vec3 a, in Vec3 tf, in Vec3 sf )


Color randomColor ( in UInt32 seed, in UInt32 offset )

Generates a random color based on a seed and offset

seed The seed to base the random number geration on.
offset The offset to use in the random number sequence.


Color randomColor ( in UInt32 seed, in UInt32 offset, in Scalar gammaAdjustment )

Generates a random color based on a seed and offset with gamma adjustment.

/*
** Example: Construct Color
*/

UInt32 seed = 8765;
UInt32 offset = 0;
// Generate a regular random color
Color color = randomColor(seed, ++offset);

// Generate a light random color
Color color = randomColor(seed, ++offset, 0.5);

// Generate a dark random color
Color color = randomColor(seed, ++offset, -0.5);
seed The seed to base the random number geration on.
offset The offset to use in the random number sequence.
gammaAdjustment A gamma adjustment to offset the range of the generated color.


Float32 sech ( in Float32 x )

the hyperbolic secant for Float32


Float64 sech ( in Float64 x )

the hyperbolic secant for Float64


Float64 signum ( in Float64 x )


Scalar signum ( in Scalar x )


Float32 sinh ( in Float32 x )

the hyperbolic of sin for Float32


Float64 sinh ( in Float64 x )

the hyperbolic of sin for Float64


Complex sqrt ( in Complex z )

Return the square root of a complex number


Complex_d sqrt ( in Complex_d z )

Return the square root of a complex number


Float32 tanh ( in Float32 x )

the hyperbolic of tangent for Float32


Float64 tanh ( in Float64 x )

the hyperbolic of tangent for Float64


Boolean testCoplanarity ( in Vec3 x1, in Vec3 x2, in Vec3 x3, in Vec3 x4, in Vec3 v1, in Vec3 v2, in Vec3 v3, in Vec3 v4, out Scalar outFraction )

Coplanarity test for 4 moving points. These moving points could either be a point and a triangle, or 2 edges. The returned fraction tells us if they will be coplanar within the next time step. This algorithm is used to compute continuous collision between points and triangle, or between moving lines. Algorithm based on the following paper. http://wscg.zcu.cz/wscg2007/Papers_2007/journal/D11-full.pdf

x1 The first points position
x2 The second points position
x3 The third points position
x4 The fourth points position
v1 The first points displacement over a the given time step
v2 The second points displacement over a the given time step
v3 The third points displacement over a the given time step
v4 The fourth points displacement over a the given time step
outFraction The return value containing the fraction of the timestep where all 4 points became coplanar.


Boolean testCoplanarity ( in Vec3_d x1, in Vec3_d x2, in Vec3_d x3, in Vec3_d x4, in Vec3_d v1, in Vec3_d v2, in Vec3_d v3, in Vec3_d v4, out Float64 outFraction )

Coplanarity test for 4 moving points. These moving points could either be a point and a triangle, or 2 edges. The returned fraction tells us if they will be coplanar within the next time step. This algorithm is used to compute continuous collision between points and triangle, or between moving lines. Algorithm based on the following paper. http://wscg.zcu.cz/wscg2007/Papers_2007/journal/D11-full.pdf

x1 The first points position
x2 The second points position
x3 The third points position
x4 The fourth points position
v1 The first points displacement over a the given time step
v2 The second points displacement over a the given time step
v3 The third points displacement over a the given time step
v4 The fourth points displacement over a the given time step
outFraction The return value containing the fraction of the timestep where all 4 points became coplanar.


Boolean testCoplanarity ( in Vec3_i x1, in Vec3_i x2, in Vec3_i x3, in Vec3_i x4, in Vec3_i v1, in Vec3_i v2, in Vec3_i v3, in Vec3_i v4, out SInt32 outFraction )

Coplanarity test for 4 moving points. These moving points could either be a point and a triangle, or 2 edges. The returned fraction tells us if they will be coplanar within the next time step. This algorithm is used to compute continuous collision between points and triangle, or between moving lines. Algorithm based on the following paper. http://wscg.zcu.cz/wscg2007/Papers_2007/journal/D11-full.pdf

x1 The first points position
x2 The second points position
x3 The third points position
x4 The fourth points position
v1 The first points displacement over a the given time step
v2 The second points displacement over a the given time step
v3 The third points displacement over a the given time step
v4 The fourth points displacement over a the given time step
outFraction The return value containing the fraction of the timestep where all 4 points became coplanar.


twoPlaneIntersection ( in Vec3 plane1Point, in Vec3 plane1Normal, in Vec3 plane2Point, in Vec3 plane2Normal, io Vec3 linePoint, io Vec3 lineVector )

Computes the intersection point of two planes. The planes are each defined as a point and a normal. Returns the intersection point. linePoint will be set to plane1Point.

注釈

If lineVector is :ref:`Vec3 <vec3>`() it means that the planes are either intersecting nowhere or everywhere. In this case

plane1Point The first plane’s position
plane1Normal The first plane’s normal (must be a unit in length)
plane2Point The second plane’s position
plane2Normal The second plane’s normal (must be a unit in length)
linePoint The intersection point of the 2 planes.
lineVector The intersection vector of the 2 planes.