spherical geometry algorithm for astronomy (moving a telescope) - geometry

I cannot get my head around the maths / geometry for this, but I am sure there is a simple (ish) algorithm for this.
Trying to control a telescope on alt/azimuth, and I need to sole the following problem.
I know my lat/long - I definately know where my house is.
From this, I know what angle polaris / centre of rotation of starfield is at, and what bearing.
I know how long an astronomical day is in secs, so how long one full rotation of starfield will take.
I want to calculate how much a given point in the sky will move (in say one second) in terms of delta-x (rotation of scope horizontally, azimuth), and delta-y (elevation of scope in degrees, altitude).
I know which point in sky I am looking at as I have compass and inclinometer readings from device on my scope.
A star close to polaris in view will move only a small dx and dy as
it tracks a small piece of sky. A star moving from due east to due
west will track a much larger path in sky, as it sweeps over the
largest track. A star much more southerly will track reducing
amounts of dx and dy.
Does anyone know how to compute dx and dy given lat/long, direction and elevation of scope ?

Yes there is an algorithm and I can even get you a open source code to do that. You just have to explore the Toshimi taki (japanese amateur astronomeur & programmer) website:
Toshimi Taki Website!

Related

Predicting Future Location of Soccer Ball Rolling on ground

the question might seem simple, but I am unable to find the best reference for it. Using ODE force function, I am able to apply force to a ball's COM and the ball starts rolling. It stops after a few seconds. The distance travelled depends upon the force. However, I am looking for algorithms that can help to predict the actual ball location after specified time 'x'. Note that the ball moves in 2D and I need to figure out the x and y coordinates of ball after lets say 1 second. Velocity and initial coordinates are given.
Please suggest algorithms that can do it precisely. the newton velocity acceleration relation only works for shorter prediction time as they depend on linear velocity component.
Please help

Possible to find velocity of person in video or camera using openpose

Question is, I want to calculate the speed of my arm for Slap detection. So I am using openpose to get the body points (here total points: 25) using body_25 model and using this along with the time I want to deduce the speed of my arm, i googled through openpose, stackoverflow, github.But could not succeed?
Velocity = Distance / Time = dx/dt
dx = frame3_bodypoints - frame_1_bodypoints;
dt = ?
I don't know how to find this from the openpose, is there a way I can find this? Any thoughts, would be great help!
I've never used OpenPose. But Newtonian physics would indicate that a slap corresponds to a sudden change in velocity of the hand.
I think it's a reasonable first approximation to assume that the Δt between frames is constant. Instantaneous variation in frame rate is called jitter. I would expect jitter to be small for modern recording devices. In any case, I don't know how to get instantaneous frame rate with the tools (OpenCV, PIL) that I am familiar with. I couldn't find any references to frame rate or time in the OpenPose docs.
For calculating velocity and delta-velocity, you have choices. Straight up linear velocity of the hand might be the easiest. For position changes use the geometric mean of positions (Δs = sqrt((x2-x1)^2 + (y2-y1)^2).
You could also calculate an angular velocity between the hand and the elbow, but that would be a little more involved and prone to noise.

Calculating surface fragments (continents) on an expanding sphere (Earth)

Let's suppose plate tectonics is wrong and our planet Earth has expanded over time, the continents being the remnants of a crust that once covered the entire surface of a smaller planet, the oceans floors being extruded mantle, a manifestation of expansion.
http://earthexpansion.blogspot.com/2011/02/earth-expansion-synoptic-simplicity.html
http://earthexpansion.blogspot.com/2011/02/synoptic-simplicity-again.html
It is difficult to visualize how everything would have looked like on a smaller Earth. Well, some people have made visualizations, but what about calculations?
Unfortunately, my experience is exclusively in Boring Business Brogramming. So when thinking about whether a development such as the Americas swiveling open to accommodate the Pacific is possible, I don't even know how to approach this problem.
Given today's Earth and geometrical data - a sphere (kind of), surface fragments (continents, polygons?) - would it be possible to retro-calculate the Earth to a smaller size, considering certain constraints (continents cannot be arbitrarily deformed) in order to find out whether a given movement story for expansion makes sense geometrically?
How would you go about doing it? Concepts, approaches? Tools, techniques? Sources for geo data?
Update
An important factor to take into account in reverse engineering the Earth to a former continental configuration on a smaller planet is the age of the ocean floors as measured by the U.S. Navy and others. As you can see on the map, the ocean floor is very young everywhere as compared to the continental crust. Moving back in time and deflating the planet, the youngest ocean floor stretches (red, at the spreading ridges) will have to be removed first because we know they weren't there.
So these measurements significantly constrain the problem of surface reconfiguration on a shrinking sphere. Still, I'm clueless as to the geometry to use in such a problem.
From how I understand your problem, the surface areas of all today's continents would be the same in any given time, while the total surface area of Earth would shrink as you move back in time. Right?
So the question is whether the continents can be placed on the Earth so that their total surface area does not exceed the total surface area of Earth for that moment in time. And there are some constraints to this problem: you cannot make the continents jump from one hemisphere to the other in a short period of time, for example. So you'd have to take the incremental movement of continents into account.
Tricky one. The closest problem that's related to this is probably Algorithm for fitting 2D polygons in an area? But the additional possibilities (like breaking a continent into several pieces, if that's allowed by that theory) makes it a pretty hard one.

