Tags
 IOS SQL HTML C RUBY-ON-RAILS MYSQL ASP.NET DEVELOPMENT RUBY .NET LINUX SQL-SERVER REGEX WINDOWS ALGORITHM ECLIPSE VISUAL-STUDIO STRING SVN PERFORMANCE APACHE-FLEX UNIT-TESTING SECURITY LINQ UNIX MATH EMAIL OOP LANGUAGE-AGNOSTIC VB6

How to find the point on a circle when a point within it is projected out on to it?

By : user6095865
Date : September 16 2020, 09:00 PM
wish of those help If the circle center is known to be (c_x, c_y) and the point a is at (a_x, a_y). Then we simply construct a line from the center through point a of length r. This is simply a similar triangle. We compute the hypotenuse of the triangle to be
h = sqrt((a_x - c_x)^2 + (a_y-c_y)^2)
code :

Share :

I have a line from the center point of a circle to another point. I want to find the point where the line intersects the

By : Matt K.
Date : March 29 2020, 07:55 AM
To fix this issue It's easier to treat this as a vector problem. Your second approach is close, but you don't correctly scale the vector between the two points. It's easier to work with a normalized vector in this case, although you have to assume that the distance between the two points on the line is non-zero.
Given:
code :
``````double x0 = CIRC_X0; /* x-coord of center of circle */
double y0 = CIRC_Y0; /* y-coord of center of circle */

double x1 = LINE_X1; /* x-coord of other point on the line */
double y1 = LINE_Y1; /* y-coord of other point on the line */
``````
``````double vx = x1 - x0;
double vy = y1 - y0;
``````
``````double vmag = sqrt(vx*vx + vy*vy);
vx /= vmag;  /* Assumption is vmag > 0 */
vy /= vmag;
``````
``````x0 + dist * vx
y0 + dist * vy
``````
``````double x_intersect = x0 + CIRC_RADIUS * vx;
double y_intersect = y0 + CIRC_RADIUS * vy;
``````

Find the point on a circle with given center point, radius, and degree

By : Gustsaiyonee
Date : March 29 2020, 07:55 AM
To fix this issue The simple equations from your link give the X and Y coordinates of the point on the circle relative to the center of the circle.
code :
``````X = r * cosine(angle)
Y = r * sine(angle)
``````
``````X = Cx + (r * cosine(angle))
Y = Cy + (r * sine(angle))
``````

Find a specific point on a circle by a point & angle between them

By : Dixit
Date : March 29 2020, 07:55 AM
around this issue Basic trigonometry or application of a rotation matrix (not to forget: translate the center to the origin and after rotation back to its inital position):
code :
``````XM=a+cos(C°)*(X1-a)-sin(C°)*(Y1-b)
YM=b+sin(C°)*(X1-a)+cos(C°)*(Y1-b)
``````
``````XM=a+cos(C°)*(X1-a)-sin(C°)*(b-Y1)
YM=b-sin(C°)*(X1-a)-cos(C°)*(b-Y1)
``````
``````XM=a+cos(C°)*(X1-a)+sin(C°)*(Y1-b)
YM=b-sin(C°)*(X1-a)+cos(C°)*(Y1-b)
``````
``````XM=a+cos(-C°)*(X1-a)-sin(-C°)*(Y1-b)
YM=b+sin(-C°)*(X1-a)+cos(-C°)*(Y1-b)
``````

Find 3d coordinates of a point on a line projected from another point in 3d space

By : seovalencia
Date : March 29 2020, 07:55 AM
I wish did fix the issue. Working in Swift, ARTKit / SceneKit , Parameterize the line AB with a scalar t:
code :
``````P(t) = A + (B - A) * t`
``````
``````dot(C - D, B - A) = 0

dot(C - A - (B - A) * t, B - A) = 0

dot(C - A, B - A) = t * dot(B - A, B - A)

// Substitute value of t

-->  D = A + (B - A) * dot(C - A, B - A) / dot(B - A, B - A)
``````
``````var BmA = B - A
var CmA = C - A
var t = dot(CmA, BmA) / dot(BmA, BmA)
var D = A + BmA * t;
``````

Given a circle with N defined points and a point M outside the circle, find the point that is closest to M among the set

By : Remark
Date : March 29 2020, 07:55 AM
it should still fix some issue Assuming that the points on the circumference of the circle are "in-order" (i.e. sorted by angle about the circle's center) you could use an angle-based binary search, which should achieve the O(log(n)) bounds.
Calculate the angle A from the point M to the center of the circle - O(1). Use binary search to find the point I on the circumference with largest angle less than A - O(log(n)). Since circles are convex the closest point to M is either I or I+1. Calculate distance to both and take the minimum - O(1).