Sunday, May 25, 2014

180 degree vision

I took a video panning the camera from left to right and took the very middle column of each frame of the video and stitched them to make this. it's like you can see 180 degrees...

Tuesday, May 20, 2014

Rectangle billiard solution

Suppose you have a table and a linear paramterization for a ball on the table...

These equations tell you where on the table you'll be after time t, if the ball is thought to bounce off the walls as on a billiard table, where X and Y are the width and height of the table.

So it's interesting that with these equations, one can calculate directly the x,y position of the ball at, say,  time = 12845 without figuring out where it was at every time before that. 
Here is a plot of one example:

There is a field called dynamical billiards that studies more complicated ones, but for some reason they didn't give this nice solution to the rectangular one on wikipedia:, I guess physicists are more interested in the ones that become chaotic.

Sunday, May 18, 2014

complex angle

Consider the following, you first go 6 steps in the 1 direction and then 3 in the i direction:
So you divide the corresponding complex number by the total number of steps to get the complex angle.  Note that any similar triangle to this one in the same quadrant, like say (10+5*i)/15 equals the same complex angle. Also note that the complex angle preserves the quadrant the triangle is in. For negative x and positive y, for example, the complex angle will always be of the form -a+b*i, and so on for the four quadrants. 

Thursday, May 15, 2014

bank shot

I read about this on a pool site but they didn't have a picture so I made this one, you aim for the reflected pocket on an imaginary pool table lying beside the one you're on to make the bank shot...

Sunday, May 11, 2014

Tell whether a point is inside a polygon by reflection

I noticed if you have a convex polygon like so:
You can reflect this polygon across a point, in this case G...
And anytime G is outside of the original polygon, the polygons won't intersect...
But if G is inside the original polygon the reflected polygon will overlap:
So since there is an easy way to tell whether two lines intersect, one can look pairwise at every line and check for intersection to find whether g is inside the original polygon. It should also scale easily to 3 dimensions.
A much faster way computationally than checking every pairwise intersection as I mentioned before, is to take your polygon with centroid marked as F:
Reflect across the test point G as before:
Now consider the parameterization of the line from F to F(1), if that line crosses a line in the original polygon first, then G is outside of the polygon. Or conversely:
If the parameterization crosses a line in the reflected polygon first or does not cross a line from either polygon as, G is inside the original polygon. If the parameterization is in terms of S, this would mean the crossing with the original polygon has a higher S value.  This takes the algorithm from having to check intersections of N^2 lines to just 2*N.