PDA

View Full Version : grid to bitmap


dutch_delight
05-29-2008, 05:03 PM
Hi everyone.

I want to make a bitmap from a quad-plane. Is there an easy way to find out how a mesh is build up? For instance I have this:


+--+--+--+--+
|..|..|..|..|
+--+--+--+--+
|..|..|..|..|
+--+--+--+--+
|..|..|..|..|
+--+--+--+--+


I want to get this excactly onto a bitmap of the total points. The points are always going to be 5 in width and 4 down. But how do I identify which vertex is top left and how would i go about identifying the rest?
Would I have to check each vertex against another?

Thanks for all the help
R

dutch_delight
05-29-2008, 06:01 PM
I did write a script where I get the top left vert and top right and then check each connected edge on the same x axis, collect the vert connected to that edge, put in an array, next vert down, etc,etc

But surely there must be an easier way?

Is there anyway i could use the renderer for this?

dutch_delight
06-05-2008, 12:08 PM
Guess it's a bit harder than I thought.

What about if the plane geometry has it's vertices always aligned at a fixed x and y position?
So, top left vert would always be at 0,10 and bottom left at 10,0?

Could I get a vert (or face) by entering a specific position without having to test each vert position?

davestewart
06-05-2008, 01:15 PM
Can you not just loop thourgh the verts (in any order) and multiply the XY position of the vertex / face by a scalar?

bmpSize = 5
gridSize = 500

gridPos = [300,200]
pixelPos = gridPos / (gridSize / bmpSize) -- [3,2]

x = int(pixelPos.x) -- 3
y = int(pixelPos.y) -- 2

dutch_delight
06-09-2008, 01:50 PM
Aha! THank you very much that sorted it.

CGTalk Moderation
06-09-2008, 01:50 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.