Math

Function Abs(n)

Returns the absolute value of n.


Function Acos(n)

Returns the Arcosine of n.


Function AndBit(a, b)

Returns the bitwise AND operation of 2 numbers.


Function Asin(n)

Returns the ArcSine of a number.


Function Atan(n)

Returns the ArcTangent of a number.


Function ATan2(y, x)

Returns the ArcTangent of x and y


Function Bin$(n)

Returns the binary representation of a number.


Function CInt32(i)

Returns a 32-bit signed integer.


Function CInt64(i)

Returns a 64-bit signed integer.


Function Cos(n)

Returns the Cosine of an angle.


Function Degrees(r)

Returns angle converted from radians to degrees.


Function Exp(n)

Returns the exponential function of a number.


Function Frac(n)

Returns the decimal portion of a number.


Function Hex$(n)

Returns a hexadecimal representation of a number.


Function HexVal(n$)

Returns the integer value of a hexadecimal string.


Function Int(n)

Returns a number converted to an integer.


Function Log(n)

Returns the logarithm of a number.


Function Max(a, b)

Returns the highest of two numbers.

See also

Min()


Function Min(a, b)

Returns the lowest of two numbers.

See also

Max()


Function OrBit(a, b)

Returns the value of the bitwise OR operation on the operands A and B

See also

XOrBit(), AndBit()


Function Radians(d)

Returns an angle converted from degrees to radians


Function Randomize(n)

Seeds the random number generator


Function Rand(n)

Returns a random number between 0 and n.


Function Round(n)

Rounds n to the nearest whole number.


Function Sign(n)

Returns the sign of a number n 0 returns 1.


Function Sin(n)

Returns the sine of angle n.


Function Sqrt(n)

Returns the square root of n.


Function Tan(n)

Returns the tangent of n.


Function XOrBit(a, b)

Returns the value of the bitwise XOR operation on the operands A and B.

See also

OrBit(), AndBit()


Function GetLineIntersection(p0_x, p0_y, p1_x, p1_y, p2_x, p2_y, p3_x, p3_y, ByRef i_x, ByRef i_y)

Sets (i_x, i_y) to the intersection of lines p0-p1 and p2-p3 Returns true if there is a collision and false if not.


Function Interpolate(min_a, max_a, mid_a, min_b, max_b)

This function returns a value interpolated based on the comparison between a mid value in a range of given min and max values.


Function PointInQuad(px, py, x1, y1, x2, y2, x3, y3, x4, y4)

Returns true if the point (px, py) is in the quad (x1, y1) to (x4, y4).


Function PointInTri(px, py, x1, y1, x2, y2, x3, y3)

Returns true if the point (px, py) is in the quad (x1, y1) to (x3, y3).


Function Distance2D(x1, y1, x2, y2)

Returns the distance between 2 points in 2d space.


Function Distance3D(x1, y1, z1, x2, y2, z2)

Returns the distance between 2 points in 3d space.


Function GetCircleLineIntersection(circle_x, circle_y, radius, x1, y1, x2, y2, ByRef ix1, ByRef iy1, ByRef ix2, ByRef iy2)

Calculates the points where a circle and line intersect and stores the intersection points in (ix1, iy1) and (ix2, iy2).

NOTE: This function returns 0 if there is no intersection and 1 or 2 if there is 1 or 2 intersection points. If it only returns 1 then only (ix1, iy1) will be set.


Function GetLinePlaneIntersection(ByRef line_point, ByRef line_direction, ByRef plane_point_1, ByRef plane_point_2, ByRef plane_point_3, ByRef intersection)

This function calculates the intersection between a line and a plane in 3D space and stores the result in intersection.

Parameters:

  • line_point - An array with an (x,y,z) point representing the start of a line.
  • line_direction - An array with an (x,y,z) point representing another point on the line in the direction its moving.
  • plane_point_1 - An array with an (x,y,z) point representing a point on a plane in 3D space.
  • plane_point_2 - An array with an (x,y,z) point representing a point on a plane in 3D space.
  • plane_point_3 - An array with an (x,y,z) point representing a point on a plane in 3D space.

Returns true if intersection point is on the plane.


Function GetLineAngle(x1, y1, x2, y2)

Gets an angle between 2 points.


Function DotProduct(x1, y1, z1, x2, y2, z2)

Returns the dot product from 2 vectors.


Sub InterpolateVector(x1, y1, x2, y2, distance, ByRef ix, ByRef iy, ByRef iz)

Gets an interpolated vector a given distance along a line starting at (x1, y1, z1) and ending at (x2, y2, z2).


Sub InterpolateVector(x1, y1, z1, x2, y2, z2, distance, ByRef ix, ByRef iy, ByRef iz)

Gets a quadratic interpolated vector based on a distance between 3 vectors.


Function VectorIsBetweenPoints((x, y, z, start_x, start_y, start_z, end_x, end_y, end_z)

Returns TRUE if a vector is between 2 points.


Sub NormalizeVector((x, y, z, ByRef nx, ByRef ny, ByRef nz)

Returns a normalized vector from (x,y,z).


Sub GetHorizontalAngle((x, y, z, ByRef hx, ByRef hy, ByRef hz)

Get the rotation vector that would make a (0,0,1) direction vector point in the same direction as the given direction vector.


Sub GetRotationToTarget((x, y, z, tgt_x, tgt_y, tgt_z, ByRef rx, ByRef ry, ByRef rz)

Gets a rotation vector to a target from an origin point.