I need to convert latitude and longitude values to a point in the 3-dimensional space. I\'ve been trying this for about 2 hours now, but I do not get the correct results.
you're not doing what wikipedia suggests. read it again carefully.
they say:
x = r cos(phi) sin(theta)
y = r sin(phi) sin(theta)
z = r cos(theta)
and then:
theta == latitude
phi == longitude
and, in your case, r = radius + altitude
so you should be using:
r = radius + altitude
x = r cos(long) sin(lat)
y = r sin(long) sin(lat)
z = r cos(lat)
note that the final entry is cos(lat) (you are using longitude).