cs220 final presentation - science.smith.edu€¦ · cs220_final_presentation.pptx author: alex...
TRANSCRIPT
Crea%ng Synthe%c Traces
Betsy Cowdery & Alex Cheng
Set a maximum distance between points All black points represent the original points in the KML file.
Since none of the red circles (which represent a 4 meter radius around each point) intersect, the program could falsely assume that the two paths do not intersect.
To remedy this problem, we go through each KML file and for every two points that are more than 4 meters apart, we add a point in between those two points (new points shown in blue). Do this un%l no two points are more than 4 meters apart.
Note: all points are rough es%ma%ons!
For purposes of simplicity of the diagram, we only added the necessary points on the A path. Now, there is a blue dot on path A whose 4 meters radius intersects with a dot on path B’s 4 meters radius. This means there is an intersec%on between the two paths.
We draw an average point between those two points and call it the intersec%on. The averaged intersec%on is in yellow – the actual intersec%on is in green.
Given points A and B, we are trying to figure out whether there are any points lying within 4 meters of the line AB. This means we need to figure out whether any points are lying within a 4 meter radius of points A and B, and whether any points are lying within a 4 meter distance of any point on line AB.
A B
4 meters 4 meters
However, looking within two circles and a square for every point is too complicated.
So we chose to look for poten%al intersec%on points within the circle of radius 3x/2 centered around the midpoint between points A and B
The payoff is that we will be looking at more space than necessary.
€
3x2
A B
A B
Once points within the circle have been found, we have to look for the points that come before and aYer them in the path to see if either of these line segments intersect the line AB.
For example point N is connected to two different line segments that cross AB: The line N N+1, and the line N-‐1 N
N-‐1
N
N+1
Determine if an Intersec%on Exists
A
D
B C
A
D
B
C
Pretend that we are walking along the line segment AB: If the line CD crosses AB, then at the end of AB, we will have to turn leY to get to C and right to get to B. However, even if this condi%on is sa%sfied, it only ensures that CD could cross AB. To prove that an intersec%on exists, repeat the same process except this %me walking along CD. If you have to turn leY to get to A and right to get to B, then we know that the two line segments cross.
A
D
B C
Now we know that an intersec%on exists! But where is it?
A’
D’
B’
C’
Translate the system so that point A is on the origin.
A’
C’’
D’’ B’’
I’’
Rotate the system so that point B is on the posi%ve X axis. Discover the posi%on of the intersec%on point along line A-‐B.
(1)
(4) (3)
(2)
A’
D’
B’ C’ I’
Reverse the algorithm to move the intersec%on point back to line AB
Intersec.on
A
D
BC
Reverse the algorithm to move the intersec%on point back to line AB
Find the exact coordinates of the Intersec%on
A’
D’
B’ C’
Translate the system so that point A is on the origin.
Find the exact coordinates of the Intersec%on
A’
C’’
D’’ B’’
I’’
Rotate the system so that point B is on the posi%ve X axis.
Discover the posi%on of the intersec%on point along line A-‐B.
Find the exact coordinates of the Intersec%on
A’
D’
B’ C’
I’
Reverse the algorithm to move the intersec%on point back to line AB
Find the exact coordinates of the Intersec%on
Intersec.on
A
D
B C
Reverse the algorithm to move the intersec%on point back to line AB
Demo #1
Use this intersec%on to generate two new paths
Intersec%on
New Path #1
New Path #2
Original Path #1
New Path #1
Demo #2