## de.grogra.vecmath Class Math2

```java.lang.Object de.grogra.vecmath.Math2
```

`public final class Math2extends java.lang.Object`

This class contains a set of mathematical functions and constants, including random and noise generators, linear algebra, and table-based trigonometric functions.

Author:
Ole Kniemeyer

Field Summary
`static float` `EPS`
The very small number epsilon. 1E-05
`static float` `EPSILON`
The very small number epsilon. 1E-09
`static float` `M_1_2PI`
The constant 1 / (2 π) as `float`.
`static float` `M_1_PI`
The constant 1 / π as `float`.
`static float` `M_2PI`
The constant 2 π as `float`.
`static float` `M_PI`
The constant π as `float`.
`static float` `M_PI_2`
The constant π / 2 as `float`.
`static int` `nbSkySegments`
Numbers of skysegments for the turtlesky
`static Vector3d[]` `turtsky`
Define the turtlesky

Method Summary
`static float` ```absthgs(Vector3d ss, Vector3d rr, Vector3d sa, Vector3d se)```

`static float` ```abstphg(Vector3d pp, Vector3d ss, Vector3d rr)```

`static float` ```abstpp(Vector3d av, Vector3d ev)```
Computated the distance between two vectors
`static float` ```abstps(Vector3d pp, Vector3d sa, Vector3d se)```
Calculates the distance between the point pp and the piece of straight line delimited by sa and se.
`static int` ```binomial(int n, int k)```

`static float` `ccos(char c)`
Returns the cosine of the argument.
`static double` ```clamp(double value, double min, double max)```

`static float` ```clamp(float value, float min, float max)```

`static int` ```clamp(int value, int min, int max)```

`static long` ```clamp(long value, long min, long max)```

`static double` ```closestConnection(Tuple3d p, Vector3d v, Tuple3d q)```

`static float` `csin(char c)`
Returns the sine of the argument.
`static void` ```cutCone(Vector3d ss, float alpha, Vector3d pp, Vector3d qq, CutConeParameter ccp)```

`static void` ```cutRay2(float a1, float a2, float r1, float r2, float u1, float u2, float v1, float v2, CutRay2Parameter crp)```

`static void` ```decomposeQR(Matrix3d r, Matrix3d q)```
Computes a QR decomposition of `r`.
`static float` ```determinate3(Vector3d a1, Vector3d a2, Vector3d a3)```

`static double` ```distance(Tuple3d p, Vector3d v, Tuple3d q)```

`static void` ```dNoise(Tuple3f out, float x, float y, float z)```
This method represents the derivative of a Perlin-style 3D noise function.
`static double` ```dot(Tuple3d a, Tuple3d b)```

`static double` ```dot(Tuple3d p, Tuple3d q, Tuple3d v)```
Computes the scalar product `(p - q) v`
`static float` ```dot(Tuple3f a, Tuple3d b)```

`static float` ```dot(Tuple3f a, Tuple3f b)```

`static void` ```dTurbulence(Tuple3f out, float x, float y, float z, int octaves, float lambda, float omega)```

`static double` `estimateScaleSquared(Matrix4d transformation)`

`static int` `factorial(int n)`

`static int` `floor(double x)`

`static float` ```fresnel(Vector3f normal, Vector3f in, float iorRatio, Vector3f reflectedOut, Vector3f transmittedOut)```
Computes reflected and transmitted directions according to Fresnel's formulas.
`static float` `gamma(float x)`

`static void` ```getBeginAndEndOfShoot(Matrix4d m, double length, Vector3d beginOfShoot, Vector3d endOfShoot)```

`static void` ```getBeginOfShoot(Matrix4d m, Vector3d beginOfShoot)```

`static void` ```getEndOfShoot(Matrix4d m, double length, Vector3d endOfShoot)```

`static void` ```getOrthogonal(Tuple3d in, Tuple3d out)```
Computes an orthogonal vector to `in`.
`static void` ```getOrthogonal(Tuple3f in, Tuple3f out)```
Computes an orthogonal vector to `in`.
`static void` ```getOrthogonalBasis(Tuple3d in, Matrix3d out, boolean orthonormal)```
Computes an orthogonal basis.
`static void` ```getOrthogonalBasis(Tuple3f in, Matrix3f out, boolean orthonormal)```
Computes an orthogonal basis.
`static double` ```intersectLineWithFrustum(double px, double py, double pz, double dx, double dy, double dz, double ax, double ay, double az, double top, double base, double tan)```
Determines the fraction of a line (p,d) which intersects a frustum.
`static double` ```intersectLineWithFrustum(Point3d point, Vector3d direction, Point3d origin, Vector3d axis, double top, double base, double tan)```

