Matemática e Computação
 

Amigo é um irmão que a gente escolhe. (Autor desconhecido) É difícil fazer um amigo num ano; mas, é fácil perdê-lo numa hora. (Provérbio Chinês) Amigos são aquelas pessoas raras que nos perguntam como estamos e depois ficam à espera da resposta. (E. Cunningham)

 

5.1.2 - Rotação

Rotaciona-se o objeto especificado no campo children em torno de um eixo determinado e de um ângulo também determinado. O campo associado à rotação consiste de quatro números: os três primeiros referem-se à localização espacial de um eixo de rotação e o quarto número (em radianos), é o ângulo de rotação em torno do tal eixo.

Rotação em torno do eixo x de 45 graus............ 1.0.. 0.0.. 0.0.. 0.785
Rotação em torno do eixo y de 45 graus ............0.0.. 1.0.. 0.0.. 0.785
Rotação em torno do eixo z de 45 graus ............0.0.. 0.0.. 1.0.. 0.785

Exemplo 26: Rotação

#VRML V2.0 utf8

Transform {
......rotation 1 1 0 0.7
......children [
............Shape {
..................appearance Appearance {
........................material Material {
..............................diffuseColor 0.0 0.0 0.0
..............................specularColor 0 .92 1
..............................emissiveColor 0 0 1
..............................ambientIntensity 0
..............................shininess .03
........................}
..................}
..................geometry Box {
........................size 1.0 2.0 4.0
..................}
............}
......]
}

 

Exemplo 27: Rotacionando 45.0 graus em torno do eixo X

#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Transform {
......rotation 1.0 0.0 0.0 0.785
......children [
......
......Shape {
......
............appearance Appearance {
......
..................material Material { }
......
............}
......
............geometry Box { }
......
......}
......]
}

 

Exemplo 28: Rotacionando -45.0 graus em torno do eixo X

#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Transform {
......rotation 1.0 0.0 0.0 -0.785
......children [
............Shape {
..................appearance Appearance {
........................material Material { }
..................}
..................geometry Box { }
............}
......]
}

 

Exemplo 29: Rotacionando 45.0 graus em torno do eixo Y

#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Transform {
......rotation 0.0 1.0 0.0 0.785
......children [
......
......Shape {
......
............appearance Appearance {
......
..................material Material { }
......
............}
......
............geometry Box { }
......
......}
......]
}

 

Exemplo 30: Rotacionando -45.0 graus em torno do eixo Z

#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Transform {
......rotation 0.0 0.0 1.0 -0.785
......children [
......
......Shape {
......
............appearance Appearance {
......
..................material Material { }
......
............}
......
............geometry Box { }
......
......}
......]
}

 

Exemplo 31:Um 3-D asterisco criado com um cilindro vertical e dois rotacionados em torno do eixo Z

#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Group {
......children [
......
......# Arm 1
......
......DEF Arm1 Shape {
......
............appearance Appearance {
......
..................material Material { }
......
............}
......
............geometry Cylinder {
......
..................height 1.0
......
..................radius 0.1
......
............}
......
......},
......
......# Arm 2
......
......Transform {
......
............rotation 1.0 0.0 0.0 1.047
......
............children USE Arm1
......
......},
......
......# Arm 3
......
......Transform {
......
............rotation 1.0 0.0 0.0 2.094
......
............children USE Arm1
......
......}
......]
}

 

Exemplo 32:Um 3-D asterisco criado com cilindros rotacionados em torno dos eixos X, Y e Z

#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Group {
......children [
......
......# Arm 1
......
......DEF Arm1 Shape {
......
............appearance Appearance {
......
..................material Material {
............
..................diffuseColor .5 .35 0
............
..................specularColor .76 .74 .59
............
..................ambientIntensity .0567
............
..................shininess .07
......
..................}
......
............}
......
............geometry Cylinder {
......
..................height 1.0
......
..................radius 0.1
......
............}
......
......},
......
......# Arm 2
......
......DEF Arm2 Transform {
......
............rotation 1.0 0.0 0.0 1.047
......
............children USE Arm1
......
......},
............# Arm 3
......
......DEF Arm3 Transform {
......
............rotation 1.0 0.0 0.0 2.094
......
............children USE Arm1
......
......},
......
......# Arms 4 and 5
......
......Transform {
......
............rotation 0.0 1.0 0.0 1.785
......
............children [
......
..................USE Arm2,
......
..................USE Arm3
......
............]
......
......}
......]
}

 

