xhae@STARTLINK LIVE
2016. 02. 12
They're both programming!
void main() {
input();
process();
output();
}
dist
P1
P2
double dist = (P1 - P2).size();
dist
P1
P2
double dist = (P1 - P2).size();
double theta = acos(R / dist);
theta
theta
R
dist
P1
P2
double dist = (P1 - P2).size();
double theta = acos(R / dist);
Point base = (P1 - P2).resize(R);
theta
theta
base
R
dist
P1
P2
double dist = (P1 - P2).size();
double theta = acos(R / dist);
Point base = (P1 - P2).resize(R);
Point ans[] = {P2 + base.rotate(theta),
P2 + base.rotate(-theta)};
theta
theta
base
base.rotate(theta)
base.rotate(-theta)
struct Point {
double x, y;
Point operator – (Point arg) { return Point{x – arg.x, y – arg.y}; }
double size() { return hypot(x, y); }
Point resize(double newSize) {
double ratio = newSize / size();
return Point{x * ratio, y * ratio};
}
Point rotate(double theta) {
return Point{x * cos(theta) – y * sin(theta),
x * sin(theta) + y * cos(theta)};
}
};
Much more similarities to go!