This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > VRML > July 2007 > Display rotated geometries at position
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 |
Display rotated geometries at position
|
|
| Markus 2007-07-19, 6:16 am |
| Hi NG,
I hope you can help me out. I am trying to display a bunch of cones at
certain position with a 3D rotation. So I have for each object XYZ
position and rotations around X Y and Z.
How can I do that easily, the code below seems to igonore my roatation
values.
Thanks for any help.
Markus
PROTO objekt2 [
exposedField SFVec3f trans 0 0 0
exposedField SFRotation rotx 1 0 0 0
exposedField SFRotation roty 0 1 0 0
exposedField SFRotation rotz 0 0 1 0
exposedField SFColor color .8 .8 .8
exposedField MFString tex [ ]
exposedField SFNode geom Sphere {}
]
{
Transform {
children [
Shape {
appearance Appearance {
material Material {
diffuseColor IS color
}
texture ImageTexture {
url IS tex
}
}
#geometry Cylinder {radius 5
# height 50}
geometry Cone {bottomRadius 20
height 100}
}
]
translation IS trans
rotation IS rotx
rotation IS roty
rotation IS rotz
}
}# Ende PROTO objekt
Group {
children [
Transform {
#translation 0 0 0
children [
objekt2 { trans 1552.71058114049 1488.00607523496 -592.966082654426
rotx 1 0 0 1.36855952888136
roty 0 1 1 -0.545917788189337
rotz 0 0 1 1.46183523981071
}
objekt2 { trans 1552.71056708651 1488.00459369704 -592.969891722573
rotx 1 0 0 1.36856133425918
roty 0 1 0 -0.545933032019532
rotz 0 0 1 1.46183494665319
}
......
| |
| paul@digititalspaceart.com 2007-07-22, 6:16 pm |
| On Thu, 19 Jul 2007 09:13:53 -0000, Markus <steinerm@XXXXXXXXXX> wrote:
>I hope you can help me out. I am trying to display a bunch of cones at
>certain position with a 3D rotation. So I have for each object XYZ
>position and rotations around X Y and Z.
>How can I do that easily, the code below seems to igonore my roatation
>values.
[snip] ....
>objekt2 { trans 1552.71058114049 1488.00607523496 -592.966082654426
>rotx 1 0 0 1.36855952888136
>roty 0 1 1 -0.545917788189337
>rotz 0 0 1 1.46183523981071
>}
>
>objekt2 { trans 1552.71056708651 1488.00459369704 -592.969891722573
>rotx 1 0 0 1.36856133425918
>roty 0 1 0 -0.545933032019532
>rotz 0 0 1 1.46183494665319
>}
You code looks fine - except for the fact that both cones are at
exactly the same position with exactly the same rotation. You won't
see that there are 2 instances there. I tested by zeroing the
rotation values for the second instance, and it works fine.
- Paul
Paul S. Hoffman
http://www.digitalspaceart.com
--
Posted via a free Usenet account from http://www.teranews.com
| |
|
| On Jul 19, 10:13 am, Markus <stein...@XXXXXXXXXX> wrote:
> Hi NG,
>
> I hope you can help me out. I am trying to display a bunch of cones at
> certain position with a 3D rotation. So I have for each object XYZ
> position and rotations around X Y and Z.
> How can I do that easily, the code below seems to igonore my roatation
> values.
>
> Thanks for any help.
>
> Markus
>
> PROTO objekt2 [
> exposedField SFVec3f trans 0 0 0
> exposedField SFRotation rotx 1 0 0 0
> exposedField SFRotation roty 0 1 0 0
> exposedField SFRotation rotz 0 0 1 0
>
> exposedField SFColor color .8 .8 .8
> exposedField MFString tex [ ]
> exposedField SFNode geom Sphere {}
> ]
> {
> Transform {
> children [
> Shape {
> appearance Appearance {
> material Material {
> diffuseColor IS color
> }
> texture ImageTexture {
> url IS tex
> }
> }
> #geometry Cylinder {radius 5
> # height 50}
>
> geometry Cone {bottomRadius 20
> height 100}
>
> }
> ]
> translation IS trans
> rotation IS rotx
> rotation IS roty
> rotation IS rotz
> }
> }# Ende PROTO objekt
>
> Group {
> children [
> Transform {
> #translation 0 0 0
>
> children [
>
> objekt2 { trans 1552.71058114049 1488.00607523496 -592.966082654426
> rotx 1 0 0 1.36855952888136
> roty 0 1 1 -0.545917788189337
> rotz 0 0 1 1.46183523981071
>
> }
>
> objekt2 { trans 1552.71056708651 1488.00459369704 -592.969891722573
> rotx 1 0 0 1.36856133425918
> roty 0 1 0 -0.545933032019532
> rotz 0 0 1 1.46183494665319
>
> }
>
> .....
rotation is a field of the transform node, you only have one of each
field, to do what you want you can have three transforms one inside
another and have each rotation IS'ed to the different transforms, (but
be aware that the order makes a difference), or a script could be used
to combine the three rotations into one.
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|