#### Archived

This topic is now archived and is closed to further replies.

# Circular Movement Planning

This topic is 5163 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I want to find a circle in 2D defined by 2 points and the tangent of the circle at one of the points. But I can''t find a closed solution for the problem, pen and paper construction is simple. Some constraints, like the bounding triangle of the circle would be nice as well. Any help appreciated

##### Share on other sites
Assuming one of the points, A, is the center and the other, B, is on the circumference:
The normal at point B is quite easy to find, it''s simply:
N = ||B-A|| (|| means normalize)

To get the tangent out of that you just rotate it by 90°:
T = (Ny, -Nx)

Or rather, that is the direction of the tangent. You might want it in parametric form though, which is a bit trickier.
k = Ty / Tx (gradient)
m = By - k*Bx

y = kx + m (tangent''s function)

Hope that helps. It should be correct, though I am human and can have made a mistake...

Oh, and if A isn''t the center, it''s easily found as simply (A+B)/2.

##### Share on other sites
quote:
Original post by Dreamforger
I want to find a circle in 2D defined by 2 points and the tangent of the circle at one of the points. But I can''t find a closed solution for the problem, pen and paper construction is simple.

Lets call point A the point which lies on the circle for which you have the tangent, and point B the second point that lies on the circle. If you can find out where the center of the circle is (lets call that point C) then you''ll easily be able to draw it. So in order to do that you can define a line passes through A and is perpendicular to the tangent at point A. You know that the center of the circle will lie on that line. The second thing you know is that the distance from A to C must be equal to the distance between B and C... so with this information you can find the point C, 2 equations (equation for the line and |AC| = |BC|), 2 unknowns (x, y).

##### Share on other sites
Did a bit of thinking myself and came up with the following:

A and B both are on the circumference (if A were the center, the circle would already be defined). At A there is also a tangent to the circle T (normalized)

Let D = B-A, n = length_of(D), d = D/n, t=orthogonal to T as described above

r = n / (2* dot_product(t,d))

where |r| is the radius of the circle, and the center can be found by A + r*t

Any objections?

Edit: all n's were formerly l's . Though it was more intuitive, it was hard to read

[edited by - Dreamforger on January 7, 2004 11:30:16 AM]

##### Share on other sites
Ah, he wanted the circle defined by A, B AND the tangent of B. Misread :/

##### Share on other sites
A and B on the circle

=> centre of the circle will be on the median axis of segment [a, b]

=> vector T is tangent of the circle at A.

                                                                                                            .                                         .                                      T  .                                         .                                        . (a)   I                            A|.........|.........|B                       \        |                                    \       |                                     \      |                                      \     |                                       \    |                                        \   |                                         \(a)                                          \ |                                           \|                                            . C                                         |                                            |                                            |                                            |                                            |

(a) is the angle between (AB, T)

so you got two choices
sin(a) = |AI| / |AC| = [AB] x [T] tan(a) = |AI| / |IC| = [AB] x [T] / [AB] . [T]//('[]' is normalised vector, '||' is the norm).

so either, use the sin equation and find |AC| or the tan equation and find |IC|. All the rest is known (|AI| = |AB| / 2, sin(a) = [AB] x [T] => |AC| = ([AB] x [T]) / (|AB| / 2)).

|AC| is effectively the radius of the circle, which maybe good to know straight away.

[edited by - oliii on January 8, 2004 4:59:14 AM]