Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Some basic questions - TV3D collision, polygon types  (Read 1095 times)
harikumar001
Customers
Community Member
*****
Posts: 65


« on: June 16, 2010, 10:52:40 PM »

Hey all,

I was working on a 3d room generation program that converts 2d drawing of a room into 3d. I am facing some new issues:

1. How can I check for collision between objects in the room. Say, I have 2 TVMesh Box1 and Box2. How can I check for collision between these two. I am using TV3D 6.5. Any tutorials available?

2. Is there an algorithm to check if a polygon is simple/complex.

Thanks for viewing this post. Have a good day.

Regards
Logged
Mithrandir
Community Member
*
Posts: 325


« Reply #1 on: June 16, 2010, 11:31:19 PM »

Quote
1. How can I check for collision between objects in the room. Say, I have 2 TVMesh Box1 and Box2. How can I check for collision between these two. I am using TV3D 6.5. Any tutorials available?

If you only need to do checks between simple shapes (spheres/elipsoids, boxes, cylinders) of the same type you can find various algorithm for all these shapes using google. If you need something simple like sphere-to-sphere or box-to-box without rotation, you just need to check for bounds and distances (for spheres).

Only efficient way to do collision detection between two arbitrary meshes, according to my knowledge, is to use TVPhysics.TestCollision(...). For this you need to create two mesh bodies or one mesh body and one static mesh body. S=You can't use two static bodies. Mesh bodies are all right but they can only be represented by convex hulls. So depends what you need.

Alternatively you can get the face data and implement collision detection of your own. AABB, BSP and Octree would be things you might want to have look at.

Quote
Is there an algorithm to check if a polygon is simple/complex.

In TV3D - No.

In general - what do you mean by complex polygon?
Concave? If so, they yes. You just have to check if the polygon has any interior angles greater than 180deg. If all angles are smaller than 180deg, polygon is convex.
« Last Edit: June 16, 2010, 11:38:00 PM by Mithrandir » Logged
harikumar001
Customers
Community Member
*****
Posts: 65


« Reply #2 on: June 17, 2010, 01:09:45 AM »

Thank you Mithrandir, again  Smiley

By simple polygon I mean a polygon, the sides of which do not intersect each other. Complex is just the opposite. Concave and convex are simple polygons.

I need to check if sides intersect each other.

Also how can I check if the polygon is a closed figure (I am trying to create a closed room). Any algorithm for that.

Regards

Logged
Mithrandir
Community Member
*
Posts: 325


« Reply #3 on: June 17, 2010, 04:28:30 AM »

I assume you are drawing the room in 2D and then extruding it to 3D so the polygon is 2D.

In that case you can perform line-segment to line-segment intersection check for every edge with every other edge.

As for the second question you can always connect the last point to the first point in list of edge vertices so that all shapes are closed.
Logged
jviper
Community Member
*
Posts: 2130

Discipline in training


« Reply #4 on: June 17, 2010, 06:13:34 PM »

Also note (to make sure your question is answered somewhat bluntly), TV3D does not have built-in functions to determine whether a 2D polygone has self-intersecting sides. This is because polygones in TV3D are triangles only, and stored as such. A triangle can never have self-intersecting sides (unless is hyperspace, but you need 4+ dimensions for that). Therefore there is no need for an algorithm to determine whether a polygone has self-intersecting sides built-in to the engine.
Logged

JAbstract.....Don't just imagine, make it happen!
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks