This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > VRML > January 2005 > how to add two rotations?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
how to add two rotations?
|
|
|
| Hi,
can someone provide me the formula to add two rotaions like
1 0 0 1.57 + 0 1 0 1.57=?
Thanks a lot
Lucia
| |
| bensmyth 2005-01-15, 7:17 am |
| Use matrix addition? - can't remember of the top of my head..... try Google.
"Lucia" <cheng_lucia@yahoo.com> wrote in message
news:7390d0bf.0501100738.5c1a2db1@posting.google.com...
> Hi,
>
> can someone provide me the formula to add two rotaions like
>
> 1 0 0 1.57 + 0 1 0 1.57=?
>
> Thanks a lot
>
> Lucia
| |
| Joerg Scheurich aka MUFTI 2005-01-15, 7:17 am |
| Lucia <cheng_lucia@yahoo.com> wrote:
> Hi,
> can someone provide me the formula to add two rotaions like
> 1 0 0 1.57 + 0 1 0 1.57=?
What means "add" ?
When you add two values, it makes no difference if you make (a + b) or (b + a)
For rotationations, it makes a difference, if you do rotation1 first and
rotation2 second or rotation2 first and rotation1 second.
To account two combined rotations, you can convert the axis/angle pair
to a normalized quaternion and then use quaternion multiplication.
There is a FAQ about matrix and quaternion math in the internet, which
tells about quaternions and rotations.
You can also use the multiply in the VRML javascript API, but unfortunalty
the standard do not clear say, what is first and what is second rotation, so
different browsers can give different results 8-(
#VRML V2.0 utf8
DEF Script1 Script
{
field SFRotation rot1 0 1 0 1.570000
field SFRotation rot2 0 0 1 1.570000
url
[
"java script:
// field SFRotation rot1 //
// field SFRotation rot2 //
function initialize()
{
print('rot1 * rot2: ' + rot1.multiply(rot2));
print('rot2 * rot1: ' + rot2.multiply(rot1));
}
"
]
}
Transform
{
children
[
Transform
{
children
[
DEF Shape1 Shape
{
appearance Appearance
{
material Material
{
}
}
geometry Extrusion
{
crossSection
[
1.041146 -1.152379
-2.848128e-2 -2.414731
-1 -1
-1 1
0.755227 0.743695
]
solid FALSE
}
}
]
rotation 0 0 1 1.570000
}
]
rotation 0 1 0 1.570000
translation -3.460000 0 0
}
Transform
{
children
[
USE Shape1
]
rotation 0.577043 0.577503 0.577503 2.093480
translation 0.839999 0 0
}
Transform
{
children
[
Transform
{
children
[
USE Shape1
]
rotation 0 1 0 1.570000
translation 0.909412 0 7.242899e-4
}
]
rotation 0 0 1 1.570000
translation 2.100883e-3 2.637850 -0.209701
}
Transform
{
children
[
USE Shape1
]
rotation -0.577043 0.577503 0.577503 2.093480
translation -2.029705 2.639470 -0.209701
}
Viewpoint
{
orientation 4.273203e-2 0.997040 -6.390678e-2 0.455952
position 2.951291 1.185134 9.724634
}
| |
| Braden McDaniel 2005-01-15, 12:19 pm |
| On Tue, 2005-01-11 at 14:33 +0000, Richard Kennaway wrote:
[snip]
> In some browsers (I've found this with the Mac version of Cortona), you
> must make sure that the axes of the SFRotations are normalised (i.e.
> unit vectors) before calling .multiply(), otherwise you get incorrect
> results.
Technically a browser is in error for allowing you even to have an
SFRotation whose axis isn't normalized. By definition, the axis of an
SFRotation is normalized.
--
Braden McDaniel e-mail: <braden@endoframe.com>
<http://endoframe.com> Jabber: <braden@jabber.org>
| |
| Joerg Scheurich aka MUFTI 2005-01-15, 12:19 pm |
| > Technically a browser is in error for allowing you even to have an
> SFRotation whose axis isn't normalized. By definition, the axis of an
> SFRotation is normalized.
The requirement of a normalized axis
http://www.web3d.org/x3d/specificat...html#SFRotation
| The first three values specify a normalized rotation axis vector about
| which the rotation takes place.
is one of the silliest point in the VRML97 standard. The rotation axis vector
represent only a direction. Length make no sense for a direction.
If the length of the rotation axis vector would be allowed to be anything,
nothing is lost, cause only the normalization of a quaternion (which is
accounted differently) is required to account rotations.
The same problem is repeated in the X3D standard draft:
http://www.web3d.org/x3d/specificat...html#SFRotation
| The first three values specify a normalized rotation axis vector about
| which the rotation takes place.
Most VRML browsers (except possibly OpenVRML based) understand not
normalized axis vectors, cause proofing the normalization costs about the
same computer time as normalizing the axis vector (which lead to nothing...).
so long
MUFTI
--
Englisch: Deutsch:
collator die Zusammentragmaschine
to collateralize [finan.] lombardieren
(von dict.leo.org)
| |
| simon 2005-01-18, 11:23 pm |
|
bensmyth wrote:
> Use matrix addition? - can't remember of the top of my head..... try
Google.[color=darkred]
>
> "Lucia" <cheng_lucia@yahoo.com> wrote in message
> news:7390d0bf.0501100738.5c1a2db1@posting.google.com...
in my post "help finding fundamental 3d maths" the example i showed was
the use of vrmlmatrix to 'add' two rotations, this could have textual
output and draggable vectors added to produce a usable tool, or just
edit the example with the angles reguired.
simon.
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|