I am trying to programmatically find the point created from rotating a vector around it's origin point (could be anywhere in 2D space).
We see that we have our line (or vector for the math) A at some point of (x, y) that might be anywhere in 2D space. It runs to point B at some (x, y). We rotate it by Theta which then moves to some point C at an (x, y). The problem for me comes with trying to programmatically use math to solve for such.
Originally the thought was to form a triangle and use trig but this angle could be exactly 180 (unlikely but possible) which obviously no triangle can work. Would anyone have ideas?
I am using C# and my own vector object (below) to test out the creation of lines. Any help is appreciated!
struct Vector2D {
double x, y, theta;
Vector2D(double x, double y) {
(this.x, this.y) = (x, y);
theta = x != 0 ? Math.Atan(y / x) : 0;
}
double Magnitude() {
return Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2));
}
(double,double) PointFromRotation(double angle) {
// This is where I need some help...
return (0,0); // hopefully a point of x and y from the angle argument
}
}