`static void` ```invertAffine(Matrix34d in, Matrix4d out)```

`static void` ```invertAffine(Matrix3d in, Matrix3d out)```

`static void` ```invertAffine(Matrix3f in, Matrix3f out)```

`static void` ```invertAffine(Matrix4d in, Matrix4d out)```

`static void` ```invertAffine(Matrix4f in, Matrix4f out)```

`static void` ```invMul(Matrix3d t, Tuple3d v)```

`static void` ```invTransformPoint(Matrix34d t, Tuple3d p)```

`static void` ```invTransformPoint(Matrix3d t, Tuple2d p)```

`static void` ```invTransformPoint(Matrix3f t, Tuple2f p)```

`static void` ```invTransformPoint(Matrix4d t, Tuple3d p)```

`static void` ```invTransformPointAndVector(Matrix4d t, Tuple3d p, Tuple3d v)```

`static void` ```invTransformVector(Matrix34d t, Tuple3d v)```

`static void` ```invTransformVector(Matrix3d t, Tuple2d v)```

`static void` ```invTransformVector(Matrix3f t, Tuple2f v)```

`static void` ```invTransformVector(Matrix4d t, Tuple3d v)```

`static boolean` ```isInsideConeT(double px, double py, double pz, double ax, double ay, double az, double tipDistance, double capDistance, double tan)```
Determines if a point p lies inside a (part of a) cone.
`static boolean` ```isInsideConeT(double px, double py, double pz, double ox, double oy, double oz, double ax, double ay, double az, double tipDistance, double capDistance, double tan)```

`static boolean` `isNullVector(Vector3d a)`
Test of all parts of the vector are null
`static boolean` ```lessThan(Tuple3d a, Tuple3d b)```

`static boolean` ```lessThanOrEqual(Tuple3d a, Tuple3d b)```

`static void` ```lmul(Matrix3d rot, Matrix34d m)```

`static void` `makeAffine(Matrix3d m)`

`static void` `makeAffine(Matrix3f m)`

`static void` `makeAffine(Matrix4d m)`

`static void` `makeAffine(Matrix4f m)`

`static void` ```max(Tuple2d max, Tuple2d t)```

`static void` ```max(Tuple2f max, Tuple2f t)```

`static void` ```max(Tuple3d max, Tuple3d t)```

`static void` ```max(Tuple3f max, Tuple3f t)```

`static void` ```min(Tuple2d min, Tuple2d t)```

`static void` ```min(Tuple2f min, Tuple2f t)```

`static void` ```min(Tuple3d min, Tuple3d t)```

`static void` ```min(Tuple3f min, Tuple3f t)```

`static void` ```mul(Tuple3d out, Tuple3d a, Tuple3d b)```

`static void` ```mul(Tuple3f out, Tuple3f a, Tuple3f b)```

`static void` ```mulAffine(Matrix3d out, Matrix3d l, Matrix3d r)```

`static void` ```mulAffine(Matrix4d out, Matrix4d l, Matrix4d r)```

`static long` `nextRandom(long seed)`
Returns the next 48-bit pseudo-random number based on the previous pseudo-random number `seed`.
`static float` ```noise(float x, float y, float z)```
This method represents a Perlin-style 3D noise function.
`static void` `normalize(Vector3d aVector)`
Normalizes this vector in place.
`static void` `normalize(Vector3f aVector)`
Normalizes this vector in place.
`static void` ```onbco(Vector3d result, Vector3d a, Vector3d ba1, Vector3d ba2, Vector3d ba3)```

`static boolean` ```parallelVector(Vector3d a1, Vector3d a2)```

`static long` ```pow(int a, int b)```

`static boolean` ```quadricIntersection(double a00, double a01, double a02, double a11, double a12, double a22, double b0, double b1, double b2, double c, Point3d p, Vector3d d, double[] lambda)```

