In 2D everything is easier to understand. I'm not enought experienced to join people who say that 3d is the same: you JUST need to add a dimension - THAT adding a dimension is my problem, bacause I can't easily visualize (or draw on paper) the situation I'm dealing with. So please don't say it is the same.
First let's talk of a concrete situation.
Use case: bounding sphere intersection
I have two entities colliding with theirs bounding sphere intersecting at a certain point. Let's consider two vectors, the velocity of the first entity
v1 and distance between boundingsphere centers
d. If I want to get
v1 component along
d I may want to do
V1 * Math.Cos(alpha)
alpha = Math.Atan2(...)
a. My questions come now.
Math.Atan2(...) takes 2 arguments, the
first is the difference between Xs and second is the difference
between Ys of the two vectors involved. So, since I'm working in 3D
and not in 2D, should I assume that common practice is to consider a
pair of dimenstion at time when dealing with angles in 3D? Since I'm
a bit confused here, can someone tell me what's the best practice to
follow in this case? (details would be appreciated here).
b. Then I have some information I'd like someone to confirm. When my
double angle value is returned from the
Math.Atan2(...), I have my
angle in radians. I read somewhere that this float value varies
+- Pi, reasonable. And also that
consider the lesser between the 2 angles, which is not important if
you need to calculate
Cos(angle) but you must keep it in mind if
you wants to get the
Sin(angle). Is this how things work?