| View previous topic :: View next topic |
| Author |
Message |
|
|
Posted: Jun 08, 2006 19:10 Post subject: Trigonemetry/Geometry Library - Collision, Perimeter, Etc... |
|
|
Thanks to Relsoft, Dr. D, and me putting myself in Geometry, I am able to release this library. Relsoft and Dr. D deserve all credit for teaching me collision detection :P
This library's uses pretty darn fast methods. The 2D physics AND Collision.bas goes around 7000 frames per second here.
Download (Source + Lib - 50kb), .rar: Geo Math Lib
Note: Was compiled under Windows XP. If you have trouble with it and it's not a lower than .16 issue, try compiling it yourself.
The Lib Supports the Following:
- Tested on Version .16 Unstable, so no guarantees for you .15'ers
- 1D, 2D, and 3D Trigonometric Functions with Single Digit Precision
- Spherical Against Line Segment Collision Detection for All Dimensions Supported:
| Code:
|
|
Collision_Detection_Dimension(Boundary Type, Boundary Start, Boundary End, Object Position, Radius) | Boundary Type is the value of which normal to use.
Spherical Against Spherical Collision
A ton of other stuff, really (function list below) :P
Type List:
- Geo_Vector
- Geo_Segment
- Geo_Collision_Type
- Enum: Geo_Option
Function List:
- Segment_Collision
- Object_Collision
- Triangle_Collision
- Closest_Point_On_Line
- Get_Angle
- Get_Cos_Angle
- Get_Distance
- Get_Dot_Product
- Get_Endpoint
- Get_Magnitude
- Get_MidPoint
- Get_Triangle_Perimeter
- Normalize_Vector
- Vector_Normal 'Normal between two vectors
So what are you waiting for? Test and complain to me about it people:
Download (Source + Lib - 50kb), .rar: Geo Math Lib
Last edited by Pritchard on Jul 26, 2006 17:57; edited 17 times in total |
| |
|
| Back to top |
|
 |
|
|
Posted: Jun 08, 2006 20:05 Post subject: |
|
|
works amazingly well here! :)
and i'm using .15, just a "fbc Geo_Math_Lib.bas -lib" and it's done ;D
i wish i could use that within Nano :P (evil laugh!! MUAHAHAHAHA!!) >:P
i must say i'm impressed.. especially with that GetAngle proc ;) |
| |
|
| Back to top |
|
 |
|
|
Posted: Jun 08, 2006 23:23 Post subject: |
|
|
| voodooattack wrote: | works amazingly well here! :)
and i'm using .15, just a "fbc Geo_Math_Lib.bas -lib" and it's done ;D
i wish i could use that within Nano :P (evil laugh!! MUAHAHAHAHA!!) >:P
i must say i'm impressed.. especially with that GetAngle proc ;) |
Well if you add an extension to every function I think you could use it in nano. :P |
| |
|
| Back to top |
|
 |
|
|
Posted: Jun 09, 2006 0:00 Post subject: |
|
|
| Deleter wrote: | | Well if you add an extension to every function I think you could use it in nano. :P |
*goes to prepare his artillery* >:D |
| |
|
| Back to top |
|
 |
|
|
Posted: Jun 09, 2006 0:54 Post subject: |
|
|
| Now finish that party game. :*) |
| |
|
| Back to top |
|
 |
|
|
Posted: Jun 09, 2006 5:26 Post subject: |
|
|
| relsoft wrote: | | Now finish that party game. :*) | Shhh!!!! :P |
| |
|
| Back to top |
|
 |
|
|
|
| Back to top |
|
 |
|
|
Posted: Jun 09, 2006 5:48 Post subject: |
|
|
EDIT: Fixed. Thanks for reading the first post, and complaining to me.
Double Edit: Added 3-D examples, not finished. I have to learn 3D first... |
| |
|
| Back to top |
|
 |
|
|
Posted: Jun 09, 2006 12:44 Post subject: |
|
|
| how bout we use it in ATTO.... atto anyone? atto please? I WANT ATTO!!!! |
| |
|
| Back to top |
|
 |
|
|
Posted: Jun 10, 2006 13:46 Post subject: |
|
|
Update:
Finally! I have just added Object to Object (Circle to Circle) collision. Updated link in first post.
Changed:
Collision_Detection_2D is now Called: Segment_Collision
Object to Object Collision is called: Object_Collision_2D (only 2D is available)
New Option Added for Object_Collision - First parameter is an Enum. Either Geo_Physics or Geo_No_Physics. Geo_No_Physics won't return the normals, so it's slightly faster. |
| |
|
| Back to top |
|
 |
|
|
Posted: Jun 10, 2006 14:52 Post subject: |
|
|
| Zamaster wrote: | | how bout we use it in ATTO.... atto anyone? atto please? I WANT ATTO!!!! |
I had already planned to use line-collision detection in atto. The ships will have a line-loop describing the outside edges and if weapons fire crosses one of said lines, then a hit will be scored. |
| |
|
| Back to top |
|
 |
|
|
Posted: Jun 10, 2006 14:56 Post subject: |
|
|
| 1000101 wrote: | | I had already planned to use line-collision detection in atto. The ships will have a line-loop describing the outside edges and if weapons fire crosses one of said lines, then a hit will be scored. | Hahah. Add this line to the Object_Collision_2D, then compile and run Object_Collision.bas in the Two Dimensional examples folder:
| Code:
|
|
Line (c.x, c.y)-(d.x, d.y) | You get a line outside of the red ball reflecting the white one :P |
| |
|
| Back to top |
|
 |
|
|
Posted: Jun 10, 2006 15:40 Post subject: |
|
|
| It's an interesting bit of a math lib, I'll have to take a look at it a bit more. However, we're not that far yet. We're still working on code even before that happens. Once we have something too collide, then we'll worry about checking for that :D |
| |
|
| Back to top |
|
 |
|
|
Posted: Jun 11, 2006 13:33 Post subject: |
|
|
Type Geo_Segment_1D is dublicated in the .bi file. Gave me an error when I tried to compile it...
Also you have this line in the examples: #include "Fbgfx.bi". You should use "fbgfx.bi" for it to compile in Linux. Linux is case sensitive!
I've only tried one or two examples, but looks good so far. Thanks, mate. |
| |
|
| Back to top |
|
 |
|
|
Posted: Jun 11, 2006 13:58 Post subject: |
|
|
| elcalen wrote: | Type Geo_Segment_1D is dublicated in the .bi file. Gave me an error when I tried to compile it...
Also you have this line in the examples: #include "Fbgfx.bi". You should use "fbgfx.bi" for it to compile in Linux. Linux is case sensitive!
I've only tried one or two examples, but looks good so far. Thanks, mate. | Thanks for the complements and complaints! Geo_Segment_1D is duplicated because I added it at the last minute. I only had it for one dimension because I never used it, so I forgot all about it.
Case sensitivity is important. I'll have to remember that! Be right back in a minute with the update!
EDIT: Fixed, updated in first post. |
| |
|
| Back to top |
|
 |
|