Public Group

#### Archived

This topic is now archived and is closed to further replies.

# Please critique my idea for plotting a point in 3D space on a 2D screen

This topic is 5299 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Ok ok ok. I don''t have a lot of programming experience but I think this might work. I drew visuals too. Really this is all for my own benefit because until I put my ideas down on "paper" but I figured I''d have others take a look as well because frankly I don''t know if I''m even close to being right. I want to be able to define a point in 3D space with x, y, and z coordinates, and then plot it on a 2D screen. I think I have this figured out. Please let me know if I''ve got this wrong. Ok, first, I understand that the cone of vision for the uman eye is 60 degrees. I don''t suppose it really matters what I use for the 3D "camera" though, but I''ll go with 60 degrees just for the hell of it: Alright. First thing I should mention is that the x, y, and z coordinates will be relative to the camera''s point of view. Later if I program any games with this (I have one in mind but I doubt I will finish it, because I never do), I will probably have all the points'' coordinates relative to the game world, and then convert the [i">visible[/i"> points in each from to be relative to the camera to make calculations easier. But for now, I have the field of view devided into 4 quadrantS: Now suppose I plot a point in that field of view: It''s 7 "units" on the z axis away from the camera, 2 units on the x axis to the right, and 2 units high on the y axis. Here''s another visual so you can see what I mean: Now the basic idea here is that I want to know what angles (x and y) exist from the center of the point of view and then determine what percentage of the total 60-degree cone these angles take up. Here''s what I mean: Now here''s a better picture with the useless stuff removed: Knowing that the point is both 7 units away and 2 units high, I can easily figure out that the angle here is 15.9454 degrees. The other angle is also 15.9454 degrees because it has the same measurements, so no need to do the math again this time. This tells me that the 15.9454-degree angle is 26.5756% of the total 60-degree cone. When I apply that percentage to the vertical and horizontal resolution of the display, I find that it equals about 64 and 85 pixels. I have to round because duh you can light a fraction of a pixel. Anyway, so now I know how many pixels away from the center of the screen the point should be, right? And now the finished point: The one thing I did notice that was wrong while typing this is that the cone should probably be 60 degrees wide and 45 degrees tall, since the screen has a 4:3 aspect ratio. This method will probably make everything look a little smooshed. Other than that though it seems it should work. What do you think?

wow! 0.o

##### Share on other sites
i h8 u guys

Just kidding I don''t. But damn I looked at the thread listings and thought I had 2 replies.

##### Share on other sites
I actually like it.(Ignore my 0.o) I''d like to see it teted out.

##### Share on other sites
Cool I''ll give it a try when I get home. I don''t know why I always insist on getting an "ok" on my plans without first trying them out myself. It''s not like I mind committing the time to program. :-p

Thanks for the feedback.

##### Share on other sites
It seems to be correct (didn''t check it personally), but I think it''s a waste of time, you are trying to reinvent the wheel. There is already a whole theory of 3d graphics, projection and rendering, far more advanced than what you could achieve by your own. I think it''s wiser to use what is already there and tested, and work from that point, so your effort is productive.

Besides, using trigonometric calculations like tangent is always slower than matrices.

And even if you code a program to project points in 2d screens, there is still a long road to walk, like rendering polygons, backface culling, texturing, z-buffer.. do you want to go through all that pain just to get to the same point you could be just by reading a couple tutorials?

##### Share on other sites
The concept is sound, as I implemented it in a cheap QBASIC shape renderer awhile back.

##### Share on other sites
No of course not, but it's just a fun little challenge I set up for myself. I don't intend to build all of my future 3D programming upon this concept. Just a personal enrichment sort of thing.

The concept is sound, as I implemented it in a cheap QBASIC shape renderer awhile back.

Oh cool! Thanks for letting me know!

[edited by - utwo on January 4, 2004 10:03:15 PM]

##### Share on other sites
quote:

It seems to be correct (didn''t check it personally), but I think it''s a waste of time, you are trying to reinvent the wheel. There is already a whole theory of 3d graphics, projection and rendering, far more advanced than what you could achieve by your own. I think it''s wiser to use what is already there and tested, and work from that point, so your effort is productive.

Besides, using trigonometric calculations like tangent is always slower than matrices.

And even if you code a program to project points in 2d screens, there is still a long road to walk, like rendering polygons, backface culling, texturing, z-buffer.. do you want to go through all that pain just to get to the same point you could be just by reading a couple tutorials?

And i don'' think its very wise to put down a new idea.

1. 1
Rutin
24
2. 2
3. 3
JoeJ
18
4. 4
5. 5

• 38
• 23
• 13
• 13
• 17
• ### Forum Statistics

• Total Topics
631706
• Total Posts
3001832
×