Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 5 years ago.
Improve this question
I believe this is a simple question.
Given I have a rectangle rotated 45 deg, what would be the correct method to calculate the distance of the blue line shown in the image?
It doesn't need to be language specific. Just interested to know in what is the arithmetic I should follow.
If your rectangle is rotated 45 degrees, then your distance is simply 1/sqrt(2) times 600px.
This is given by
a^2 + b^2 = c^2
Where a = b and is your blue line. C is simply 600 px. Simple algebra yealds:
2a^2 = c^2
sqrt(2)*a = c
a = c * 1/sqrt(2)
On the other side it would be 350 times 1/sqrt(2). Note this only applies to a rectangle rotated 45 degrees.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 3 years ago.
Improve this question
This is a follow-up question to this question.
Taking the following image as an example:
What I know:
x and y coordinates of points D, E, and P.
Therefore, I also know slope and intercept of D-E line
What I want to know:
x and y coordinates of point Q. (This is the point which crosses the D-E line).
Notation P=[px,py], D=[dx,dy], E=[ex,ey], Q=[qx,qy]
First:
R=P-D=[px-dx, py-dy]=[rx,ry]
K=E-D=[ex-dx, ey-dy]=[kx, ky]
Then
z=dot(R,K)/dot(K,K)=(rx*kx+ry*ky) / (kx*kx+ky*ky)
Finally
Q=D+z*K=[dx+z*kx, dy+z*ky]
The R is vector which start on point D and ends on point K, the K is vector which start on point D and ends on point E. Using this we made scalar projection to calculate result Q. More info about concept here
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 7 years ago.
Improve this question
At X minutes (say 360 mins) angle of gameobject is 0 degrees.
At Y minutes (say 1200 mins) angle of gameobject should reach 180
degrees.
My question is, what is the angle for each minute (X -> Y), so the gameobject updates its rotation based on the angle from the result, each minute.
Thanks in advance
I think it is not that difficult. You can easily find the distribution. Lets take actual duration which is 1200 - 360 = 840.
Actually the maths you can apply for such kind of problems is like,
X * 840 = 180
X will be the value which will multiplied 840 times to get the value of 180.
X = 180/840 => X = 0.214285
That'd be the per minute degree change in order to get 180 degrees in 840 minutes.
So you'd change the angle by 0.214285 degrees per minute in order to get it. :)
Similarly apply the same formula for any duration like, from 1000 to 1200, you can do it as,
1200-1000 = 200
180/200 = 0.9
So the new change in angle required per minute is 0.9.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 7 years ago.
Improve this question
Please forgive my lack of knowledge, which i think it's one of those basic formula related to Trigonometry.
Let's look at visual example:
I have 5 lines, with their line equation (let's say they have zero offset ok)
how can i calculate the Theta of each line equation make (in Pi)?
also I have seen this:
Are they generated from Theta of line equations? or it's another theory which help to find the theta?
much appreciate your time and effort
For equation
y = k * x
tg(Theta) = k
and
Theta = Arctg(k) //arctangent function
General line equation
A * x + B * y + C = 0
(It is more general than y=ax+b and includes cases of vertical and horizontal lines)
Theta = atan2(A, B)
(function atan2 or ArcTan2 exists in math libraries of many programming languages)
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 months ago.
Improve this question
Given (x,y) that is (3,4) , velocity is 1 m/sec and given angle is 15 degree. what will be next coordinate (x', y') after 1 sec ?
Anyone please help!
Assuming the angle is measure w.r.t. the x-axis, then:
the total distance is v*t = 1m
displacement in x-direction: cos(15)*1m=.97m
displacement in y-direction: sin(15)*1m=.25m
So the new location is (3.97, 4.25).
#Alexander-Vogt's answer is close but I think it is missing a conversion from angles to radians. Here is matlab code that provides the answer:
pi=3.1415926535897932384626433832795028841971;
x=3;y=4;
t=1; % time
s=1*t; % speed * time
a=15; % angle of movement
a=a/360 * pi*2; % convert to radians
x=cos(a)*s+x;
y=sin(a)*s+y;
fprintf("%f %f\n",x,y);
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to rotate a plane represented by the equation z = 6 , by n degrees along y axis and find the new equation of the plane. how can this be done?
Thanks
Base point (0,0,6) after rotation will lie in XZ plane with coordinates
(x0, y0, z0) = (-6*sin(Fi), 0, 6*cos(Fi))
normal vector
n = (A,B,C) = (-sin(Fi), 0, cos(Fi))
so new plane equation is (for explanation see beginning of the article)
A*(x-x0)+B*(y-y0)+C*(z-z0)=0
or
-sin(Fi)*x + cos(Fi)*z - 6 = 0