5._ Nodo Transform
Con este nodo se van a poder acomodar las figuras que se han realizado en un sistema de coordenadas especifico, podrás también marcar la escala a la cual tu quieres que se represente tu figura, así como su rotación, la sintaxis de este nodo transform es la siguiente:
Transform{
translation Eje_X Eje_Y Eje_Z
rotation Eje_X Eje_Y Eje_Z Ángulo
scale Eje_X Eje_Y Eje_Z
children[...]
}
translation Eje_X Eje_Y Eje_Z
rotation Eje_X Eje_Y Eje_Z Ángulo
scale Eje_X Eje_Y Eje_Z
children[...]
}
Translation: Sirve para posicionar la figura en el plano, a los
Rotation: Sirve para rotar o girar la figura, ésta se mide en radianes.
Scale: Es para que se ingrese a que escala se verá la figura deseada.
A continuación pondré un ejemplo de la sintaxis, y después agregare captura de pantalla del resultado del código, nos basaremos en las figuras que ya hemos hecho en éste tutorial
#VRML V2.0 utf8
Transform{
translation 0 1 -10.35
rotation 0 0 0 0
children[
Shape {
appearance Appearance{texture ImageTexture {
url ["http://www.decorablog.com/wp-content/2009/07/madera_roble.jpg"]
}
}
geometry Box {
size 5 5 5
}
}
]
}
Transform{
translation 0 10 -10.35
rotation 0 0 0 0
children[
Shape{
appearance Appearance{
material Material{
diffuseColor 1 0 0
}
}
geometry Cylinder{
height 2.5
radius 1
}
}
]
}
Transform{
translation 10 1 -10.35
rotation 0 0 0 0
children[
Shape{
appearance Appearance{
material Material{
diffuseColor 0 0 1
}
}
geometry Cone{
height 4
bottomRadius 1.5
}
}
]
}
Transform{
translation 10 10 -10.35
rotation 0 0 0 0
children[
Shape{
appearance Appearance{
material Material{
diffuseColor 0 1 1
}
}
geometry Sphere{
radius 1.5
}
}
]
}
Transform{
translation 0 1 -10.35
rotation 0 0 0 0
children[
Shape {
appearance Appearance{texture ImageTexture {
url ["http://www.decorablog.com/wp-content/2009/07/madera_roble.jpg"]
}
}
geometry Box {
size 5 5 5
}
}
]
}
Transform{
translation 0 10 -10.35
rotation 0 0 0 0
children[
Shape{
appearance Appearance{
material Material{
diffuseColor 1 0 0
}
}
geometry Cylinder{
height 2.5
radius 1
}
}
]
}
Transform{
translation 10 1 -10.35
rotation 0 0 0 0
children[
Shape{
appearance Appearance{
material Material{
diffuseColor 0 0 1
}
}
geometry Cone{
height 4
bottomRadius 1.5
}
}
]
}
Transform{
translation 10 10 -10.35
rotation 0 0 0 0
children[
Shape{
appearance Appearance{
material Material{
diffuseColor 0 1 1
}
}
geometry Sphere{
radius 1.5
}
}
]
}
Y así es como se ven las figuras:
No hay comentarios.:
Publicar un comentario