Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Creating room with more than 4 walls??  (Read 1999 times)
harikumar001
Customers
Community Member
*****
Posts: 65


« on: June 09, 2010, 06:30:22 AM »

Hey guys,

After hours of sitting in front of the computer I cant figure our how to draw a pentagon shaped room  Huh. I do not want to do this in a 3d modeling app, as the shape and size would differ in future.

I checked out the tutorial which shows how to draw 4 walls (using AddWall method) and a floor. But I cant figure out how to draw a room with more than 4 walls.

New to Tv3D. Any pointers??

Thanks in advance

Regards


Logged
Mithrandir
Community Member
*
Posts: 325


« Reply #1 on: June 09, 2010, 01:59:33 PM »

http://wiki.truevision3d.com/tutorialsarticlesandexamples/building_a_cylinder

Just invert the normals and you have a room instead of cylinder.

Logged
harikumar001
Customers
Community Member
*****
Posts: 65


« Reply #2 on: June 09, 2010, 10:26:30 PM »

Thank you Mithrandir. The link was helpful in solving some other texture related doubts as well.

But, say, I have a pentagon shaped room, how will I draw the floor for the same? AddFloor method would not be useful.
Logged
Lenn
Customers
Community Member
*****
Posts: 876

+/-


« Reply #3 on: June 10, 2010, 04:50:58 AM »

You draw 5 triangles. Using 6 vertices.
Logged

TV3D 6.5 Community Docs - Read, use and please contribute!
Mithrandir
Community Member
*
Posts: 325


« Reply #4 on: June 10, 2010, 06:22:28 AM »

But, say, I have a pentagon shaped room, how will I draw the floor for the same? AddFloor method would not be useful.

That is in the article too.
Logged
harikumar001
Customers
Community Member
*****
Posts: 65


« Reply #5 on: June 10, 2010, 12:23:44 PM »

Thanks for your reply Mithrandir and Lenn.

As I said in my initial post, the shape and size of the room would differ. Room might be a pentagon, hexagon, octagon or any other shape. The program should be able to draw the floor automatically.

How can I achieve that. I do know the position of the walls of the room in 3d space. How will I be able to draw the floor for the room in such a case?

Really stuck with that. Any help would be really appreciated.

Regards
Logged
sciophyte
Customers
Community Member
*****
Posts: 245


« Reply #6 on: June 10, 2010, 12:47:02 PM »

think about your floor like this, if you want a hexagon room, draw a hexagon on a piece of paper, now split the hexagon into even triangles, now in code, create a tri strip that follows what you've drawn, do this clockwise.
Logged
harikumar001
Customers
Community Member
*****
Posts: 65


« Reply #7 on: June 10, 2010, 01:07:42 PM »

Good thinking sciophyte

I tried the same too. But the problem is that I can come up with too many types of figures having same number of edges that I can't generalize the creation of the shapes. Different figures require different order of triangle vertices.

What I am trying to do now is, ask the user to draw a shape and convert that into a room. So any shape that the user draws needs to be converted to 3d with walls and floor. I do not know how to draw the floor based on the user's input shape.

Is there some kind of an algorithm/function which can appropriately select triangles coordinates from a given list of points to complete the figure or am I asking for too much?

Any help wud be much appreciated.

Rgds
Logged
Mithrandir
Community Member
*
Posts: 325


« Reply #8 on: June 10, 2010, 07:52:39 PM »

Generally on that topic:
http://en.wikipedia.org/wiki/Polygon_triangulation

C code for one of the methods mentioned above:
http://www.cs.unc.edu/~dm/CODE/GEM/chapter.html

If you need something faster just go through the references on wikipedia or google some more.
These methods should work for arbitrary polygons perhaps even with holes.

One more:
http://parasol.tamu.edu/publications/download.php?file_id=243
« Last Edit: June 10, 2010, 07:58:49 PM by Mithrandir » Logged
harikumar001
Customers
Community Member
*****
Posts: 65


« Reply #9 on: June 10, 2010, 11:01:02 PM »

Thank you so much Mithrandir

Really the reply I was looking for. Excellent !!!
Logged
Pages: [1]
  Print  
 
Jump to:  

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