This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > VRML > February 2004 > Javascript and VRML extrusion question





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 Javascript and VRML extrusion question
William Clive

2004-02-24, 6:30 am

Hi,

I just need to know a few things to help me and I'd really appreciate it if
anyone can help me.

I have a set of sliders in DHTML, and I can get them to communicate with the
VRML to change the transparency and colour of the pot that I am creating.

What I now need to do is be able to change the shape of the pot using
sliders. I have created the pot using extrusion in a circle along a spine
changing the shape with scale. What I need to do, is be able to alter the
scale values dynamically and so changing the shape of the pot.

Cheers in advance for any replies,

Will


Jeremy Pitten

2004-02-24, 11:30 am

All you need to do is wrap the Shape node with a Transform node and update
the transform scale.
Here is a pot I found in the garden shed:

PROTO Pot [
exposedField SFColor pot_colour 0.7 0.8 0.8
exposedField SFVec3f pot_scale 2 1.2 2]
{
Transform {
rotation 1 0 0 3.141
translation 0 0 0
scale IS pot_scale
children [
Shape {
appearance Appearance {
material Material {
diffuseColor IS pot_colour
}
}
geometry Extrusion {
crossSection [0 0.5, 0.129 0.483, 0.25 0.433, 0.353 0.353, 0.433
0.25, 0.483 0.129, 0.5 0,
0.483 -0.129, 0.433 -0.25, 0.353 -0.353, 0.25 -0.433, 0.129 -0.483,
0 -0.5,
-0.129 -0.483, -0.25 -0.433, -0.353 -0.353, -0.433 -0.25, -0.483 -0.
129, -0.5 0,
-0.483 0.129, -0.433 0.25, -0.353 0.353, -0.25 0.433, -0.129 0.483,
0 0.5 ]
spine [0 0.1 0, 0 0 0, 0 0.25 0, 0 0.5 0, 0 0.75 0, 0 1 0 ]
scale [0.8 0.8, 1 1, 0.8 0.8, 0.6 0.6, 0.4 0.4, 0.2 0.2 ]
creaseAngle 1.05
beginCap TRUE
endCap TRUE
solid FALSE
}
}
]
}
}
# a pot :
Pot { potColour 0.4 0.5 0.6 pot_scale 2 1.3 2 }



"William Clive" <williamclive@hotmail.com> wrote in message
news:v9F_b.2737$396.2054@newsfe3-win.server.ntli.net...
> Hi,
>
> I just need to know a few things to help me and I'd really appreciate it

if
> anyone can help me.
>
> I have a set of sliders in DHTML, and I can get them to communicate with

the
> VRML to change the transparency and colour of the pot that I am creating.
>
> What I now need to do is be able to change the shape of the pot using
> sliders. I have created the pot using extrusion in a circle along a spine
> changing the shape with scale. What I need to do, is be able to alter the
> scale values dynamically and so changing the shape of the pot.
>
> Cheers in advance for any replies,
>
> Will
>
>



Cecile Muller

2004-02-24, 12:33 pm

> What I need to do, is be able to alter the scale values dynamically
> and so changing the shape of the pot.


Extrusion{} has an MFVec2f eventIn called "set_scale" for changing the
scale field (there is also an MFVec3f eventIn called "set_spine" for
the spine field). Make your sliders communicate with a Script{} which
will change those values according to what you want to do.
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews