Ive looked through google and a few other places, searching for how to calculate the pixels you would need to fill in a 3d space to draw a line, circle , sphere or anything really.

Ive always been good with learning math, i just need somewhere to learn it from

a little more information on my problem:
I have a c# server program that sends... basically pixels to a client, so lets say i need a sphere with a radius of 10, but all i need are to figure out are what pixels i need to send to the client so that it can draw the sphere, how would i calculate that? or a line(or vector), one thats not a single dimension(Ha, a line thats more then one dimension :D), does someone have an algorithm or something to calculate the number of pixels in each line segment?

Would be really thankful for a link or something to get me started, maybe im just not googling the right keywords.. idk

Recommended Answers

All 3 Replies

3d matrix never occurred to me, ill give it a look, thanks

Just looking at lines, say drawing a line, its an interesting question the way you phrased it.

I've done some drawing in c#, wrote a connect 4 program, and had to draw my grid were you drop the pieces and of course drew colored circles to indicate the chips you are trying to connect 4.

Now if i want a line I'd say draw like from point 10,10 to point 10 60 and i have a line length 50 ( going down). How far down could i go? well if their screen resolution is 800 by 600, and my y length of a line that represents the side of a square is 50, drawing 7 of these 50 pixel lines is 350 pixels. so I'm using about 60% of the y length of their 600 y dimension screen resolution. but i put that same program on much higher screen resolution, and suddenly I'm using much less of the total available screen area to display my program. my 400 by 400 window with squares 50 by 50 occupies a smaller are of their screen because they have more screen resolution.

now to throw another loop into this, in c++ when i used Microsoft foundation class to draw lines, I didn't have to draw literally to the screen. i could translate everything into a coordinate system that then gets mapped to the screen. I think the goal here was to let me draw in some constant measurement like some number always equals an inch, and if the program actually winds up drawing 50 pixels or 100 pixels to do that it will, depending on their screen size of course.

edit: i found this page http://msdn.microsoft.com/en-us/library/3zxbwxch.aspx on Coordinate Systems and Transformations in .net. I think what exactly happens when you draw will depend on the type of coordinate system you choose. The crudest example is you simply draw pixel to pixel like 50 pixel lines and the effect or sizing varies depending on screen resolution.

Mike

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.