Download Examples - AlgoGeom.org

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Line (geometry) wikipedia , lookup

Transcript
Week 1
Learn to program simple Java algos, automating familiar
math concepts
Example: As the mouse is being dragged around the screen, calculate its distance
from a fixed point of your choosing. Stream text results to console window.
Start by writing a general method for computing the distance between 2 points.
Your Java might look like this (don’t sweat the details, we’ll teach you):
//******************** distance function *******
public static double distance (Vec2 p1, Vec2 p2) {
double dx = p2.x - p1.x;
double dy = p2.y - p1.y;
return Math.sqrt(dx*dx + dy*dy);
}
Week 12
Your library of 2D objects and algos is about 80% complete -- you’re
applying it to solve problems this complex
Example: Two overlapping circles intersect at two points. Given
[ center radius ] for each circle, calculate the 2 intersection points
y
C2
x
C1
Solution sketch might look like this
i1
newOrigin
i2
C1’
translate
coords
C2’
y’
i1 ’
A little algebra will solve this
easier version of the problem!!
newXaxis
i2 ’
x’
C1’’
y’’
i1’’
C2’’
x’’
rotate
coords
i2’’
Java might look like this: (Don’t worry about understanding Java syntax…we’ll teach you!
//******************** intersection Points Of 2 Circles ****************************
public static TwoPoints intersectionOf (Circle C1, Circle C2) {
if (C1.degenerate() || C2.degenerate()) return null; // need good data
// ask HELPER function for NumIntersectPts
int n = Circle.numIntersectionPts(C1, C2);
if (n == 0 || n==3) return null; // no intersection points to compute
// there are 1 or 2 intersection points
// transform into easier-to-solve case, where C1 is at origin, and C2 out on + x-axis
Circle C2_p = C2.coordTranslate(C1.c); // shift C2 into C1-local coordinates
DirVec2 C1_C2_dir = new DirVec2(C1.c, C2.c); // direction going from C1  C2
Circle C2_pp = C2_p.coordRotate(C1_C2_dir); // rotate coords putting C2_pp on x-axis
…
You’ll have written these functions BEFORE starting into this problem:
C1.degenerate()
Circle.numIntersectionPts(C1, C2)
C2.coordTranslate(newOrigin)
C2_p.coordRotate(newzXaxis)
so writing your algo is like putting together a lego toy…you just put the pieces together.
You understand what each piece does, since you developed and tested it yourself earlier!
The sketch is your high-level plan saying how to assemble the toy!
Translating your sketch into Java code will become a routine at some point…you’ll know how.
Week 25
Your 3D library is now chock full of goodies, and your head is
brimmin’ with a whole new understanding of 3D geometry
You can now solve problems like this….
A 3D circle pierces through a sphere at 2 points….write an algo that
computes their intersection points i1 i2
SPH
i2
CIR
i1
Given
SPH = [ c r ]
CIR = [ c orient
Compute Results
r]
numIntersectionPoints ( 0, 1, 2, ∞ )
point locations
i1 i2
Once this is solved, you’ll know how a GPS receiver works in 3D!
You’ll spend lots
of time in a
3D workspace
You’ll test your
circle-sphere
intersection algo
in this space
Week 33
Paydirt. We’ll coach you through your choice 3D projects, any of
which will impress the pants off your college profs & job interviewers
Pick any 2
•
•
•
•
•
•
•
3D wireframe graphics (moving viewer)
robotic gas station attendant
CAD rendering of pipe outlines (moving viewer)
computer vision
optical ray tracing (reflection and refraction)
molecular brownian rotation
interstellar navigation (camera-based star-tracking)
We get you this far this fast due to new, simplified geometry theory, and turning
your laptop into an extension of your brain…your personal math slave.
AlgoGeom - an intellectual adventure that will last a lifetime.
Course pacing estimates based on 4.1 hours per week.