Exemplo 33: Uma arcada criada com cilindros e cubos rotacionados

#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Group {
......children [
......
......# Ground
            Transform {
            translation 0 0 -10
            children [
......
......Shape {
......
............appearance DEF White Appearance {
......
..................material Material { }
......
............}
......
............geometry Box {
......
..................size 25.0 0.1 25.0
......
............}
......
......}
            ]
            }
,
......
......# First archway
......
......# Left Column
......
......DEF LeftColumn Transform {
......
............translation -2.0 3.0 -10.0
......
............children DEF Column Shape {
......
..................appearance USE White
......
..................geometry Cylinder {
......
........................radius 0.3
......
........................height 6.0
......
..................}
......
............}
......
......},
......
......# Right Column
......
......DEF RightColumn Transform {
......
............translation 2.0 3.0 -10.0
......
............children USE Column
......
......},
............# Archway span
......
......DEF ArchwaySpan Transform {
......
............translation 0.0 6.05 -10.0
......
............children Shape {
......
..................appearance USE White
......
..................geometry Box{
......
........................size 4.6 0.4 0.6
......
..................}
......
............}
......
......},
......
......# Left Roof
......
......DEF LeftRoof Transform {
......
............translation -1.15 7.12 -10.0
......
............rotation 0.0 0.0 1.0 0.524
......
............children DEF Roof Shape {
......
..................appearance USE White
......
..................geometry Box {
......
........................size 2.86 0.4 0.6
......
..................}
......
............}
......
......},
......
......# Right Roof
......
......DEF LeftRoof Transform {
......
............translation 1.15 7.12 -10.0
......
............rotation 0.0 0.0 1.0 -0.524
......
............children USE Roof
......
......}
......]
}

 

Exemplo 34: Rotação de um cilindro em torno de um eixo

#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Group{
......children [
......
......# Lamp base
......
......Shape {
......
............appearance DEF White Appearance {
......
..................material Material { }
......
............}
......
............geometry Cylinder {
......
..................radius 1.0
......
..................height 0.1
......
............}
......
......},
............# Base joint
............Transform {
............
......translation 0.0 0.15 0.0
............
......rotation 1.0 0.0 0.0 -0.7
............
......center 0.0 -0.15 0.0
............
......children [
............
............# Lower arm
............
............Shape {
............
..................appearance USE White
............
..................geometry Cylinder {
............
........................radius 0.1
............
........................height 3.0
............
..................}
............
............}
............
......]
............}
......]
}

 

Exemplo 35: Rotação de cilindros em torno de um eixo

#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Group{
......children [
......
......# Lamp base
......
......Shape {
......
............appearance DEF White Appearance {
......
..................material Material { }
......
............}
......
............geometry Cylinder {
......
..................radius 1.0
......
..................height 0.1
......
............}
......
......},
......
......# Base joint
......
......Transform {
......
............translation 0.0 0.15 0.0
......
............rotation 1.0 0.0 0.0 -0.7
......
............center 0.0 -0.15 0.0
..................children [
......
..................# Lower arm
......
..................DEF LampArm Shape {
......
........................appearance USE White
......
........................geometry Cylinder {
......
..............................radius 0.1
......
..............................height 3.0
......
........................}
......
..................},
......
..................# Lower arm - second arm joint
......
..................Transform {
......
........................translation 0.0 0.3 0.0
......
........................rotation 1.0 0.0 0.0 1.9
......
........................center 0.0 -0.15 0.0
......
........................children [
......
..............................# Second arm
......
..............................USE LampArm
......
........................]
......
..................}
......
............]
......
......}
......]
}