|
Convenient web based access to our favorite web design Usenet groups
|
 |
This is Interesting: Free Magazines for Graphics designers and webmasters
| Author |
| Thread |
 |
|
|
|
|
|
 |
 |
|
|
 |
|
|
 |
 |
Re: 3d rotational vector to 4-float VRML rotation node |
 |
|
 |
|
|
|
  12-04-03 - 06:00 PM
|
Herbert,
Thanks very much for your reply,
quote:
> Please tell me how this vector describes a rotation, then i can
> (probably) tell you how to calculate the SFRotation.
>
> But let me guess: Does the vector describe where the user should
> look at?
Yes the vector describes the direction vector from the origin.
quote:
> In this case try
> ori= new SFRotation(new SFVec3f(0, 0, -1), yourVector);
How would this be used? Could you use it like so:
Transform{
rotation new SFRotation(new SFVec3f(0, 0, -1), (-0.99863,
-0.052336, 1.67112e-005))
children[....]
}
quote:
> In general, the constructor new SFRotation(vectorA, vectorB)
> calculates an SFRotation that rotates vectorA into vectorB,
> and 0 0 -1 is the direction a user looks into by default.
> (Excatly this constructor calculates the shortest rotation
> from A to B.)
>
|
|
|
| [
Post Follow-Up to this message ]
|
|
|
|
|
 |
 |
Re: 3d rotational vector to 4-float VRML rotation node |
 |
|
 |
|
|
|
  12-04-03 - 06:00 PM
|
Dave Coventry wrote:quote:
> Herbert,
>
> Thanks very much for your reply,
>
>
>
> Yes the vector describes the direction vector from the origin.
>
>
>
>
> How would this be used? Could you use it like so:
> Transform{
> rotation new SFRotation(new SFVec3f(0, 0, -1), (-0.99863,
> -0.052336, 1.67112e-005))
> children[....]
> }
>
Would be too easy. ;-)
You need to use a Script node, that calculates the rotation and
sends it to the Transform.
DEF Trans Transform
{
}
DEF Scr Script
{
field SFVec3f dir 0 1 0
eventIn SFVec3f set_dir
eventOut SFRotation ori_changed
field SFVec3f negZ 0 0 -1
url "vrmlscript:
function initialize()
{
ori_changed= new SFRotation(negZ, dir);
}
function set_dir(d)
{
dir= d;
ori_changed= new SFRotation(negZ, dir);
}
"
}
ROUTE Scr.ori_changed TO Trans.rotation
ROUTE Something.dir_changed TO Scr.set_dir # if required.
If the direction vector doesn't change dynamically, you
can omit
eventIn SFVec3f set_dir
and
function set_dir(d)
Herbert
--
Herbert Stocker (aka hersto)
http://www.hersto.de
www.bitmanagement.de
|
|
|
| [
Post Follow-Up to this message ]
|
|
|
|
|
 |
|
|
 |
|
|
 |
| All times are GMT. The time now is 05:09 AM. |
 |
|
|
|
|
|  |
|