Triangulation and Polygonal Selection Issues :-P

Started by
6 comments, last by Just3D 22 years ago
To anyone who can help: I need to know how to... 1. ...in DirectX, triangulate/tesselate a polygon. The routines or suggestions must be able to include concave, convex, polys with holes, and unconnected polys. (The latter example refers to a set of polygons not connect to one another). This is the foundation for my level engine and is almost identical to doom. I have my reasons for choosing this form of design, but that needn't be discussed here. 2. ...select a polygon with the mouse as it is drawn in a regular 2D canvas via Borland's VCL components. Whew! Well, all help is, as always, appreciated. I will probably end up thinking of some work-around on my own, but I am eager to know of any ideas on this topic. Happy coding, and thanks in advance. Edited by - Just3D on January 9, 2002 11:16:27 AM
"There are only three types of people in this world: those who can count, and those who can't."Just3DJustin NordinJ Squared Productionswww.jsquaredproductions.com
Advertisement
1) No clue what you are talking about, sorry

2) If you know any VB, it is the best thing to use for the designer tools like the level editor. A few picture boxes and sone code and then its all there. As far as selecting, You can just make an array of bounding boxes, and check to see if the mouse clicks withing those boxes, and if so select the polygon associated with the box
Turring Machines are better than C++ any day ^_~
1. A non-trivial exercise, but a few good web searches (perhaps for "tesselate") should shed some light.

2. Those sneaky bastards at microsoft snuck a sample into the SDK called "Pick"
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
Thanks for the replies.

What I really need to know is the first question: How to triangulate a polygon in DX.

Take this example: In doom you would define sectors consisting of polygons with n sides. Now, how would one go about triangulating (dividing the polygon into triangles) these sectors in order to draw the floor/ceiling? Are there any math gurus around, because I have searched thouroughly on the Internet for triangulation, tesselation, etc. and only received various confusing answers.

If no one knows, it doesn''t matter too much, but I would be interested in a decent suggestion.
"There are only three types of people in this world: those who can count, and those who can't."Just3DJustin NordinJ Squared Productionswww.jsquaredproductions.com
Try Graphics Gems V and possibly others.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
Thanks.
"There are only three types of people in this world: those who can count, and those who can't."Just3DJustin NordinJ Squared Productionswww.jsquaredproductions.com
Since you''re asking in the DirectX forum rather than the graphics forum I''ll assume you want the DirectX API/hardware ways of doing this stuff rather than the theory ("how do I tesselate a polygon" isn''t a good question to ask anyway since it doesn''t provide enough details - tesselation is VERY dependent on the storage and interrelations of your vertices/polygons).

1) For subdivision, look at:
- IDirect3DDevice8::DrawTriPatch
- The D3DRS_PATCHEDGESTYLE render state
- The D3DRS_PATCHSEGMENTS render state
- The D3DRS_POSITIONORDER render state
- The D3DRS_NORMALORDER render state
- D3DXTessellateNPatches
- D3DXSimplifyMesh [reducing detail is often better than adding]
- The RTPatch SDK sample

2) For picking, look at:
- D3DXIntersectTri
- D3DXIntersect
- D3DXBoxBoundProbe
- D3DXSphereBoundProbe
- D3DXVec3BaryCentric
- The Pick SDK sample


--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

quote:Original post by Just3D
Thanks for the replies.

What I really need to know is the first question: How to triangulate a polygon in DX.

Take this example: In doom you would define sectors consisting of polygons with n sides. Now, how would one go about triangulating (dividing the polygon into triangles) these sectors in order to draw the floor/ceiling? Are there any math gurus around, because I have searched thouroughly on the Internet for triangulation, tesselation, etc. and only received various confusing answers.

If no one knows, it doesn't matter too much, but I would be interested in a decent suggestion.


I was looking for that myself right now, and since I also found your post, I'll share what I found with you:

http://www.cs.unc.edu/~dm/CODE/GEM/chapter.html

There's also source code to implement it.

Basically you draw horizontal lines at every vertex (creating trapezoids or something), and every time you find a concave vertex you split that trapezoid in two. Seems to be the best algorithm I've found and I think it supports holes.


-Groovis


[edited by - Groovis on April 11, 2002 6:19:52 PM]

This topic is closed to new replies.

Advertisement