# Math Pack #1

17 replies to this topic

### #1 Gamer3D

Gamer3D

Human* me = this;

• GMC Member
• 1819 posts
• Version:GM:Studio

Posted 24 April 2007 - 10:50 PM

-=The extension has now been fixed. Thank-you for testing (and finding a way to fix) the extension, IamCalle=-

Description:
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.

List of 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).

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).

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).

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).

quadratic_max(a, b, c) - Returns the maximum of the two results of the quadratic described by ax2 + bx + c = 0.

quadratic_min(a, b, c) - 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.

Edited by Gamer3D, 26 June 2007 - 04:14 PM.

• 0
Fast Priority Queues - Game Maker's priority queues are O(n). Mine do everything that Game Maker's do, but in O(log n) time.
Dual-Quaternion Skinning - Modifying vertexes in GM is slow. This simple vertex shader does the job both quickly and well.

### #2 Blastoiseiii

Blastoiseiii

GMC Member

• GMC Member
• 322 posts

Posted 25 April 2007 - 08:57 PM

Could you post a list of the functions, possibly with some explainations? I'm currently away from my computer, and I'm interested in this. Thanks!
• 0

### #3 Jax

Jax

GMC Member

• New Member
• 232 posts

Posted 27 April 2007 - 03:57 PM

Wow thats a big help on my math homework thanks! 9/10 man!

@Bastoiseiii
It says on the help in the extension
(d-load it and install it then click help)
• 0

### #4 Yourself

Yourself

The Ultimate Pronoun

• GMC Elder
• 7352 posts
• Version:Unknown

Posted 27 April 2007 - 05:06 PM

I think that he doesn't want to download it without knowing what it is. I wouldn't either. The description here isn't detailed enough to warrant downloading it.
• 0

### #5 elidzer

elidzer

GMC Member

• GMC Member
• 114 posts
• Version:GM:Studio

Posted 01 May 2007 - 02:54 PM

Some functions can be added, but it's useful and great idea!
• 0

GMC Member

• New Member
• 290 posts

Posted 01 May 2007 - 03:36 PM

cant u make like the line_line_collision_check but instead of x3 and y3 it will be object
• 0

### #7 Gamer3D

Gamer3D

Human* me = this;

• GMC Member
• 1819 posts
• Version:GM:Studio

Posted 01 May 2007 - 07:29 PM

Could you post a list of the functions, possibly with some explainations? I'm currently away from my computer, and I'm interested in this. Thanks!

<{POST_SNAPBACK}>

Done.

Some functions can be added, but it's useful and great idea!

<{POST_SNAPBACK}>

I'm open to suggestions.

cant u make like the line_line_collision_check but instead of x3 and y3 it will be object

<{POST_SNAPBACK}>

No, I can't. To do that, I would first have to hack GM, which I do not want to do.
• 0
Fast Priority Queues - Game Maker's priority queues are O(n). Mine do everything that Game Maker's do, but in O(log n) time.
Dual-Quaternion Skinning - Modifying vertexes in GM is slow. This simple vertex shader does the job both quickly and well.

### #8 The Pizza Boy

The Pizza Boy

GMC Member

• GMC Member
• 61 posts

Posted 02 May 2007 - 10:12 PM

Love the line collisions!
• 0

### #9 Chaos In a Can

Chaos In a Can

GMC Member

• New Member
• 70 posts

Posted 04 May 2007 - 12:17 AM

cant u make like the line_line_collision_check but instead of x3 and y3 it will be object

<{POST_SNAPBACK}>

You mean like this?
`collision_line(x1,y1,x2,y2,obj,prec,notme)`
GM already has a function to determine whether a line collides with an object.

If you wanted to check a collision between a line and the line from an object to a point, (which is what changing x3 and y3 to an object id would probably do) you could just do this:
`line_line_collision_check(x1, y1, x2, y2, object.x, object.y, x4, y4)`

• 0

### #10 desolatorXT

desolatorXT

GMC Member

• GMC Member
• 355 posts
• Version:GM:Studio

Posted 11 May 2007 - 01:51 PM

Very nice , but there is a problem..

I installed the extension, and everything works fine... But when i try to play the game, while "saving executeable" it says "cannot find the used extension"

Despite this the functions of the extenxsion work fine...

But will they work on another computer???
• 0

- Random Retro Space Shooter: http://gmc.yoyogames...howtopic=605687

- Nameless TDS game: http://gmc.yoyogames...howtopic=453982 (Project is on hold)

### #11 Gamer3D

Gamer3D

Human* me = this;

• GMC Member
• 1819 posts
• Version:GM:Studio

Posted 11 May 2007 - 04:22 PM

Very nice  , but there is a problem..

I installed the extension, and everything works fine... But when i try to play the game, while "saving executeable" it says "cannot find the used extension"

Despite this the functions of the extenxsion work fine...

But will they work on another computer???

I do not know why the problem occurs. I also do not have registered GM7, so I can't test the extension...
• 0
Fast Priority Queues - Game Maker's priority queues are O(n). Mine do everything that Game Maker's do, but in O(log n) time.
Dual-Quaternion Skinning - Modifying vertexes in GM is slow. This simple vertex shader does the job both quickly and well.

### #12 danshow555

danshow555

GMC Member

• New Member
• 30 posts

Posted 19 May 2007 - 10:36 AM

Very nice , but there is a problem..

I installed the extension, and everything works fine... But when i try to play the game, while "saving executeable" it says "cannot find the used extension"

Despite this the functions of the extenxsion work fine...

But will they work on another computer???

<{POST_SNAPBACK}>

I'd try uninstalling and reinstalling the extenstion.
• 0

### #13 Chaos In a Can

Chaos In a Can

GMC Member

• New Member
• 70 posts

Posted 19 May 2007 - 03:33 PM

I have the same problem and it still occurs after reinstalling.
• 0

### #14 IamCalle

IamCalle

GMC Member

• GMC Member
• 444 posts

Posted 25 June 2007 - 12:43 PM

The same thing happens to me... I bet there is a typo. somewhere in the extention which causes this error...?
• 0

### #15 Gamer3D

Gamer3D

Human* me = this;

• GMC Member
• 1819 posts
• Version:GM:Studio

Posted 25 June 2007 - 05:40 PM

I uploaded a version that should fix the problem.

New features:

Removed an extra line from the "Uses" part (should fix error)
Changed help lines to be more useful.
Fixed some argument counts.

EDIT: IamCalle tested it for me, and when a bug was found, figured out how to fix it. Thanks.

Edited by Gamer3D, 26 June 2007 - 03:11 PM.

• 0
Fast Priority Queues - Game Maker's priority queues are O(n). Mine do everything that Game Maker's do, but in O(log n) time.
Dual-Quaternion Skinning - Modifying vertexes in GM is slow. This simple vertex shader does the job both quickly and well.

### #16 snake_maker

snake_maker

GMC Member

• GMC Member
• 56 posts

Posted 27 March 2010 - 06:38 PM

the link is down...
• 0

### #17 Antonio_moder

Antonio_moder

GMC Member

• New Member
• 17 posts

Posted 05 April 2010 - 09:17 AM

the link is down...

• 0

### #18 IamCalle

IamCalle

GMC Member

• GMC Member
• 444 posts

Posted 12 April 2010 - 08:54 PM

Here you go: