I’d like to know if there’s a formula for finding the center of a circle from two vectors.
For example, with a vector (2,4) and a vector (4,6), the position of the center would be a vector (4,4). Here’s a picture of my problem.
In the image, we can see different vectors present on a circle and the aim of the formula would be to determine the coordinates of the green point from just two points.
I’d like to know if there’s a formula for finding the center of a circle from two vectors.
For example, with a vector (2,4) and a vector (4,6), the position of the center would be a vector (4,4). Here’s a picture of my problem.
In the image, we can see different vectors present on a circle and the aim of the formula would be to determine the coordinates of the green point from just two points.
I’d like to know if there’s a formula for finding the center of a circle from two vectors.
For example, with a vector (2,4) and a vector (4,6), the position of the center would be a vector (4,4). Here’s a picture of my problem.
In the image, we can see different vectors present on a circle and the aim of the formula would be to determine the coordinates of the green point from just two points.
I have try multiple code but no one works.
Some codes:
Vector3 direction = point1.forward.normalized;
Vector3 centerApproximation = (point1.position + point2.position) / 2f;
float distance = Vector3.Distance(point1.position, point2.position);
Vector3 orthoVector = Vector3.Cross(direction, Vector3.up);
Vector3 circleCenter = centerApproximation + orthoVector.normalized * Mathf.Sqrt((distance * distance) / 4 - Vector3.Dot(centerApproximation - point1.position, orthoVector.normalized));
// Trouver le point médian
Vector3 midpoint = (point1 + point2) / 2f;
// Calculer un vecteur perpendiculaire à la droite formée par les deux points
Vector3 direction = (point2 - point1).normalized;
Vector3 perpendicular = new Vector3(-direction.z, 0, direction.x); // Pour un plan 2D, si besoin
// Ajouter ce vecteur au point médian pour obtenir le troisième point
Vector3 thirdPoint = midpoint + perpendicular * (distance / 2f);```