Notifications
Clear all

[Closed] grid to bitmap

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

4 Replies

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?

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?

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

Aha! THank you very much that sorted it.