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
I got the orange rectangle below from the black points and their coordinates, I'd like to straighten up that rectangle just like the green one, is there an equation for this? (I always want the long side to be at the bottom)
Yes, it's a simple 2D rotation:
P' = T*P
where
| cos(theta) -sin(theta) |
T = | |
| sin(theta) cos(theta) |
The signs I chose assume positive theta (in radians, of course) means a counterclockwise rotation using the right hand rule with the z-axis pointing out of the page. A clockwise rotation, as shown in your diagram, would be the transpose of the matrix: switch the signs of the off-diagonal sine terms.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
For a given Xp,Yp and angle a inside a rectangle with (width = Xm, height = Ym) i need to find all distances d_angle (with angle between 0 and 359). I found a solution but it is too complicated. Maybe there is a simpler algorithm to find it in python or c++!
To check whether point P lies inside rectangle R:
if (P.X <= R.Right) and (P.X >= R.Left) and (P.Y <= R.Top) and (P.Y >= R.Bottom)
and note that math libraries of many programming languages contain function like PtInRect
You can find the azimuths of the four corners from the given point Xp, Yp, let a, b, c, d. These define four angular sectors that "see" the four sides. (To handle angle wraparound, consider the sectors [a, b), [b, c), [c, d) and [d-2π, a)U[d, a+2π)).
Now the distance to the right vertical side X=Xm is (Xm - Xp)/cos Θ. There are similar formulas for the other sides.
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
I have a camera I'd like to mount on a tripod. I know the FOV dimensions of the camera (22.5 deg V 31 deg H). I'd like to know at what height and what tilt angle to place the camera to be able to capture the two points of interest on the ground. Please see the figure below.
I have attempted a solution using basic trig but am not sure it is correct. Please help!
Your calculations are correct in my view.
If you have to include both the red points, you need to place your camera at an angle such that it encloses both the red points.
So, tan θ = d/hc
=> θ = tan -1 d/hc.
But, as you need to enclose both the points, your angle should be slightly greater than θ ( my suggestion --- some θ+ε, where 0.25 < ε < 1 ) to perfectly capture those 2 red dots.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Improve this question
I have no much time to research net, so can somebody derive the formula for calculating the point belonging to the circle?
as u can see we have point 5,-5 and center, and radius and angle. Thanks for advance, i know that isnt programming problem, but I need this to my project. OFC I see thats point 1,-1. but my pc probably will not ;/
For points inside the circle with radius R and center X,Y:
point (x,y) is inside the circle if:
(X-x)^2+(Y-y)^2 < R^2
Is that what you're after? No.
So what you need is a translate - rotate - translate.
So X,Y is the centre, x,y is the point and angle is the angle in degrees
# Translate
x = x-X ; y = y-Y
# Rotate
rad = angle*M_PI/180
xr = x*cos(rad) + y*sin(rad)
yr = -x*sin(rad) + y*cos(rad)
x = xr+X ; y = yr +Y
So if you only want 90 degrees, replace cos(rad) with 0 and sin(rad) with 1.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
This question does not appear to be about programming within the scope defined in the help center.
Improve this question
I have a problem it is like trig and pre calc. We are given vector points for OA which is (6 0) and vector OB (-6 0) and OC (5 root11) and they are all points on a circle with a radius of 6. How exactly do you determine or show that these points lie on the circle?
For any three points which are not mutually co-linear, there is a point equidistant from each member of the set. Finding this point given three arbitrary points (and not given the radius) is a much more informative project if you're learning trigonometry.
In your example, the solution is simple: x2 + y2 = r2. Each of the points you provided have values such that the sum of their squares equals 36, as expected for a circle of radius 6. Your problem is especially easy because the circle in question is already centered on the origin.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm working on a problem, wherein a sphere of known radius is dropped vertically and strikes the edge of a cup. I need to figure out the angle of deflection, which will be a function of where along the sphere contact occurs. I.e., if the contact point is dead-center (the pole), the angle of deflection is 0. The further from the pole that contact is made, the larger the deflection angle.
In the formulation of the entire problem (this is just part of it), I'm strictly using the projection onto the x-y plane, so the only information I have is about the projected circles. I know the location of the center of the ball-circle and cup-circle, their radii, and the size of the (downward projected) overlap.
I can compute the angle of deflection, if I only have the length of the chord from the pole to the contact point. How can I get the length of this chord, working from the x-y projection givens? The attached image shows some of how the problem is formulated.
Answer duplicated from my correct repost on math.stackexchange.com
Thank you very much to my friend Dr. Andrew McHugh for helping me see the solution. I overlooked that I can compute the angle theta by knowing the horizontal distance (X) from the lip of the cup to the ball's vertical axis. Theta is then the arcsin of the ratio of X to the radius (r). In the x-y plane projection, X is the radius - the line connecting the cusps of the overlapping lenticular area (d). Hence, theta = arcsin((r-d)/r).