## Math Pack

Posted by Jonah on July 25, 2007
Math Pack #1 provides 24 functions and number series, all in a fast DLL form. This was designed for more advanced GM users who do not want to have to make their own versions of simple math functions. There are many usefull math function for 3d games also.

Gamer3D (made by him) gave me permission to upload this to GMbase.

### » Add a Screenshot

### Functions:

Returns the X axis length of the result vector of the cross product of (x1, y1, z1) and (x2, y2, z2)

Returns **X axis length**

Returns the Y axis length of the result vector of the cross product of (x1, y1, z1) and (x2, y2, z2).

Returns **Y axis length**

Returns the Z axis length of the result vector of the cross product of (x1, y1, z1) and (x2, y2, z2)

Returns **Z axis length**

Returns the result of the dot product of (x1, y1) and (x2, y2)

Returns the result of the dot product of (x1, y1, z1) and (x2, y2, z2).

Returns the maximum of the two results of the quadratic described by ax2 + bx + c = 0.

Returns the minimum of the two results of the quadratic described by ax2 + bx + c = 0.

Returns the cotangent (1 / tangent) of x.

Returns the inverse cotangent of x.

Returns n! (all integers under x multiplied).

Returns the Greatest Common Divisor (GCD) of n1 and n2. This function rounds the numbers to integers, then works with their absolute value.

Returns the Least Common Multiple (LCM) of n1 and n2. This function rounds the numbers to integers, then works with their absolute value.

Returns the Y componet of the Golden Function for X.

Returns the nth Bernoulli number.

Returns the nth Fibonacci number.

Returns the nth Perrin number.

Returns whether the line between (x1, y1) and (x2, y2) collides with the line between (x3, y3) and (x4, y4).

Returns the X value of the collision between lines ((x1, y1), (x2, y2)) and ((x3, y3), (x4, y4)).

Returns the Y value of the collision between lines ((x1, y1), (x2, y2)) and ((x3, y3), (x4, y4)).

Returns whether the line ((x1, y1), (x2, y2)) collides with the circle at (centerx, centery) with a radius of radius.

Returns the X value of the first collision between the line ((x1, y1), (x2, y2)) and the circle at (centerx, centery) with a radius of radius.

Returns the Y value of the first collision between the line ((x1, y1), (x2, y2)) and the circle at (centerx, centery) with a radius of radius.

Returns the X value of the second collision between the line ((x1, y1), (x2, y2)) and the circle at (centerx, centery) with a radius of radius.

Returns the Y value of the second collision between the line ((x1, y1), (x2, y2)) and the circle at (centerx, centery) with a radius of radius.

### Comments:

**Guest**

So, what is the update about? :)

**Guest**

Schyler - this really deserves a 4!

**Guest**

this is a piece of shit. why doesn't this work?? it returns true even when the circle is not even near the line.

draw_circle(mouse_x,mouse_y,20,1);

draw_line(100,400,500,400);

draw_text(10,10,string(line_circle_collision_check(100,400,500,400,mouse_x,mouse_y,20)));

**Guest**

(IamCalle here)

Then you have no clue how to use it.

The extension works, I personally fixed it for Gamer3D (Jonah uploaded it here) and tested it.

I have a nice collision engine wich does not require sprites and objects thanks to this extension. It works. :P