Drawing Grid in 3D view - Mathematically calculate points and draw line between them (Not working)
Posted
by
Deukalion
on Game Development
See other posts from Game Development
or by Deukalion
Published on 2012-06-30T17:56:42Z
Indexed on
2012/06/30
21:26 UTC
Read the original article
Hit count: 228
I'm trying to draw a simple grid from a starting point and expand it to a size. Doing this mathematically and drawing the lines between each point, but since the "DrawPrimitives(LineList)" doesn't work the way it should work,
And this method can't even draw lines between four points to create a simple Rectangle, so how does this method work exactly?
Some sort of coordinate system:
[ ][ ][ ][ ][ ][ ][ ]
[ ][2.2][ ][0.2][ ][2.2][ ]
[ ][2.1][1.1][ ][1.1][2.1][ ]
[ ][2.0][ ][0.0][ ][2.0][ ]
[ ][2.1][1.1][ ][1.1][2.1][ ]
[ ][2.2][ ][0.2][ ][2.2][ ]
[ ][ ][ ][ ][ ][ ][ ]
I've checked with my method and it's working as it should. It calculates all the points to form a grid.
This way I should be able to create Points where to draw line right?
This way, if I supply the method with Size = 2 it starts at 0,0 and works it through all the corners (2,2) on each side. So, I have the positions of each point.
How do I draw lines between these?
VerticeCount = must be number of Points in this case, right?
So, tell me, if I can't supply this method with Point A, Point B, Point C, Point D to draw a four vertice rectangle (Point A -> B -> C -> D) - how do I do it? How do I even begin to understand it? As far as I'm concered, that's a "Line list" or a list of points where to draw lines.
Can anyone explain what I'm missing? I wish to do this mathematically so I can create a a custom grid that can be altered.
© Game Development or respective owner