Re: how to find the inverse mapping matrix?



In article <ef555c3.-1@xxxxxxxxxxxxxxxxxxxxxxx>, "Yang Zhang"
<zhyang99@xxxxxxxxxxx> wrote:

Hi all,

I am having a relatively straight forward question like this:

x1 = L1*cos(q1)+ L2 * cos(q1+q2) +&#12288;O1;
x2 = L1*sin(q1) + L2 * sin(q1+q2) + O2;

L1, L2, O1 and O2 are constants; q1 and q2 are variables
How can I get the mapping equations from x to q?

Thanks a lot,
Yang
------------------
This can viewed as a problem in vectors in the x-y plane. For
convenience, rewrite your equations as:

x = a*cos(p) + b*cos(q)
y = a*sin(p) + b*sin(q)

where x = x1-O1, y = x2-O2, a = L1, b = L2, p = q1, and q = q1+q2. I will
assume here that a and b are non-negative numbers.

Consider the three vectors in the x-y plane:

1) The vector pointing from (0,0) to (x,y). If it makes an angle t with
the x-axis and has length c, we have x = c*cos(t), and y = c*sin(t).

2) The vector from (0,0) to (a*cos(p),a*sin(p)). It has length a and
makes an angle p with respect to the x-axis.

3) The vector from (0,0) to (b*cos(q),b*sin(q)). It has length b and
makes and angle q with respect to the x-axis.

In order to satisfy the above equations, it is clear that the vector in 1)
must be the vector sum of the vectors in 2) and 3), so this becomes a
problem in trigonometry. The vector in 1) is known and we must find what
the angles p and q must be to construct a triangle with sides a and b
where the third side is c. If we choose to start the 2) vector at (0,0),
there are two solutions to this, symmetrically on opposite sides of the
(x,y) vector.

All of this explanation above should then make sense of the following
matlab code:

t = atan2(y,x);
c = sqrt(x^2+y^2);
s = (a+b+c)/2;
alpha = 2*atan2(sqrt((s-b)*(s-c)),sqrt((s*(s-a)));
beta = 2*atan2(sqrt((s-a)*(s-c)),sqrt((s*(s-b)));

% The two solutions are:
p = t + beta;
q = t - alpha;

% and
p = t - beta;
q = t + alpha;

Note: The formulas for alpha and beta, using s, are from standard formulas
for solving oblique triangles given their three sides. If p or q come out
with values greater than 2*pi or negative, then 2*pi can be subtracted or
added accordingly if desired.

Roger Stafford
.



Relevant Pages

  • Re: distribution of n point on the unit circle
    ... What is the probability density function or the distribution ... sector of the unit circle with that opening angle. ... alpha cannot be bigger than pi. ... if alpha> beta then the anticlockwise angle ...
    (sci.math)
  • Re: Question in Geometry
    ... The angle between its projection and the ... all I know is: Alpha, Beta and V2. ...
    (sci.math)
  • 2d Affine Inverse Transform
    ... parallelogram and determine the angle of rotation about it's center and ... alpha, beta skewing angles in x and y direction in degrees. ... beta is measured clockwise from the positive y axis. ... Given the following points that bound the parallelogram: ...
    (comp.graphics.algorithms)
  • Re: Question in Geometry
    ...  So what is the normalised form of V1? ... The angle between its projection and the ... all I know is: Alpha, Beta and V2. ...
    (sci.math)
  • Re: find angle
    ... i have an object travelling from point A to B and ... I would like to determine the angle, alpha, between ABC ... I also would like it to be positive if clockwise, ...
    (comp.soft-sys.matlab)