Arctangent2 without square rooting?

  • Thread starter sparkzbarca
  • Start date
  • Tags
    Square
In summary, the conversation discussed a problem with rotating one vector to be parallel to another and how to find the axis of rotation and angle using the cross product and arctangent. However, using the arctangent function can be intensive due to the square root involved. The speaker suggests exploring alternative methods, such as using rotation matrices, to avoid using the arctangent function.
  • #1
sparkzbarca
7
0
basically i have a problem where i am rotating 1 vector to be parallel to another

i get the axis of rotation by the cross product of the 2 vectors
the angle by the arctangent of the magnitude of the axis and the dot product of the 2 vectors

however

arctangent2(magnitude(axis) , dotproduct(vector1,vector2))

is quite intensive I BELIEVE BECAUSE magnitude is a sqr root.

i'm wondering if could just do some kind of axis squared and dot product square or something
and still get the right angle.

Hope this makes sense.
 
Physics news on Phys.org
  • #2
It would work, but atan2() is itself a pretty intensive function. I don't think the square root is the bottleneck here.

There might be an even cleverer option. Remember that rotation matrices are built out of sin() and cos(), so you don't actually need the angle itself! You just need sin() and cos() of the angle. So you can make the entire problem algebraic, if you do some preliminary work by hand to figure out how to do it.
 

1. What is the formula for calculating arctangent2 without square rooting?

The formula for calculating arctangent2 without square rooting is arctangent2(y, x) = 2 * arctangent(y / (sqrt(x^2 + y^2) + x)).

2. How is arctangent2 without square rooting different from regular arctangent?

Arctangent2 without square rooting is different from regular arctangent because it takes two input values (y and x) instead of just one, allowing for a more accurate calculation of the angle.

3. Can arctangent2 without square rooting be used to find angles in all quadrants?

Yes, arctangent2 without square rooting can be used to find angles in all four quadrants. It can handle both positive and negative values for both y and x, allowing for a wider range of angles to be calculated.

4. What is the range of values for arctangent2 without square rooting?

The range of values for arctangent2 without square rooting is -π to π radians or -180° to 180°. This means that the output angle will always fall within this range, regardless of the input values.

5. How is arctangent2 without square rooting used in real-world applications?

Arctangent2 without square rooting is commonly used in computer graphics and engineering to calculate the angle between two points. It can also be used in navigation and robotics to determine the direction of an object or movement based on its coordinates.

Similar threads

  • Linear and Abstract Algebra
Replies
8
Views
1K
Replies
14
Views
1K
  • Linear and Abstract Algebra
Replies
12
Views
2K
  • Introductory Physics Homework Help
Replies
14
Views
593
Replies
10
Views
725
Replies
7
Views
2K
  • Linear and Abstract Algebra
Replies
11
Views
2K
Replies
3
Views
1K
  • Electromagnetism
Replies
4
Views
806
  • Linear and Abstract Algebra
Replies
7
Views
1K
Back
Top