Skip to main content
GameDev.net gamedev.net
🔒 Locked

a circle representation and intersection

Started by yahastu Jun 29, 2010 at 1:53 PM 0 replies 1k views
Original Post
yahastu
yahastu
I happened across the following paper,
http://portal.acm.org/citation.cfm?id=49155.49157

In the paper, they describe another parametrization for the circle which transitions smoothly between radius=0 and radius=infinity and gives robust results with no degeneracies.

The circle is represented by

a(p.p) + b.p + c = 0

where the parameters are scalars a,b and a 2-vector b. p is a point on the circle. Given this parameterization, I can substitute in the homogeneous line and I get a quadratic equation to find both solutions. Nice.

According to the paper, the center q is given by

q = -b/(2a)

and the radius is given by

r = +sqrt(b.b - 4ac)/(2a)

When |r|>1, they find parameters as follows ( r<1 omitted here for brevity),

a = 1/(2r)
b = -q/r
c = (q.q - r^2)/(2r)

I should note that the published equation is b = q/r, which I changed by adding a negative sign otherwise it is inconsistent. Another way to remove the inconsistency is to make q = b/(2a) -- I don't think it makes a difference.

The only problem is that the simultaneous solutions to both equations aren't the proper intersection points. After some investigation I've realized that the problem is in the circle parameterization. It doesn't evaluate to zero for points on the circle!

I'm wondering if somebody can shed some light on the "logic" behind the above circle parameterization, which will elucidate why it's not working.

Thanks
johnstanp
johnstanp
A definition of the circle:
A circle is a simple shape of Euclidean geometry consisting of those points in a plane which are equidistant from a given point called the center. The common distance of the points of a circle from its center is called its radius.
Circle-Wikipedia>

Let's C be a circle with center xo and radius r. A point x belongs to c iff:

length( x - xo ) = sqrt( dot( x - xo, x - xo ) ) = r

This implies that squared_length( x - xo ) = dot( x - xo, x - xo ) = r²

dot( x - xo, x - xo ) = dot( x, x ) - 2 dot( x, xo ) + dot( x, xo ) = r²

or with usual notations:

x.x - 2x.xo + xo.xo = r²
x.x - 2x.xo + xo.xo - r² = 0

The equation you provided is:
a(p.p) + b.p + c = 0

which is equivalent to, if a is different from zero:
p.p + (b/a)p + c/a = 0

A simple identification yields:
* b/a = -2xo
=> xo = -b/(2a) (1)

* c/a = xo.xo - r²
=>r = sqrt( xo.xo - c/a ) (2)
(1) in (2) => r = sqrt( b²/(4a²) - c/a )
<=> r = sqrt( b² - 4ac ) / (2a)

of course b² - 4ac >= 0

Knowing the center of the circle xo and its radius r, we find
b/a = -2xo
c/a = xo.xo - r²

if we chose a = 1, then
b = -2xo
c = xo.xo - r²

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.