// Exemplo de arquivo de descricao de cena para POV-ray
// Last edited on 2010-03-04 15:44:01 by stolfi
// ======================================================================
// CORES E TEXTURAS
#include "eixos.inc"
#include "camlight.inc"
#include "retalho.inc"
#include "textures.inc"
//background{ color rgb < 0.75, 0.80, 0.85 > }
sky_sphere{pigment{Blue_Sky} scale 0.2 }
#declare tx_plastico =
texture{
pigment{ color rgb < 0.10, 0.80, 1.00 > }
finish{ diffuse 0.8 ambient 0.2 specular 0.5 roughness 0.005 }
}
#declare tx_verde =
texture{
pigment{ color rgb < 0.10, 1.00, 0.10 > }
finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 }
}
#declare tx_branco =
texture{
pigment{ color rgb < 1.0, 1.0, 1.0 > }
finish{ diffuse 0.2 ambient 0.6 }
}
#declare tx_preto =
texture{
pigment{ color rgb < 0.0, 0.00, 0.0 > }
finish{ diffuse 0.9 ambient 0.1 }
}
#declare tx_vermelho =
texture{
pigment{ color rgb < 1.00, 0, 0 > }
finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 }
}
#declare tx_fosca =
texture{
pigment{ color rgb < 1.00, 0.80, 0.10 > }
finish{ diffuse 0.9 ambient 0.1 }
}
#declare tx_espelho =
texture{
pigment{ color rgb < 1.00, 0.85, 0.30 > }
finish{ diffuse 0.2 reflection 0.7*< 1.00, 0.85, 0.30 > ambient 0.1 }
}
#declare tx_vidro =
texture{
pigment{ color rgb < 0.85, 0.95, 1.00 > filter 0.70 }
finish{ diffuse 0.03 reflection 0.25 ambient 0.02 specular 0.25 roughness 0.005 }
}
#declare tx_xadrez =
texture{
pigment{ checker color rgb < 0.10, 0.32, 0.60 >, color rgb < 1.00, 0.97, 0.90 > }
finish{ diffuse 0.9 ambient 0.1 }
scale 1.0
}
// =====================================================================
// DESCRIÇÃO DA CENA
// Partes da cena:
#declare A = array[5][5];
#declare B = array[5][5];
#declare C = array[5][5];
#declare A[1][1] = <-2.5,0,0.8>;
#declare A[1][2] = <-2.5,0,0.8>;
#declare A[1][3] = <-2.5,0,0.8>;
#declare A[1][4] = <-2.5,0,0.8>;
#declare B[1][1] = <-2.5,0,0.8>;
#declare B[1][2] = <-2.5,0,0.8>;
#declare B[1][3] = <-2.5,0,0.8>;
#declare B[1][4] = <-2.5,0,0.8>;
#declare B[4][1] = <-2.5,0,0.8>;
#declare B[4][2] = <-2.5,0,0.8>;
#declare B[4][3] = <-2.5,0,0.8>;
#declare B[4][4] = <-2.5,0,0.8>;
#declare C[4][1] = <-2.5,0,0.8>;
#declare C[4][2] = <-2.5,0,0.8>;
#declare C[4][3] = <-2.5,0,0.8>;
#declare C[4][4] = <-2.5,0,0.8>;
//Pontos Retalho A
#declare A[2][1] = <-2.5,0,0.8>;
#declare A[2][2] = <-2.5,-0.5,0.75>;
#declare A[2][3] = <-2.5,-0.5,0.3>;
#declare A[2][4] = <-2.5,0,0>;
#declare A[3][1] = <-3,0,1.3>;
#declare A[3][2] = <-3,-0.5,1.25>;
#declare A[3][3] = <-3,-0.5,0.5>;
#declare A[3][4] = <-3,0,0>;
#declare A[4][1] = <-3.5,0,2>;
#declare A[4][2] = <-3.5,-0.5,1.9>;
#declare A[4][3] = <-3.5,-0.5,0.5>;
#declare A[4][4] = <-3.5,0,0>;
//Pontos Retalho B
#declare B[2][1] = <-1,0,1>;
#declare B[2][2] = <-1,-0.8,1>;
#declare B[2][3] = <-1,-0.8,0.4>;
#declare B[2][4] = <-1.5,0,0>;
#declare B[3][1] = <-2,0,0.8>;
#declare B[3][2] = <-2,-0.5,0.8>;
#declare B[3][3] = <-2,-0.5,0.3>;
#declare B[3][4] = <-2,0,0>;
//Pontos Retalho C
#declare C[1][1] = <3.5,0,0.1>;
#declare C[1][2] = <3.5,0,0.1>;
#declare C[1][3] = <3.5,0,0.05>;
#declare C[1][4] = <3.5,0,0>;
#declare C[2][1] = <3,0,0.8>;
#declare C[2][2] = <3,-0.25,0.8>;
#declare C[2][3] = <3,-0.25,0.5>;
#declare C[2][4] = <3,0,0>;
#declare C[3][1] = <2.5,0,1.2>;
#declare C[3][2] = <2.5,-0.5,1.2>;
#declare C[3][3] = <2.5,-0.5,0.6>;
#declare C[3][4] = <2.5,0,0>;
#declare raio=0.0001;
//Estica no eixo X
#macro estica(P)
#local estic=-0.2;
// #local cons = -estic*sin(pi*P.y);
#end
//Estica no eixo X
#macro entorta(P)
#local estic=-0.2;
#local cons = -estic*sin(pi*P.y);
<0,
0,
P.x*P.x>
#end
#macro retalho1(A)
union {
object{retalho (
A[1][1],A[1][2],A[1][3],A[1][4],
A[2][1],A[2][2],A[2][3],A[2][4],
A[3][1],A[3][2],A[3][3],A[3][4],
A[4][1],A[4][2],A[4][3],A[4][4],
raio,tx_verde,tx_vermelho)
translate<0,0,0> }
}
#end
#macro retalho2(B)
union {
object{retalho (
B[1][1],B[1][2],B[1][3],B[1][4],
B[2][1],B[2][2],B[2][3],B[2][4],
B[3][1],B[3][2],B[3][3],B[3][4],
B[4][1],B[4][2],B[4][3],B[4][4],
raio,tx_verde,tx_plastico)
translate<0,0,0> }
}
#end
#macro retalho3(C)
union {
object{retalho (
C[1][1],C[1][2],C[1][3],C[1][4],
C[2][1],C[2][2],C[2][3],C[2][4],
C[3][1],C[3][2],C[3][3],C[3][4],
C[4][1],C[4][2],C[4][3],C[4][4],
raio,tx_verde,tx_fosca)
translate<0,0,0> }
}
#end
#macro aviao(d1,d2)
union{
#declare P = array[5][5];
#declare Q = array[5][5];
#declare R = array[5][5];
#declare P[2][1] = A[2][1]+estica(A[2][1])*d1 + entorta(A[2][1])*d2;
#declare P[2][2] = A[2][2]+estica(A[2][2])*d1 + entorta(A[2][2])*d2;
#declare P[2][3] = A[2][3]+estica(A[2][3])*d1 + entorta(A[2][3])*d2;
#declare P[2][4] = A[2][4]+estica(A[2][4])*d1 + entorta(A[2][4])*d2;
#declare P[3][1] = A[3][1]+estica(A[3][1])*d1 + entorta(A[3][1])*d2;
#declare P[3][2] = A[3][2]+estica(A[3][2])*d1 + entorta(A[3][2])*d2;
#declare P[3][3] = A[3][3]+estica(A[3][3])*d1 + entorta(A[3][3])*d2;
#declare P[3][4] = A[3][4]+estica(A[3][4])*d1 + entorta(A[3][4])*d2;
#declare P[4][1] = A[4][1]+estica(A[4][1])*d1 + entorta(A[4][1])*d2;
#declare P[4][2] = A[4][2]+estica(A[4][2])*d1 + entorta(A[4][2])*d2;
#declare P[4][3] = A[4][3]+estica(A[4][3])*d1 + entorta(A[4][3])*d2;
#declare P[4][4] = A[4][4]+estica(A[4][4])*d1 + entorta(A[4][4])*d2;
//Pontos Retalho B
#declare Q[2][1] = B[2][1]+estica(B[2][1])*d1 + entorta(B[2][1])*d2;
#declare Q[2][2] = B[2][2]+estica(B[2][2])*d1 + entorta(B[2][2])*d2;
#declare Q[2][3] = B[2][3]+estica(B[2][3])*d1 + entorta(B[2][3])*d2;
#declare Q[2][4] = B[2][4]+estica(B[2][4])*d1 + entorta(B[2][4])*d2;
#declare Q[3][1] = B[3][1]+estica(B[3][1])*d1 + entorta(B[3][1])*d2;
#declare Q[3][2] = B[3][2]+estica(B[3][2])*d1 + entorta(B[3][2])*d2;
#declare Q[3][3] = B[3][3]+estica(B[3][3])*d1 + entorta(B[3][3])*d2;
#declare Q[3][4] = B[3][4]+estica(B[3][4])*d1 + entorta(B[3][4])*d2;
//Pontos Retalho C
#declare R[1][1] = C[1][1]+estica(C[1][1])*d1 + entorta(C[1][1])*d2;
#declare R[1][2] = C[1][2]+estica(C[1][2])*d1 + entorta(C[1][2])*d2;
#declare R[1][3] = C[1][3]+estica(C[1][3])*d1 + entorta(C[1][3])*d2;
#declare R[1][4] = C[1][4]+estica(C[1][4])*d1 + entorta(C[1][4])*d2;
#declare R[2][1] = C[2][1]+estica(C[2][1])*d1 + entorta(C[2][1])*d2;
#declare R[2][2] = C[2][2]+estica(C[2][2])*d1 + entorta(C[2][2])*d2;
#declare R[2][3] = C[2][3]+estica(C[2][3])*d1 + entorta(C[2][3])*d2;
#declare R[2][4] = C[2][4]+estica(C[2][4])*d1 + entorta(C[2][4])*d2;
#declare R[3][1] = C[3][1]+estica(C[3][1])*d1 + entorta(C[3][1])*d2;
#declare R[3][2] = C[3][2]+estica(C[3][2])*d1 + entorta(C[3][2])*d2;
#declare R[3][3] = C[3][3]+estica(C[3][3])*d1 + entorta(C[3][3])*d2;
#declare R[3][4] = C[3][4]+estica(C[3][4])*d1 + entorta(C[3][4])*d2;
//Pontos Calculados
#declare Q[4][1] = (P[2][1]+B[3][1])/2;
#declare P[1][1] = Q[4][1];
#declare Q[4][2] = (P[2][2]+B[3][2])/2;
#declare P[1][2] = Q[4][2];
#declare Q[4][3] = (P[2][3]+B[3][3])/2;
#declare P[1][3] = Q[4][3];
#declare Q[4][4] = (P[2][4]+B[3][4])/2;
#declare P[1][4] = Q[4][4];
#declare R[4][1] = (B[2][1]+C[3][1])/2;
#declare Q[1][1] = R[4][1];
#declare R[4][2] = (B[2][2]+C[3][2])/2;
#declare Q[1][2] = R[4][2];
#declare R[4][3] = (B[2][3]+C[3][3])/2;
#declare Q[1][3] = R[4][3];
#declare R[4][4] = (B[2][4]+C[3][4])/2;
#declare Q[1][4] = R[4][4];
box{<-0.5,-3,0.3>,<0.5,3,0.5> texture{tx_branco} translate<1,0,0>}
object{retalho1(P) }
object{retalho1(P) scale<1,-1,1>}
object{retalho2(Q) }
object{retalho2(Q) scale<1,-1,1>}
object{retalho3(R) }
object{retalho3(R) scale<1,-1,1>}
}
#end
#macro interpola2(tA,A,tB,B,tt)
#local r = (tt-tA)/(tB-tA);
((1-r)*A+r*B);
#end
#macro interpola4(tA,A,B,C,D,tD,tt)
#local AB = interpola2(tA,A,tD,B,tt);
#local BC = interpola2(tA,B,tD,C,tt);
#local CD = interpola2(tA,C,tD,D,tt);
#local ABC = interpola2(tA,AB,tD,BC,tt);
#local BCD = interpola2(tA,BC,tD,CD,tt);
#local ABCD = interpola2(tA,ABC,tD,BCD,tt);
ABCD
#end
//Parametros definidos
#declare A2 = <5,0,0>;
#declare A3 = <8,10,5>;
#declare B2 = <12,0,-10>;
#declare B3 = <2,-2,15>;
#declare C2 = <-2,5,0>;
#declare C3 = <-10,-10,-20>;
#declare D2 = <6,5,-10>;
#declare D3 = <3,-2,-5>;
//Parametros calculados
#declare A1 = (A2+D3)/2;
#declare D4 = A1;
#declare A4 = (A3+B2)/2;
#declare B1 = A4;
#declare B4 = (B3+C2)/2;
#declare C1 = B4;
#declare C4 = (C3+D2)/2;
#declare D1 = C4;
#declare t1 = 0;
#declare t2 = 0.25;
#declare t3 = 0.5;
#declare t4 = 0.75;
#declare t5 = 1;
#declare angulo1 = 0;
#declare angulo2 = 45;
#declare angulo3 = 90;
#declare angulo4 = 45;
#declare angulo5 = 0;
#macro trajetoria()
#if (clock >= t1 & clock <= t2 )
#local X = interpola4(t1,A1,A2,A3,A4,t2,clock);
#local Y = interpola2(t1,angulo1,t2,angulo2,clock);
#end
#if(clock > t2 & clock <= t3)
#local X = interpola4(t2,B1,B2,B3,B4,t3,clock);
#local Y = interpola2(t2,angulo2,t3,angulo3,clock);
#end
#if(clock > t3 & clock <= t4)
#local X = interpola4(t3,C1,C2,C3,C4,t4,clock);
#local Y = interpola2(t3,angulo3,t4,angulo4,clock);
#end
#if(clock > t4 & clock <= t5)
#local X = interpola4(t4,D1,D2,D3,D4,t5,clock);
#local Y = interpola2(t4,angulo4,t5,angulo5,clock);
#end
object{aviao(0,0) translate X rotate Y}
#end
object{trajetoria()}
#declare centro_cena = < 15.00,20.00, 10.00 >;
#declare raio_cena = 30.0;
#declare dir_camera = < 10.00, 15.00, 10.00>;
#declare dist_camera = 40.0;
#declare intens_luz = 2.00;
camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)