Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2006-08-26 07:42:51


"Matthias Troyer" <troyer_at_[hidden]> wrote in message
news:A2F5F048-A738-4E3D-A9AC-F34F6FFA181F_at_itp.phys.ethz.ch...
>
> On Aug 24, 2006, at 8:02 PM, Andy Little wrote:
>
>>
>> "Matthias Troyer" <troyer_at_[hidden]> wrote

> Wait a moment, matrices are representations of linear operators in a
> vector space Let us first consider what that vector space here is.
> For the transformation matrices you mention we have vectors (x, y, 1)
> that we want to transform. We can choose, as is usual, the same
> units for the three components. If we now have a linear operator from
> this vector space to itself, as we have here, then all entries in the
> matrix must be pure numbers, since we do not change any units. And
> indeed, if one looks at the matrix you propose than for translations
> + rotations it actually is
>
> (cos(alpha), sin(alpha), dx )
> (-sin(alpha), cos(alpha), dy)
> (0, 0, 1)
>
> all entries are pure numbers, and the translations dx and dy are
> given in terms of the unit chosen for the 1 in the vector. This is
> actually just what you propose as second option:
>
>> Another alternative is to make all the elements of the matrix
>> numeric. In this
>> case h in the homogeneous coordinate [X Y h] would have the same
>> type as X and
>> Y.

Well that is OK as far as it goes, however a homogeneous coordinate also has
rules and in fact the above statement is probably incorrect as I realised after
I posted it.

Generally speaking a (non-homogeneous) coordinate [ X, Y] is transformed to a
homogeneous coordinate by:

[X,Y] -> [ X',Y', h] where X' == X * h and Y' == Y * h.

If X and Y are Quantities, lets say lengths in meters, then if h is the same
type as X and Y ( IOW h is a length in meters) then X' and Y' are transformed
into something dimensionally equivalent to an area in meters^2 , but
unfortunately 'h' is still a quantity in meters.

OTOH if h is a pure number then X' and Y' are of the same quantity type as X
and Y ( IOW lengths), but h
is and remains a pure number.

The other choice is to make h a reciprocal of length. In this case X and Y are
transformed to pure numbers , but h remains a quantity again.

IOW if X and Y are dimensioned quantities then h can never have the same type
as X' and Y'.

The only way that X' Y' and h can be of the same type is the one case where X
and Y and h are pure numbers.

It follows that, if the elements of coordinate are dimensioned quantities, then
some elements of the matrix must also be dimensioned quantities. There is no way
around that:

Assume:
a variable with an L prefix stands for a length,
a variable with an N prefix for a number,
a variable with an U prefix as having some unknown type yet to be determined
Assume a homogeneous coordinate as a row vector v1 == [Lx, Ly, Nh].
assume a column vector v2 == { N1, N2, N3}

Multiplying v1 by v2 gives a 1 x1 matrix, M1 whose element, Uv1 = Lx * N1 +
Ly * N2 + Nh * N3

However Lx * N1 is a length, Ly * N2 is a length, but Nh * N3 is a pure number
and ( if one observes the rules of dimensional analysis), cannot be added to a
length.

Next assume a column vector v3 == { N1, N2, L3} ( The only change from v1 is
that the 3rd element is now a length, not a number)
Multiplying v1 by v3 gives a 1 x 1 matrix, M2 whose element, Uv2 = Lx * N1 + Ly
* N2 + Nh * L3;
In this case the calculation is permitted and the element of M2 is a length.

<...>

>> That isnt as neat though as you have then lost the unit information
>> in T7 and
>> T8 regarding the translation and applying the matrix to a point in
>> different
>> units would give different results.
>
> No, you have not lost the unit information, since it is encoded in
> the vector type. And indeed applying a matrix to different vector
> spaces (e.g. points with different units), should actually give
> different results!

But dimensioned quantities of different units can exist quite happily in one
space ( a measurement in kilometers is just as valid as one in meters on this
earth for instance), so logically, applying a transform should give the same
results independent of the units.

regards
Andy Little


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk