Overview ! Today Stroke Geometry ! HW3 ! Student Presentations ! Stroke Geometry CSE 490ra ! Thursday – NO CLASS ! Student group meetings ! Plan for early prototype Prototype Homework 3 ! Aim to have some working in two ! Tic-tac-toe weeks ! Pen based application that does ! Challenges something from your main scenario ! Simple Reco ! Use Thursday class period for group ! Geometry meetings to plan this out ! Harder than HW1 or HW2 ! Each group submit a plan by email to instructor by Friday night Stroke Representation Interpolation ! Sequence of packets ! Coordinates in HIMETRIC Units ! Sampled ~150 points / sec ! Fourth quadrant coordinates What is Points[6.4]? 1
Points[6.4] Interpolation Basic geometry p 2 ! Line segment ! (p 1 , p 2 ) p 1 ! Basic Test ! Left of p 3 p 2 ! CCW(p 1 , p 2 , p 3 ) p 1 Points[6.4] = 0.6*Points[6] + 0.4*Points[7] Counter Clockwise Test CCW Test Derivation ! CCW(p 1 , p 2 , p 3 ) ! Translate p 1 to the origin ! Rotate p 2 to x axis public static bool CcwTest(Point p1, Point p2, Point p3){ ! Check the y-coordinate of p 3 int q1 = (p1.Y - p2.Y)*(p3.X - p1.X); int q2 = (p2.X - p1.X)*(p3.Y - p1.Y); return q1 + q2 < 0; } Line intersection Distance ! Find intersection of (p 1 ,p 2 ) and (p 3 ,p 4 ) ! Dist(p1, p2) ! Q = α p 1 + (1- α )p 2 ! Sqrt((p2.x – p1.x) 2 + (p2.y – p1.y) 2 ) ! Q = β p 3 + (1- β )p 4 ! Solve for α , β ! Distance comparisons can be done ! Two equations, two unknowns without sqrt ! Derived points ! Dist(p, s) = min (Dist(p, q) for q in s) ! In general, try to avoid computing derived points in geometric algorithms 2
Center of Mass Convex hull ! Smallest enclosing ! Cm = Σ i P i /n convex figure ! Easy to compute “approximate” center ! Rubber band “algorithm” ! Diameter – maximum distance between pair of points ! Radius – distance to center of smallest enclosing circle Convex Hull Algorithms Gift wrapping Divide and Conquer 3
Recommend
More recommend