`static char` `random(char index)`
This method represents a random permutation of `char` values.
`static int` `roundUpNextPowerOfTwo(int v)`
Calculate the next power of two greater or equal than v.
`static void` ```setAffine(Matrix4d out, Matrix4d in)```

`static void` ```setAffineTransform(java.awt.geom.AffineTransform out, Matrix3d in)```

`static void` ```setMatrix3d(Matrix3d out, java.awt.geom.AffineTransform in)```

`static double` ```shortestConnection(Tuple3d p1, Vector3d v1, Tuple3d p2, Vector3d v2, double[] lambda)```
Computes the shortest straight connection between two lines.
`static double` ```shortestConnection(Tuple3d p1, Vector3d v1, Tuple3f p2, Vector3f v2, double[] lambda)```
Computes the shortest straight connection between two lines.
`static float` ```shortestConnection(Tuple3f p1, Vector3f v1, Tuple3f p2, Vector3f v2, float[] lambda)```
Computes the shortest straight connection between two lines.
`static float` `sin(float x)`
Returns the sine of the argument.
`static float` `sin01(float x)`
Returns the sine of the argument.
`static int` `skySegment(Vector3d rv)`

`static float[]` `toFloatArray(Tuple3d p)`

`static float[]` `toFloatArray(Tuple4d p)`

`static float[]` `toFloatArray(Tuple4f p)`

`static void` ```transformPoint(Matrix3d t, Tuple2d p)```

`static void` ```transformPoint(Matrix4d t, Tuple3d p)```

`static void` ```transformPoint(Matrix4d t, Tuple3d p, Tuple3d out)```

`static void` ```transformPoint(Matrix4f t, Tuple3f p)```

`static void` ```transformTranspose(Matrix3d t, Tuple3d v)```

`static void` ```transformVector(Matrix3d t, Tuple2d v)```

`static void` ```transformVector(Matrix4d t, Tuple3d v)```

`static void` ```transformVector(Matrix4f t, Tuple3f v)```

`static float` ```turbulence(float x, float y, float z, int octaves, float lambda, float omega)```

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### EPS

`public static final float EPS`
The very small number epsilon. 1E-05

Constant Field Values

### EPSILON

`public static final float EPSILON`
The very small number epsilon. 1E-09

Constant Field Values

### M_1_2PI

`public static float M_1_2PI`
The constant 1 / (2 π) as `float`.

### M_1_PI

`public static float M_1_PI`
The constant 1 / π as `float`.

### M_2PI

`public static float M_2PI`
The constant 2 π as `float`.

### M_PI

`public static float M_PI`
The constant π as `float`.

### M_PI_2

`public static float M_PI_2`
The constant π / 2 as `float`.

### nbSkySegments

`public static int nbSkySegments`
Numbers of skysegments for the turtlesky

### turtsky

`public static final Vector3d[] turtsky`
Define the turtlesky

Method Detail

### absthgs

```public static float absthgs(Vector3d ss,
Vector3d rr,
Vector3d sa,
Vector3d se)```

### abstphg

```public static float abstphg(Vector3d pp,
Vector3d ss,
Vector3d rr)```

### abstpp

```public static float abstpp(Vector3d av,
Vector3d ev)```
Computated the distance between two vectors

Parameters:
`av` - first vector
`ev` - second vector
Returns:
distance between the two vectors

### abstps

```public static float abstps(Vector3d pp,
Vector3d sa,
Vector3d se)```
Calculates the distance between the point pp and the piece of straight line delimited by sa and se. If sa == se, the distance to this point is calculated.

Parameters:
`pp` - Point
`sa` - Begin of the straight line
`se` - End of the straight line
Returns:
Distance between the point pp and the piece of straight line

### binomial

```public static int binomial(int n,
int k)```

### ccos

`public static float ccos(char c)`
Returns the cosine of the argument. The range of `char` values is mapped to [0, 2 π), i.e., the angle in radians is 2 π `c` / 0x10000. This method uses a pre-computed table.

Parameters:
`c` - an angle
Returns:
the cosine of the angle

### clamp

```public static double clamp(double value,
double min,
double max)```

### clamp

```public static float clamp(float value,
float min,
float max)```

### clamp

```public static int clamp(int value,
int min,
int max)```

### clamp

```public static long clamp(long value,
long min,
long max)```

### closestConnection

