Line to Circle transformation

1.3k views Asked by At

I am programming a game at the moment and would really appreciate some help. I'll get straight to the point: What kinda of formula would I use to translate points on a finite line to a circle of origin (0, 0)?

Example:

     Matrix A contains points: (0, 2), (1, 2), (2,  2), ( 3, 2)
     Matrix T is the standard transformation matrix (an equation is equally as helpful)
     Matrix B is the transformation where AT = B so that B contains points:
                               (0, 2), (2, 0), (0, -2), (-2, 0)
     Where vector (0, 2) is the eigenvector.

The problem I've been having is that the transformation relies on the number of points (perhaps transforming them to the points of a normal n-gon poylgon?) and with my limited knowledge, I do not know how to approach this. Thank you in advance for at least reading this problem.

Edit: I would like to say that I am unsure if there is even a kind of transformation for this as values left of the first point and values right of the last point are omitted, thus data is lost.

1

There are 1 answers

0
6502 On BEST ANSWER

A matrix transformation is linear (or linear in homogeneous coordinates). This means for example that

((p1 + p2)/2)M = ((p1 M) + (p2 M)) / 2

in other word the middle point of p1 and p2 is transformed to the middle of the transformation of p1 and p2.

If you have 4 collinear points no matrix can map them in points that are not collinear.

If you're looking for a general mapping more complex formulas are needed. One that is easy to implement (for inputs of small size) and with very nice properties a radial basis function (RBF) interpolator.

In that case you can specify an arbitrary list of points P[i] and specify the destination for each of them Q[i]. You end up with a smooth function T that maps any point to another point and for which T(P[i]) = Q[i] for all the specified points.

If the source points are instead not general but on a regular grid then a simple cubic spline net can provide you with a nice smooth interpolator (apparently this is what is used in most image morphing software).