1,574 reputation
726
bio website klaimsden.net
location France
age 31
visits member for 3 years, 9 months
seen Feb 28 at 16:08

Making games with my bare hands. Building narratives with my forehead.


Feb
11
awarded  Nice Question
Feb
7
awarded  Popular Question
Jan
26
comment Spherical coordinate from cartesian coordinate
Thanks. I'll not to never again try to do maths at 2am in the morning...
Jan
26
comment Spherical coordinate from cartesian coordinate
After having use this code, I found that there is an issue: when I ask for from_cartesian( UNIT_X ) I get a phi which is negative (-90degree) while I should have a positive value (270degree). This I believe makes my unit tests get very wrong. I have no idea how to fix this.
Dec
12
accepted Spherical coordinate from cartesian coordinate
Dec
6
comment Spherical coordinate from cartesian coordinate
It my mistake again, I did atan2( y, hypot(x,z)) instead of atan2( hypot(x,z), y). Now it seems to work almost perfectly. The problem I see is positions around negative Z being avoided (I'm using a moving cursor using the spherical coordinates to check visually). I think the issue might be related to a chain of transformations I'm doing, I'm checking that right now.
Dec
6
comment Spherical coordinate from cartesian coordinate
Howver, my problem don't seem to be really fixed yet.
Dec
6
comment Spherical coordinate from cartesian coordinate
It don't seem to work either. I'm not sure where is the problem.
Dec
6
comment Spherical coordinate from cartesian coordinate
My mistake, I assumed that radius was already the value of hypot(x,z). I'll try that right now.
Dec
6
comment Spherical coordinate from cartesian coordinate
It helps understanding the issue, but not fully, because it was not clear to me how to work around the sign and pi thing. I learnt about atan2 which apparently does the work efficiently.
Dec
6
comment Spherical coordinate from cartesian coordinate
Ok now I think I get it. I try the following code: SphereVector result = SphereVector::ZERO; result.radius = cartesian.length(); if( result.radius == 0 ) return result; result.phi = Math::ATan2( cartesian.z, cartesian.x ); result.theta = Math::ACos( cartesian.y / result.radius ); return result; It seems to be working except for positions close to negative Z which seems to be buggy, but it might be something else in my code that's wrong.
Dec
6
comment Spherical coordinate from cartesian coordinate
this is helpful, however "atan2(hypot(x,z), y)" don't seem to be correct. Did you mean acos? Because it seem to be the right equation.
Dec
6
comment Spherical coordinate from cartesian coordinate
I follow the explaination except the last line which contain the answer. What do you mean by which quarter? I assume that the "pole" is +Y, so what you seem to mean is that when theta is out of valid range I should add nPi, n being either 0.5, 1, 1.5 or 2? Not sure I understand correctly.
Dec
6
asked Spherical coordinate from cartesian coordinate
Sep
3
awarded  Popular Question
Aug
24
answered How to use C++11 chrono header for a clock
Jul
20
awarded  Yearling
Jun
29
comment Why Android for new (micro) consoles?
@Byte56 This makes no sense: users will not see the difference between Android or whatever once on the console. Devs will not have any big difference in making their games for any of those. Again the question is why do they all do this, not why one choose it in particular.
Jun
29
comment Why Android for new (micro) consoles?
@Byte56 All your points are the same for several other platforms possible, including Linux. Why is that they all choose the same platform? It's certainly not because of an isolated decision specific to the consoles but because of something more important and global to all consoles.
Jun
29
asked Why Android for new (micro) consoles?