Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double ut, un;
- n.x = (p->x) / c->r; // p - точка пересечения с окружностью, c - окружность, c->r радиус
- n.y = (p->y) / c->r;
- t.x = -n.y;
- t.y = n.x;
- ut = (u->x * t.x + u->y * t.y) ; //u - старая скорость по x и по y
- un = (u->x * n.x + u->y * n.y) ;
- u->x = ut * t.x - un * n.x; // теперь она стала новой
- u->y = ut * t.y - un * n.y;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement