글
2004.10.27 while을 사용한 공 여러개 그리기
강현숙님을 위한 POV-Ray에 관한 글입니다.
while문을 이용해 한 장의 그림에서 여러개의 공을 그리는 모습입니다. while문은 한 장의 그림에 여러개의 모양을 일정한 규칙성을 가지고 반복되게 그리고자 할 때 사용하는 것입니다. while은 절대로 애니메이션을 만들 때 사용하는 기법이 아니라는 점을 생각해 주세요...
그림에서는 x축으로 -5에서 +5까지 1간격으로 반지름이 0.5인 공을 연속으로 그리는 과정입니다. 제일 아래 부분의 while부분을 참고하세요.

//파이이름 : sphere2.pov
#include "colors.inc"
global_settings {
assumed_gamma 1.0
max_trace_level 5
}
camera {
location <0.0, 3, -5.0>
right x*image_width/image_height
look_at <0.0, 0.0, 0.0>
}
sky_sphere {
pigment {
gradient y
color_map {
[0.0 rgb <0.6,0.7,1.0>]
[0.7 rgb <0.0,0.1,0.8>]
}
}
}
light_source {
<0, 0, 0>
color rgb <1, 1, 1>
translate <-30, 30, -30>
}
plane {
y, -1
texture
{
pigment {
checker
color rgb 1
color blue 1
scale 0.5
}
finish{
diffuse 0.8
ambient 0.1
}
}
}
#declare Ball = sphere {
<0, 0, 0>, 0.5
texture {
pigment {
color rgb <0.8,0.8,1.0>
}
finish{
diffuse 0.3
ambient 0.0
specular 0.6
reflection {
0.8
metallic
}
conserve_energy
}
}
}
#declare Step = 1;
#declare X = -5;
#declare EndX = 5;
#while (X <(EndX + Step))
object { Ball translate <X, 0, 0> }
#declare X = X + Step;
#end
'과학이야기 > 발명-과학기타' 카테고리의 다른 글
2004.10.27 카메라를 움직이는 애니메이션 (0) | 2004.10.27 |
---|---|
2004.10.27 공의 위치변화 에니메이션 (1) | 2004.10.27 |
2004.10.27 반짝이는 공 그리기 (0) | 2004.10.27 |
2004.07.05 로켓 날리기 (6) | 2004.07.05 |
2004.06.25 [POV-Ray] 과녁을 맞춰보자... (2) | 2004.06.25 |