Arkanoid Collision Detection... Again

I have read dozens of questions here on SO (and not only) regarding arkanoid collision detection, namely, moving circle collision against a stationery rectangle, but all of them ask how to detect a collision or how to detect which side of the rectangle the ball hits. My question is a bit different - it concerns the calculation of the new speed direction in case when the ball hits the angle of the rectangle.
For simplicity's sake let's assume that Vx >= 0 and Vy <= 0, that is, the ball is coming from the below from the left upward and rightward and also suppose I know it's gonna hit the lower side of the rectangle. The green arrow shows the approximate direction of the ball and the blue dot shows the first point on the line containing the lower side of the rectangle that the ball hits. If that point lies strictly within the lower side of the rectangle then all is trivial - just change Vy to -Vy. However when that point lies outside the lower side it means that the first point of the rectangle that the ball will touch is going to be its lower-left corner, in which case I don't think that changing the Vy to -Vy is correct. I think that the new velocity angle must be dependent on the distance of the blue point to the corner. Also I think that not only Vy but also Vx must change (preserving, possibly, the length of the V vector).
So, how do we calculate the new Vx and Vy when we hit an angle? If you know any good links that address this question I'd be delighted to know them. Also note that I am more interested in the absolute physical model of this rather than easy-to-code optimized approximations. You can assume there is no rotation involved. Thank you very much in advance
You know how to bounce off a horizontal wall. Do you know how to bounce off a wall that is at some other angle?
When the circle hits the wall, it makes contact at a single point. That single point is all the circle "knows" about the wall; the location of that point gives you enough information to calculate the new V. When the circle hits the corner, it makes contact at a single point (i.e. the corner) so it bounces just as if it hit a wall at that point.
Is that enough to go on, or would you like some math? (And if so, how comfortable are you with vector algebra?)
A simpliciation that is often made when modelling rock blocks in rock mechanics is to assume that the corner of the rectangle has a small radius. The calculation is then one of two curved surfaces contacting. This approach tends to give more consistent behaviour than modelling corners as right angles an so is preferred where consistent results are needed.

Trigonometrical ratios for angles higher than 360

