# Re: LANG: Standard Semantic Characteristics (was Re: LANG: Re: scalability)

John Ellson (ellson@hotsand.att.com)
Wed, 22 Jun 94 07:25:59 EDT

> From: "Kevin Goldsmith" <kmg@monk.colossal.com>
>
> writing out all transforms in matrices is bad. Having an option to do them
> individually is good. If I want to transform a cube, rotate it around the XY
> axis 45 degrees and scale it up by 2 in X, down by .5 and up 1.1 in Z, I don't
> want to have to sit with a calculator and paper and pencil and figure out the
> matrix, I want to say:
> transform x y z
> rotate axis angle
> scale x y z
>
> that seems much more straightforward, especially if we expect "real" people to
> use VRML.
>
> Kevin

I agree that manually writing values into 4*4 matrixes would be
awkward. But that isn't required.

We were talking about the representation of the attribute (or
attributes) of position, orientation and scale of a 3D object and I was
suggesting that this should be represented by a single 4*4 matrix value.

The values you identify above are parameters to operations and not
attributes of the 3D object. In tsipp, translation and scale values can
still be represented as simple vectors, and rotations as single
values.

I'm mostly interested in the mathematical principles here but
I will use the tSipp language for this example. Tsipp provides the
following operators (from the man pages):

SippObjectTransform <object> <matrix>
Post multiply specified matrix into the transformation
matrix of <object>.

SippObjectRotateX <object> <angle>
SippObjectRotateY <object> <angle>
SippObjectRotateZ <object> <angle>
Rotate the <object> <angle> radians or degrees about the X (Y, Z)
axis. The angle is radians if no prefix or if the number is
prefixed with an "R" and is degrees, prefixed with a "D".

SippObjectRotate <object> <point> <vector> <angle>
given by <point> and <vector> starting in that point.
The angle is radians if no prefix or if the number is
prefixed with an "R" and is degrees, prefixed with a "D".

SippObjectScale <object> <factor> | {<xfactor> <yfactor> <zfactor>}
Scale the specified object with the scaling factors
<xfactor>, <yfactor> and <zfactor> in the main directions
respectively. If only <factor> is specified, it is used
as thescaling factors in all directions.

SippObjectMove <object> {<xdist> <ydist> <zdist>}
Move (translate) the specified <xdist>, <ydist> and
<zdist> in the three main directions, respectively.

So your example could be coded:

SippObjectMove \$myobject {2.5 2.5 0.0}
SippObjectRotateX \$myobject D45
SippObjectScale \$myobject {2 .5 1.1}

i.e. more or less as easily as in your original statement.

Often this kind of operation can be precomputed into a single
transformation matrix, e.g.

set transform [SippMatScale \
[SippMatRotateX \
[SippMatTranslate [SippMatIdent] {2.5 2.5 0.0} ] \
D45 ] \
{2 .5 1.1} ]
SippObjectTransform \$myobject \$transform

It is probably much more efficient to transmit transformations this way.

John Ellson
AT&T Bell Labs