```public static double closestConnection(Tuple3d p,
Vector3d v,
Tuple3d q)```

### csin

`public static float csin(char c)`
Returns the sine of the argument. The range of `char` values is mapped to [0, 2 π), i.e., the angle in radians is 2 π `c` / 0x10000. This method uses a pre-computed table.

Parameters:
`c` - an angle
Returns:
the sine of the angle

### cutCone

```public static void cutCone(Vector3d ss,
float alpha,
Vector3d pp,
Vector3d qq,
CutConeParameter ccp)```

### cutRay2

```public static void cutRay2(float a1,
float a2,
float r1,
float r2,
float u1,
float u2,
float v1,
float v2,
CutRay2Parameter crp)```

### decomposeQR

```public static void decomposeQR(Matrix3d r,
Matrix3d q)```
Computes a QR decomposition of `r`. The non-singular matrix `a` to be composed is the parameter `r`. This method computes `r` and `q` such that `a = q * r`, `q` is an orthogonal matrix, and `r` an upper triangular matrix. The signs of `r.m00` and `r.m11` are positive. The sign of `r.m22` is the sign of `det(a)`. As a consequence, `det(q) == 1`, so `q` is a pure rotation.

Parameters:
`r` - the input for the matrix to compose and the output for r
`q` - the output for q

### determinate3

```public static float determinate3(Vector3d a1,
Vector3d a2,
Vector3d a3)```

### distance

```public static double distance(Tuple3d p,
Vector3d v,
Tuple3d q)```

### dNoise

```public static void dNoise(Tuple3f out,
float x,
float y,
float z)```
This method represents the derivative of a Perlin-style 3D noise function. It is implemented based on POV-Ray's DNoise function.

Parameters:
`out` - the computed derivate at (x, y, z) is placed in here
`x` - x-coordinate
`y` - x-coordinate
`z` - x-coordinate

### dot

```public static double dot(Tuple3d a,
Tuple3d b)```

### dot

```public static double dot(Tuple3d p,
Tuple3d q,
Tuple3d v)```
Computes the scalar product `(p - q) v`

Parameters:
`p` - a point
`q` - point which is subtracted from `p`
`v` - a vector
Returns:
scalar product `(p - q) v`

### dot

```public static float dot(Tuple3f a,
Tuple3d b)```

### dot

```public static float dot(Tuple3f a,
Tuple3f b)```

### dTurbulence

```public static void dTurbulence(Tuple3f out,
float x,
float y,
float z,
int octaves,
float lambda,
float omega)```

### estimateScaleSquared

`public static double estimateScaleSquared(Matrix4d transformation)`

### factorial

`public static int factorial(int n)`

### floor

`public static int floor(double x)`

### fresnel

```public static float fresnel(Vector3f normal,
Vector3f in,
float iorRatio,
Vector3f reflectedOut,
Vector3f transmittedOut)```
Computes reflected and transmitted directions according to Fresnel's formulas.

Parameters:
`normal` - the normal unit vector of the surface
`in` - the negated direction unit vector of the incoming ray
`iorRatio` - the index of refraction of the surface side where the normal vector points into, divided by the index of refraction of the opposite side
`reflectedOut` - the computed unit vector of the reflection direction
`transmittedOut` - the computed unit vector of the transmission direction
Returns:
the reflection coefficient

### gamma

`public static float gamma(float x)`

### getBeginAndEndOfShoot

```public static void getBeginAndEndOfShoot(Matrix4d m,
double length,
Vector3d beginOfShoot,
Vector3d endOfShoot)```

### getBeginOfShoot

```public static void getBeginOfShoot(Matrix4d m,
Vector3d beginOfShoot)```

### getEndOfShoot

```public static void getEndOfShoot(Matrix4d m,
double length,
Vector3d endOfShoot)```

### getOrthogonal

```public static void getOrthogonal(Tuple3d in,
Tuple3d out)```
Computes an orthogonal vector to `in`. The computed vector is written to `out`, which may be the same reference as `in`.

Parameters:
`in` - an input vector
`out` - the computed orthogonal vector is placed in here

### getOrthogonal

```public static void getOrthogonal(Tuple3f in,
Tuple3f out)```
Computes an orthogonal vector to `in`. The computed vector is written to `out`, which may be the same reference as `in`.

