Click here to Skip to main content
15,892,005 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: structure representing file Pin
El Corazon14-Jan-06 15:04
El Corazon14-Jan-06 15:04 
QuestionHard maths problem Pin
Christian Graus14-Jan-06 12:41
protectorChristian Graus14-Jan-06 12:41 
AnswerRe: Hard maths problem Pin
Sean Cundiff14-Jan-06 14:25
Sean Cundiff14-Jan-06 14:25 
GeneralRe: Hard maths problem Pin
Christian Graus14-Jan-06 19:56
protectorChristian Graus14-Jan-06 19:56 
AnswerRe: Hard maths problem Pin
Stephen Hewitt14-Jan-06 14:35
Stephen Hewitt14-Jan-06 14:35 
GeneralRe: Hard maths problem Pin
Christian Graus14-Jan-06 19:52
protectorChristian Graus14-Jan-06 19:52 
AnswerRe: Hard maths problem Pin
Michael A. Barnhart14-Jan-06 14:36
Michael A. Barnhart14-Jan-06 14:36 
AnswerRe: Hard maths problem Pin
El Corazon14-Jan-06 14:41
El Corazon14-Jan-06 14:41 
This may help: http://www.euclideanspace.com/maths/geometry/coordinatesystems/polar/[^]

I deal with 3D image projections, so you will have to forgive me if I walk through this step by step (it is as much for me as you). I promise I am definately not being condescending by stepping through it.

atan gets the angle of a rise over run angle (y/x), atan2 simply separates the y,x values in order to guarentee you a correct quandrant result since -y/-x is equivalent to y/x atan must be verified for quandrant based on the incoming values. atan2 does that for you.

theta= atan2(z,x) is the angle from z/x where normally y would be in the place of z.
This means that z=r sin(theta) and x=r cos(theta)

now reversing phi to y, you already know x,z so you can easily get the known distance to x,z which is what the sqrt(x*x+z*z) is getting you. so y is the only unknown

well, y is in the x position of the atan result so you don't even have to worry about the distance portion.
y=r cos(phi) though you might want to verify that dist(x,z)=r sin(phi) just as a double check.

(I learned a long time ago when you deal with 3D surface projections, double checking your work by finding the redundant parameters is a good thing -- just remove them if you need the speed after doing your initial tests)

[edit: hopefully that is all correct, I didn't check it, just walked through it from your code]

_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)


-- modified at 21:04 Saturday 14th January, 2006
GeneralRe: Hard maths problem Pin
Christian Graus14-Jan-06 20:05
protectorChristian Graus14-Jan-06 20:05 
Questioni need TIC TAC TOE source vc++ Pin
peyman1361814-Jan-06 10:23
peyman1361814-Jan-06 10:23 
AnswerRe: i need TIC TAC TOE source vc++ Pin
Christian Graus14-Jan-06 12:38
protectorChristian Graus14-Jan-06 12:38 
QuestionAccessing Video Files Pin
AJ12314-Jan-06 9:15
AJ12314-Jan-06 9:15 
AnswerRe: Accessing Video Files Pin
Chris Losinger14-Jan-06 9:45
professionalChris Losinger14-Jan-06 9:45 
Questionloading and displaying images Pin
Fatima Tuz Zahra13-Jan-06 19:37
Fatima Tuz Zahra13-Jan-06 19:37 
AnswerRe: loading and displaying images Pin
zubair_ahmed13-Jan-06 20:06
zubair_ahmed13-Jan-06 20:06 
GeneralRe: loading and displaying images Pin
Fatima Tuz Zahra13-Jan-06 20:25
Fatima Tuz Zahra13-Jan-06 20:25 
GeneralRe: loading and displaying images Pin
includeh1013-Jan-06 20:38
includeh1013-Jan-06 20:38 
GeneralRe: loading and displaying images Pin
Fatima Tuz Zahra13-Jan-06 20:54
Fatima Tuz Zahra13-Jan-06 20:54 
GeneralRe: loading and displaying images Pin
includeh1014-Jan-06 3:32
includeh1014-Jan-06 3:32 
GeneralRe: loading and displaying images Pin
ThatsAlok15-Jan-06 21:06
ThatsAlok15-Jan-06 21:06 
QuestionSubclassing CEdit, OnChar Pin
Lilith.C13-Jan-06 17:36
Lilith.C13-Jan-06 17:36 
AnswerRe: Subclassing CEdit, OnChar Pin
includeh1013-Jan-06 17:56
includeh1013-Jan-06 17:56 
GeneralRe: Subclassing CEdit, OnChar Pin
FarPointer14-Jan-06 0:21
FarPointer14-Jan-06 0:21 
GeneralRe: Subclassing CEdit, OnChar Pin
Lilith.C14-Jan-06 3:54
Lilith.C14-Jan-06 3:54 
QuestionPrevent endtask the application Pin
leenmie13-Jan-06 16:09
leenmie13-Jan-06 16:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.