Is there any use of Sin(720)or Cos(1440) (angles in degrees)?
Whether in computer programming or in any other situation?
In general, is there any use of Sin/Cosine/Tan of any angle
greater than 360?
In Physics we do use dot products and cross products
a lot, but even they require angles less than 180 degrees
always.
Hi All,
I know how to compute them....
I want to know, if they are ever useful????
When will I ever encounter a situation, when
I need to compute Sin(440) for example???
Both in math and programming:
Sin(x) = Sin(x % 360)
As another answer pointed out, angles greater than 360 represent one or more full rotations over a circle plus the modulo part. This could have a physical meaning in some circumstances.
Also, when doing trigonometric calculations, you should take this fact into consideration. For example:
sin(a)*cos(a) = (1/2)*sin(2a)
For a>180 you will get the sin of an angle greater than 360.
By the way, have a look here.
I have seen such things come up when doing angle arithmetic:
float angleOne = 150;
float angleTwo = 250;
//...
float result = Sin(angleOne + angleTwo); // Sin(400)
float result = Sin(angleOne - angleTwo); // Sin(-100)
In this (contrived) example, it seems obvious, but when you are computing an angle based on arbitrary rotations of several objects, you can't always know what kind of numbers you would be getting. Imagine calculating the poisition of the player in a 3D game while he is standing on top of a spinning platform, for example.
Any time you're dealing with a user interaction technique, it's entirely possible that they'll push you past 0 degrees or 360 degrees. Imagine that you're making a game with a gun turrent. It's currently pointed at 359 degrees and the user yanks the joystick to the right: now it's pointed at 361 degrees. If you implement the angular representation wrong, all of a sudden, the gun with rapidly traverse nearly 360 degrees to the left.
I predict that the users will be ... disappointed with that bug.
There are all sorts of issues that come up with Euler angle representations of the frame of reference that are important in games, simulations and real device control. Gimbal lock is a serious problem in actual rotating device control (it was a problem with camera pan / tilt devices in my life). The "rapid rotation" bug was a very nasty issue in a small boat autopilot system once upon a time - imagine wrapping a steel cable very tightly around the wheel house (i.e., you don't want to be standing there).
There have been times where the normal math means you end up "traversing the circle" one or more times, and if you keep the math simple your angles might be greater than 360. Personally I like to normalize the angles to be 0 to 360 or -180 to 180 after such operations, but it's doesn't really matter much.
Sometimes the greater number might really represent something. To take a trivial example, imagine instructions to open a classic dial combination safe. You need to spin the dial around a couple of times, so the instructions could be:
turn(800); // Twice around plus another 20 degrees
turn(-500); // Once around the other direction plus 140 degrees
turn(40); // Dial in the last digit
In that context, taking the sin or cos would tell you something about the ultimate position of the dial, but you would lose the information about how many turns were involved.
One rotation around a circle is 360 degrees or 2pi radians.
Trigonometric functions such as sine and cosine will "wrap around" when they reach 360 degrees and act the same way as being at 0 degrees. Basically, the following occurs:
angle_in_unit_circle = angle mod 360
Also, some trigonometric functions such as tangent are not defined at certain angles, such as 90 and 270 degrees, where tangent of an angle will return a positive or negative infinity.
This "wrapping" around can be seen by representing the sine, cosine, tangent functions using an right triangle inscribed in an unit circle, and this behavior makes those functions periodic because they will repeat their patterns over and over again.
Wikipedia has an extensive article on Trigonometric functions, so that might be worth taking a look at.
Usage
In terms of use, I can't quite think of a good example off the top of my head, except, maybe perhaps to represent a location of a particle at a certain time in a polar coordinate system, where the angle θ is dependent on time t:
r(θ(t)) = t where θ(t) = t
for values of t from 0 to 720, which could then be represented in a Cartesian coordinate system as:
x(t) = r sin(θ(t)) == t sin(t)
y(t) = r cos(θ(t)) == t cos(t)
The particle will be moving in a spiral type movement, dependent on the time t. In this case, the sine and cosine of angles beyond 360 will be calculated.
(And my math is rusty, so if there are any errors in the equations above, please let me know!)
On a sine curve, Sin(720) == Sin(0) (etc), so I'd expect any decent implementations of those functions to handle degrees "greater than" 360. There's any number of reasons for arriving at an angle greater than 360 or less than 0.
Angles outside the range of "principal angles" [-180,180) are essentially aliases of each other (modulo 360 degrees) and have no physical distinction.
From a mathematical/engineering sense, if you have a process where the # of rotations is important and must be kept track of (e.g. a motor that is spinning back and forth), then 0 degrees and 720 degrees are not the same. Sine and cosine are just periodic functions so they have the same value every 360 degrees. If you have a particle undergoing uniform circular motion where x(t) = A cos (ωt + φ) and y(t) = A sin (ωt + φ), then the phase angle θ = (ωt + φ) is going to be whatever it is, whether 0 or 720 degrees or 82144.33 degrees or whatever.
So the functions cos(θ) and sin(θ) just get used to calculate the x and y coordinates, no matter what the value of θ is. It's not like you have a choice in the matter, if θ is 82144.33 degrees then you're going to want to calculate the sine and cosine of that angle.
I play a PC game called Garry's Mod, and there are moments in the game where, when programming, I want a simple solution to keep an object constantly moving in a constant circle. To do this I use the sine and cosine of a forever increasing timer, measuring the amount of time since the game launched.
The sine of T (time) is equal to the orbit paths X value, while the cosine of T is equal to the orbit paths Y value(X and Y being on a 3 dimensional coordinate plane with Z not being used at the moment.)
Example:
T=1000 ticks
X=sin(T)
Y=cos(T)
So X is 0.8268795405320025 during that moment in time and Y is 0.15466840618074712.
Now let's say the amount of time grows to 1500. X would be -0.9939019569066535 and Y = -0.11026740251372914.
In a nutshell, it would constantly fluctuate from 1 to -1, leaving me the opportunity to multiply that value by say 100, and making the coordinate plane local to my characters position, then I can tell the programmed expression to move an object based on those coordinates and it would move in a constant circular path around me.
Tada. Who says you can't learn from video games?
Because sin(x) = sin(x mod 360°) and cos(x) = cos(x mod 360°) you can use every value in calculation, but you could also normalize to the range [0°,360°) or any other range of 360°. It just depends on the usage if large angles have a well defined meaning or not.
Processors will likley normalize the calculation to just a range of 90° or even less, and derive all other values from this small range.
When will arguments greater than 360° occur?
They naturaly occur in simulations of periodic time or space dependent functions.
Your question does not make much sense seeing as you seem to know the difference here:
No - you will never have to "compute" Sin(720), anymore than you will have a need to "compute" Sin(0). You need to look at the definition of the Sinus function to fully understand what goes on under the covers - and when that is understood it makes total sense for anyone as to why Sin(0) = Sin(720) - there's nothing magical going on, there's (logically) no Angle = FullAngle % 360 going on, it's all in the definition of what the function is supposed to do.
See wikipedia
#dta, I think folks are a little confused. You ask if it's ever "useful." I'd say "It doesn't matter, because you just shift the angle to the proper range when performing the calculation." There are certainly cases where you need to know how far from 0 degrees an object has rotated, accounting for multiple rotations. But aside from those cases, it's more convenient to interpret angles in the normal 0-360 range. Most people build up an intuitive feel for which direction corresponds to angles in that normal range. What direction does 170,234 degrees point? The same as 314 degrees.
As #Chris Arguin and others said, whether sin of an angle greater than 360° (or for that matter less than -360°) is useful to you depends on whether you need the information about rotations (or fractions thereof) that is represented by the difference between angle and angle%360°.
Also, since you get the same answer, you'll save a little processing time if you call sin(angle) instead of sin(angle%360), especially if you are doing many computations in a loop.
OTOH, #Scottie T makes a good point that if it is important for someone to know where around a circle your angle points, people can generally intuit position of an angle with an absolute value of 360 or less easier than they can for larger angles.
There are many circumstances where angles outside of [0,360] are needed. I like the idea of a combination lock. Here one will often see both positive and negative angles outside of the simple [0,360] degree range.
Multiple angle formulas are often important in mathematics. Trig functions are used in places other than just triangles. They appear in a variety of places, Fourier series for example, or image compression schemes, or the solution of differential equations. Computationally, it is true that you can always use mod to reduce the range for a trig function to the default. But it is rarely true that angles will always be provided in that nominal range.
There definitely can be times when you might end up with an angle measure > 360 degrees because of some kind of calculation...but it would be identical to an infinite number of other angle measures, exactly one of which will be between 0 and 360. However, if you are coding a function, you should be able to handle this calculation yourself...not rely on the user to do the mod for you.
ie While it is true that sin(370) == sin(10), and the user could do this translation themselves, they may not want to for one reason or another (see the "bolt" example in the comments for the top rated answer), and so the function should be able to handle any value.
Angles higher than 360 degrees are also used e.g. to describe snowboard tricks:
http://en.wikipedia.org/wiki/List_of_snowboard_tricks#Spins
So you see, there are various real world example where you use higher angles to describe the rotation of an object.

Resources