Not logged in

Game Maker Extensions Menu:

• Currently 4.75/5 Stars.
• 1
• 2
• 3
• 4
• 5
av. 10/10 | Who rated

Credit to Gamer3D

Tags:

Get a refer button for this extension!

BBcode

html [example] 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.

Functions:

cross_product_x(x1, y1, z1, x2, y2, z2)

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

cross_product_y(x1, y1, z1, x2, y2, z2)

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

cross_product_z(x1, y1, z1, x2, y2, z2)

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

dot_2d(x1, y1, x2, y2)

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

dot_3d(x1, y1, z1, x2, y2, z2)

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.

cotan(x)

Returns the cotangent (1 / tangent) of x.

arccot(x)

Returns the inverse cotangent of x.

factorial(n)

Returns n! (all integers under x multiplied).

gcd(n1, n2)

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

lcm(n1, n2)

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

gold(x)

Returns the Y componet of the Golden Function for X.

bernoulli(n)

Returns the nth Bernoulli number.

fibonacci(n)

Returns the nth Fibonacci number.

perrin(n)

Returns the nth Perrin number.

line_line_collision_check(x1, y1, x2, y2, x3, y3, x4, y4)

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

line_line_collision_x(x1, y1, x2, y2, x3, y3, x4, y4)

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

line_line_collision_y(x1, y1, x2, y2, x3, y3, x4, y4)

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

line_circle_collision_check(x1, y1, x2, y2, centerx, centery, radius)

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

line_circle_collision_x1(x1, y1, x2, y2, centerx, centery, 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.

line_circle_collision_y1(x1, y1, x2, y2, centerx, centery, 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.

line_circle_collision_x2(x1, y1, x2, y2, centerx, centery, 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.

line_circle_collision_y2(x1, y1, x2, y2, centerx, centery, 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.

You not logged on! It is recommended you logon before commenting so we can tell who you are!

10:44am, 26 Jul 2007
Guest

So, what is the update about? :)

11:36pm, 31 Jul 2007
Guest

Schyler - this really deserves a 4!

9:15pm, 1 Aug 2007
Jonah

If you think so, rate it!

7:04pm, 1 Nov 2007
Schyler

Ok. Im logged in now: rated 4!

4:47pm, 21 Jan 2008
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)));

12:08pm, 3 Feb 2008
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

4:53am, 24 Aug 2010
hakkan

güzel