vb.net - Visual Basic .Net 3D Engine -
this more of mathematical problem programming problem.
i have created basic 3d engine using visual basic .net. displays lines on screen additional z axis. engine works, when part of line goes below 0 messes , starts drawing line inverted again.
this how calculates points:
y = (point.y / z) + offset.y + camera.y x = (point.x / z) + offset.x + camera.x can work out way draw part of line when intersects z=0 axis?
(source code) http://www.mediafire.com/?ww77q26ywj3a5ry
you want draw z>0 because below 0 behind camera , z == zero, blow because can't divide zero. this: ('scuse c#, should same anyway)
y = z > 0 ? (point.y / z) + offset.y + camera.y : 10000; x = z > 0 ? (point.x / z) + offset.x + camera.x : 10000; where 10000 value large enough not appear on screen.
if z axis pointing in opposite direction, you'll want this:
y = z < 0 ? -1*(point.y / z) + offset.y + camera.y : 10000; x = z < 0 ? -1*(point.x / z) + offset.x + camera.x : 10000;
Comments
Post a Comment