Parameters:
`in` - an input vector
`out` - the computed orthogonal vector is placed in here

### getOrthogonalBasis

```public static void getOrthogonalBasis(Tuple3d in,
Matrix3d out,
boolean orthonormal)```
Computes an orthogonal basis. The first two columns of the computed basis `out` are unit vectors, the third column equals `in` if `orthonormal` is `false`, otherwise it equals the unit vector in the direction of `in`. Thus, `out` represents a coordinate transformation which transforms the local z-axis into the direction of `in`.

Parameters:
`in` - the direction of the local z-axis
`out` - the computed matrix
`orthonormal` - compute an orthonormal matrix?

### getOrthogonalBasis

```public static void getOrthogonalBasis(Tuple3f in,
Matrix3f out,
boolean orthonormal)```
Computes an orthogonal basis. The first two columns of the computed basis `out` are unit vectors, the third column equals `in` if `orthonormal` is `false`, otherwise it equals the unit vector in the direction of `in`. Thus, `out` represents a coordinate transformation which transforms the local z-axis into the direction of `in`.

Parameters:
`in` - the direction of the local z-axis
`out` - the computed matrix
`orthonormal` - compute an orthonormal matrix?

### intersectLineWithFrustum

```public static double intersectLineWithFrustum(double px,
double py,
double pz,
double dx,
double dy,
double dz,
double ax,
double ay,
double az,
double top,
double base,
double tan)```
Determines the fraction of a line (p,d) which intersects a frustum.

The frustum is specified by the cone from which it is obtained by cutting away the top: The cone's tip is located at the origin, its axis is given by a and points to the center of the cone's cap which is located at base * a. The half-angle of the cone is specified by its tangent. The cutting plane for obtaining the frustum is located at the position top * a.

The line is specified by its origin p and its vector d from the origin to the end.

Parameters:
`px` - x coordinate of line origin p
`py` - y coordinate of line origin p
`pz` - z coordinate of line origin p
`dx` - x coordinate of line vector d
`dy` - y coordinate of line vector d
`dz` - z coordinate of line vector d
`ax` - x coordinate of cone axis a
`ay` - y coordinate of cone axis a
`az` - z coordinate of cone axis a
`top` - relative position of frustum's top cap along axis
`base` - relative position of frustum's base cap along axis
`tan` - tangent of cone's half angle
Returns:
fraction of line which intersects the frustum

### intersectLineWithFrustum

```public static double intersectLineWithFrustum(Point3d point,
Vector3d direction,
Point3d origin,
Vector3d axis,
double top,
double base,
double tan)```

### invertAffine

```public static void invertAffine(Matrix34d in,
Matrix4d out)```

### invertAffine

```public static void invertAffine(Matrix3d in,
Matrix3d out)```

### invertAffine

```public static void invertAffine(Matrix3f in,
Matrix3f out)```

### invertAffine

```public static void invertAffine(Matrix4d in,
Matrix4d out)```

### invertAffine

```public static void invertAffine(Matrix4f in,
Matrix4f out)```

### invMul

```public static void invMul(Matrix3d t,
Tuple3d v)```

### invTransformPoint

```public static void invTransformPoint(Matrix34d t,
Tuple3d p)```

### invTransformPoint

```public static void invTransformPoint(Matrix3d t,
Tuple2d p)```

### invTransformPoint

```public static void invTransformPoint(Matrix3f t,
Tuple2f p)```

### invTransformPoint

```public static void invTransformPoint(Matrix4d t,
Tuple3d p)```

### invTransformPointAndVector

```public static void invTransformPointAndVector(Matrix4d t,
Tuple3d p,
Tuple3d v)```

### invTransformVector

```public static void invTransformVector(Matrix34d t,
Tuple3d v)```

### invTransformVector

```public static void invTransformVector(Matrix3d t,
Tuple2d v)```

### invTransformVector

```public static void invTransformVector(Matrix3f t,
Tuple2f v)```

### invTransformVector

```public static void invTransformVector(Matrix4d t,
Tuple3d v)```

### isInsideConeT

```public static boolean isInsideConeT(double px,
double py,
double pz,
double ax,
double ay,
double az,
double tipDistance,
double capDistance,
double tan)```
Determines if a point p lies inside a (part of a) cone. The cone's tip is located at the origin, its axis is given by a and points to the center of the cone's cap which is located at axis * capDistance. The small cone from the tip to axis * tipDistance is removed, i.e., this tests actually checks againts a frustum. The half-angle of the cone is specified by its tangent.

