Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Prysx, Grade 12 Final Project
Index -> Programming, C++ -> C++ Submissions
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Saad




PostPosted: Tue Jun 17, 2008 12:13 pm   Post subject: Prysx, Grade 12 Final Project

For my summative project, I made Prysx, which is a particle and rigid body physics engine put together. This is a demo I put together. The graphics engine uses OpenGL, and for window management SDL was used.
code:
CONTROLS:
     If your drawing a polygon
     Right click stops the drawing of polygon
     Left click to set the starting point and left click to set the final radius at your targeted radius

     If point is on a polygon
     Middle click breaks apart the polygon

     Or else
     Left click spawns particles
     Right click pulls the particles towards the mouse
     Middle clicks blows them away from the mouse


Enjoy

Edit: Use this link for the latest versions
Sponsor
Sponsor
Sponsor
sponsor
Aziz




PostPosted: Tue Jun 17, 2008 12:32 pm   Post subject: RE:Prysx, Grade 12 Final Project

Is sweet. You know my views about it, I'll post the gist of suggestions for others:

- Colors
- Option to take of side boundaries
- Force of attraction/unattraction proportional to distance

I'm having fun with it (great distraction at work!)
Euphoracle




PostPosted: Tue Jun 17, 2008 3:52 pm   Post subject: RE:Prysx, Grade 12 Final Project

Ooo, pretty and fun. I like it. Too bad my school doesn't let us do anything cool like this to show off a bit for our projects ):
apomb




PostPosted: Tue Jun 17, 2008 3:59 pm   Post subject: RE:Prysx, Grade 12 Final Project

Congrats on getting all the bugs worked out. Its very nice.
Dan




PostPosted: Tue Jun 17, 2008 5:19 pm   Post subject: RE:Prysx, Grade 12 Final Project

Very nice and for the linux fans out there, the exe seems to run fine threw WINE if you don't want to complie it.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Euphoracle




PostPosted: Tue Jun 17, 2008 6:47 pm   Post subject: RE:Prysx, Grade 12 Final Project

Saad is more pro at cross compatibility than most commercial identities, so it seems (:
CodeMonkey2000




PostPosted: Tue Jun 17, 2008 7:09 pm   Post subject: RE:Prysx, Grade 12 Final Project

Saad, what's your secret to blurring?
zylum




PostPosted: Tue Jun 17, 2008 7:11 pm   Post subject: RE:Prysx, Grade 12 Final Project

Pretty nice! I see you only used convex polygons so I'm assuming you used the separating line theorem for collision detection? If not, can you briefly describe your method? I'm writing a physics engine as well but with arbitrary polygons so I'm using a different method (SLT doesn't work with concave polys).
Sponsor
Sponsor
Sponsor
sponsor
Saad




PostPosted: Tue Jun 17, 2008 7:16 pm   Post subject: Re: RE:Prysx, Grade 12 Final Project

CodeMonkey2000 @ Tue Jun 17, 2008 7:09 pm wrote:
Saad, what's your secret to blurring?


No secret, basically drawing random lines over the current graphics. (Its in Main.cpp should you want to look around).

zylum wrote:

Pretty nice! I see you only used convex polygons so I'm assuming you used the separating line theorem for collision detection? If not, can you briefly describe your method? I'm writing a physics engine as well but with arbitrary polygons so I'm using a different method (SLT doesn't work with concave polys).


I did use convex polygons and separating axis theorem. However should you want to use concave and separating axis theorm, I recommend splitting the polygons into convex polygons. You can achieve this by triangulating the polygons and joining up those triangles that that create convex polygons to create smaller convex polygons. Now you test each of those smaller polygons for collision (Should any collide then you have a collision). I also think you could test it by using intersections of each line its up to you

Edit: Just to say one thing about the collision. It is not perfect right now and the collision doesn't work with polygons that have the same axis (polygons with even number edges, a square has 2 of the same axis). This is why if you noticed the polygon sides was always odd Wink. Perhaps some input?
Reality Check




PostPosted: Tue Jun 17, 2008 8:52 pm   Post subject: Re: Prysx, Grade 12 Final Project

Awesome dude. It's great that you guys did C++ in grade 12 though!
zylum




PostPosted: Wed Jun 18, 2008 1:10 am   Post subject: RE:Prysx, Grade 12 Final Project

I was wondering which method would be faster as they are both O(n*m). Also they both have very simple loops with few calculations. Though SAT quits when it finds that two polygons aren't intersecting and line intersections quits when it does find an intersection. Typically, it is more likely that two polygons are not intersecting but how much complexity would be added for concave polygons?
md




PostPosted: Wed Jun 18, 2008 10:34 am   Post subject: RE:Prysx, Grade 12 Final Project

This is pretty cool!
Saad




PostPosted: Wed Jun 18, 2008 10:53 am   Post subject: Re: RE:Prysx, Grade 12 Final Project

zylum @ Wed Jun 18, 2008 1:10 am wrote:
I was wondering which method would be faster as they are both O(n*m). Also they both have very simple loops with few calculations. Though SAT quits when it finds that two polygons aren't intersecting and line intersections quits when it does find an intersection. Typically, it is more likely that two polygons are not intersecting but how much complexity would be added for concave polygons?


For concave polygons you will be testing for which of the convex polygons, but I would go with SAT since it wouldn't check some edges that have no need to be checked.
Also SAT would let you project your edges with velocities which makes it much easier find if they'll collide in a frame or not aswell as give you collision normals and translation vectors so that they don't collide.

And thanks all for the great comments Smile
corriep




PostPosted: Sun Jan 25, 2009 9:21 pm   Post subject: RE:Prysx, Grade 12 Final Project

The link doesn't work for me Sad
saltpro15




PostPosted: Sun Jan 25, 2009 9:23 pm   Post subject: RE:Prysx, Grade 12 Final Project

bad necro paul!
Display posts from previous:   
   Index -> Programming, C++ -> C++ Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 20 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: