Math..

Posts 1–10 of 10 · Page 1 of 1
Math..
Yo.

I need some help with some world to screen calculations. If possible, using the least amount of API possible, having a couple wouldn't be a big deal but it'd be preferable if there was none.

So.. if any of you mathematicians want to help me out here..

Thanks.

Note: All though I program a lot, I'm not that great in math...
I can probably help. What do you need?
Quote Originally Posted by Shark23 View Post
I can probably help. What do you need?
World to screen calculation/formula..
I haven't done any world to screen before. Sorry. What does it involve though?
Quote Originally Posted by Shark23 View Post
I haven't done any world to screen before. Sorry. What does it involve though?
Converting 3D world coordinates to 2D screen coordinates.
Quote Originally Posted by Void View Post
Converting 3D world coordinates to 2D screen coordinates.
So it's similar to converting 3D vectors into cartesian 2D (x/y axis)?
Quote Originally Posted by Jason View Post
So it's similar to converting 3D vectors into cartesian 2D (x/y axis)?
It's exactly that.
Nevermind then.
A much simpler solution than the perspective projection suggested in the
comment below, and arguably a more attractive one, is the orthographic
projection. I shall give you the formulas to convert (x, y, z) coordinates
into (x, y) coordinates after rotation about the axes.

Suppose that we rotate the cube by Rx degrees about the x axis, by Ry
degrees about the y axis, and by Rz degrees about the z axis.

First, apply the x-axis rotation to transform coordinates (x, y, z)
into coordinates (x0, y0, z0).

x0 = x

y0 = y*cos(Rx) + z*sin(Rx)

z0 = z*cos(Rx) - y*sin(Rx)

Then apply the y-axis rotation to (x0, y0, z0) to obtain (x1, y1, z1).

x1 = x0*cos(Ry) - z0*sin(Ry)

y1 = y0

z1 = z0*cos(Ry) + x0*sin(Ry)

Finally, apply the z-axis rotation to obtain the point (x2, y2).

x2 = x1*cos(Rz) + y1*sin(Rz)

y2 = y1*cos(Rz) - x1*sin(Rz)

Hey presto, you can now plot (x2, y2) in two dimensions.

Regards,

leapinglizard
Found this around the web..

Original: Google Answers: conversion of XYZ coordinates to XY

not sure if is that what you are looking for. Not that good with maths either. (Googled..)
It just so happens that's what we've been doing in maths this year (I'm failing it but we'll overlook that /)

Hmmm, well the only annoying thing is the (z) axis, but that's not too big of a deal if you can find angles and use sine/cosine to get lengths and shizniz. Sorry I can't help you right now it's 12:45AM and my brain just won't function properly, I'll look at it again tomorrow after I've thought about it some more, don't worry I won't forget. If I can be bothered I might be able to find a way to create a VB.NET program that receives x,y,z world co-ords and outputs x,y screen co-ords. I'll probably need to ask you a few questions about world co-ords first though (haven't ever done anything with them), but I'll save that for tomorrow.

Sorry again that I can't help you right this second :S

EDIT: Pwnt by Brinuz
Posts 1–10 of 10 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us