Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void SetupCircleParams() {
- Vector2 p1 = point1.anchoredPosition;
- Vector2 p2 = point2.anchoredPosition;
- Vector2 p3 = point3.anchoredPosition;
- Vector2 v12 = p2 - p1;
- float ma = v12.y / v12.x;
- Vector2 v23 = p3 - p2;
- float mb = v23.y / v23.x;
- float cx = ((ma * mb * (p1.y - p3.y)) + (mb * (p1.x + p2.x)) - (ma * (p2.x + p3.x))) / (2 * (mb - ma));
- float cy = ((-1f / ma) * (cx - ((p1.x + p2.x) / 2f))) + ((p1.y + p2.y) / 2f);
- circleCenter = new Vector2(cx, cy);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement