Ejemplo n.º 1
0
        public static bool FromThreePoints(Vector2 a, Vector2 b, Vector2 c, out Circle circle)
        {
            Line2D lineA = LineSegment2D.GetBisectorFast(a, b);
            Line2D lineB = LineSegment2D.GetBisectorFast(b, c);

            if (Intersect.Lines(lineA, lineB, out circle.center))
            {
                circle.radius = Vector2.Distance(circle.center, a);
                return(true);
            }

            circle = default;
            return(false);
        }
Ejemplo n.º 2
0
        public static bool FromPointTangentPoint(Vector2 startPt, Vector2 startTangent, Vector2 endPt, out Circle circle)
        {
            Line2D lineA = new Line2D(startPt, startTangent.Rotate90CW());
            Line2D lineB = LineSegment2D.GetBisectorFast(startPt, endPt);

            if (Intersect.Lines(lineA, lineB, out Vector2 pt))
            {
                circle = new Circle(pt, Vector2.Distance(pt, startPt));
                return(true);
            }

            circle = default;
            return(false);
        }