Parameters:
`px` - x coordinate of point p
`py` - y coordinate of point p
`pz` - z coordinate of point p
`ax` - x coordinate of cone axis a
`ay` - y coordinate of cone axis a
`az` - z coordinate of cone axis a
`tipDistance` - distance to the tip (in units of axis)
`capDistance` - distance of the cap (in units of axis)
`tan` - tangent of cone's half angle
Returns:
true iff p lies within or on the cone

### isInsideConeT

```public static boolean isInsideConeT(double px,
double py,
double pz,
double ox,
double oy,
double oz,
double ax,
double ay,
double az,
double tipDistance,
double capDistance,
double tan)```

### isNullVector

`public static boolean isNullVector(Vector3d a)`
Test of all parts of the vector are null

Parameters:
`a` - the vector to test
Returns:
true, if all parts of the vector are null

### lessThan

```public static boolean lessThan(Tuple3d a,
Tuple3d b)```

### lessThanOrEqual

```public static boolean lessThanOrEqual(Tuple3d a,
Tuple3d b)```

### lmul

```public static void lmul(Matrix3d rot,
Matrix34d m)```

### makeAffine

`public static void makeAffine(Matrix3d m)`

### makeAffine

`public static void makeAffine(Matrix3f m)`

### makeAffine

`public static void makeAffine(Matrix4d m)`

### makeAffine

`public static void makeAffine(Matrix4f m)`

### max

```public static void max(Tuple2d max,
Tuple2d t)```

### max

```public static void max(Tuple2f max,
Tuple2f t)```

### max

```public static void max(Tuple3d max,
Tuple3d t)```

### max

```public static void max(Tuple3f max,
Tuple3f t)```

### min

```public static void min(Tuple2d min,
Tuple2d t)```

### min

```public static void min(Tuple2f min,
Tuple2f t)```

### min

```public static void min(Tuple3d min,
Tuple3d t)```

### min

```public static void min(Tuple3f min,
Tuple3f t)```

### mul

```public static void mul(Tuple3d out,
Tuple3d a,
Tuple3d b)```

### mul

```public static void mul(Tuple3f out,
Tuple3f a,
Tuple3f b)```

### mulAffine

```public static void mulAffine(Matrix3d out,
Matrix3d l,
Matrix3d r)```

### mulAffine

```public static void mulAffine(Matrix4d out,
Matrix4d l,
Matrix4d r)```

### nextRandom

`public static long nextRandom(long seed)`
Returns the next 48-bit pseudo-random number based on the previous pseudo-random number `seed`. The sequence of numbers is the same as the sequence computed by `java.util.Random`:
``` nextRandom = (seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1);
```
However, this method should be slightly faster because it does not have to deal with multi-threading issues.

Pseudo-random `int`s of `n` bits should be obtained from the returned value by the formula `(int) (nextRandom >>> (48 - n))`.

Parameters:
`seed` - previous number of sequence
Returns:
next number of sequence

### noise

```public static float noise(float x,
float y,
float z)```
This method represents a Perlin-style 3D noise function. It is implemented based on POV-Ray's Noise function.

Parameters:
`x` - x-coordinate
`y` - x-coordinate
`z` - x-coordinate
Returns:
noise value at (x, y, z)

### normalize

`public static void normalize(Vector3d aVector)`
Normalizes this vector in place. If the length is 0, then the complett vector will be (0, 0, 0).

Parameters:
`aVector` - The normalized vector

### normalize

`public static void normalize(Vector3f aVector)`
Normalizes this vector in place. If the length is 0, then the complett vector will be (0, 0, 0).

Parameters:
`aVector` - The normalized vector

### onbco

```public static void onbco(Vector3d result,
Vector3d a,
Vector3d ba1,
Vector3d ba2,
Vector3d ba3)```

### parallelVector

```public static boolean parallelVector(Vector3d a1,
Vector3d a2)```

### pow

```public static long pow(int a,
int b)```

```public static boolean quadricIntersection(double a00,
double a01,
double a02,
double a11,
double a12,
double a22,
double b0,
double b1,
double b2,
double c,
Point3d p,
Vector3d d,
double[] lambda)```

### random

`public static char random(char index)`
This method represents a random permutation of `char` values. I.e., it is a bijective map on `char`s, the mapping being defined by a pseudo-random number generator. The mapping remains the same between different invocations of the Java Virtual Machine.

Parameters:
`index` - an index into a permutation table
Returns:
the permuted value

### roundUpNextPowerOfTwo

`public static int roundUpNextPowerOfTwo(int v)`
Calculate the next power of two greater or equal than v. (see "Bit Twiddling Hacks")

Parameters:
`v` -
Returns:

### setAffine

```public static void setAffine(Matrix4d out,
Matrix4d in)```

### setAffineTransform

```public static void setAffineTransform(java.awt.geom.AffineTransform out,
Matrix3d in)```

### setMatrix3d

```public static void setMatrix3d(Matrix3d out,
java.awt.geom.AffineTransform in)```

### shortestConnection

```public static double shortestConnection(Tuple3d p1,
Vector3d v1,
Tuple3d p2,
Vector3d v2,
double[] lambda)```
Computes the shortest straight connection between two lines. This method computes two scalars `lambda` and `lambda` such that the line from `p1 + lambda v1` to `p2 + lambda v2` is the shortest connection line between these lines.

Parameters:
`p1` - a point on the first line
`v1` - the direction of the first line
`p2` - a point on the second line
`v2` - the direction of the second line
`lambda` - the computed scalars are written into this array
Returns:
the length of the shortest connection

### shortestConnection

```public static double shortestConnection(Tuple3d p1,
Vector3d v1,
Tuple3f p2,
Vector3f v2,
double[] lambda)```
Computes the shortest straight connection between two lines. This method computes two scalars `lambda` and `lambda` such that the line from `p1 + lambda v1` to `p2 + lambda v2` is the shortest connection line between these lines.

Parameters:
`p1` - a point on the first line
`v1` - the direction of the first line
`p2` - a point on the second line
`v2` - the direction of the second line
`lambda` - the computed scalars are written into this array
Returns:
the length of the shortest connection

### shortestConnection

```public static float shortestConnection(Tuple3f p1,
Vector3f v1,
Tuple3f p2,
Vector3f v2,
float[] lambda)```
Computes the shortest straight connection between two lines. This method computes two scalars `lambda` and `lambda` such that the line from `p1 + lambda v1` to `p2 + lambda v2` is the shortest connection line between these lines.

Parameters:
`p1` - a point on the first line
`v1` - the direction of the first line
`p2` - a point on the second line
`v2` - the direction of the second line
`lambda` - the computed scalars are written into this array
Returns:
the length of the shortest connection

### sin

`public static float sin(float x)`
Returns the sine of the argument. This method uses a pre-computed table.

Parameters:
`x` - an angle, in radians
Returns:
the sine of the angle

### sin01

`public static float sin01(float x)`
Returns the sine of the argument. The range of [0, 1] for `x` is mapped to [0, 2 π], i.e., the angle in radians is 2 π `x`. This method uses a pre-computed table.

Parameters:
`x` - an angle
Returns:
the sine of the angle

### skySegment

`public static int skySegment(Vector3d rv)`

### toFloatArray

`public static float[] toFloatArray(Tuple3d p)`

### toFloatArray

`public static float[] toFloatArray(Tuple4d p)`

### toFloatArray

`public static float[] toFloatArray(Tuple4f p)`

### transformPoint

```public static void transformPoint(Matrix3d t,
Tuple2d p)```

### transformPoint

```public static void transformPoint(Matrix4d t,
Tuple3d p)```

### transformPoint

```public static void transformPoint(Matrix4d t,
Tuple3d p,
Tuple3d out)```

### transformPoint

```public static void transformPoint(Matrix4f t,
Tuple3f p)```

### transformTranspose

```public static void transformTranspose(Matrix3d t,
Tuple3d v)```

### transformVector

```public static void transformVector(Matrix3d t,
Tuple2d v)```

### transformVector

```public static void transformVector(Matrix4d t,
Tuple3d v)```

### transformVector

```public static void transformVector(Matrix4f t,
Tuple3f v)```

### turbulence

```public static float turbulence(float x,
float y,
float z,
int octaves,
float lambda,
float omega)```