Last updated: March 2008. Kajiyama             [ 目次に戻る ]

連格子を #declare #whileで作る


サンプル box08A.pov

//box08A.pov
// POV-Ray 3.6 scene file by Kajiyama

#include "colors.inc"
#include "shapes.inc"

//カメラ設定
camera{
    location <4,8,-30>
    look_at <5,4,3>
    angle 35
}
//ライト設定
light_source{
    <15,30,-20> color White*1.9
}

// XYZ座標空間
// チェック柄の床
object{
    Plane_XZ
    pigment{checker color Gray color White*0.9}
    translate <0,-0.5,0>
}

// 座標系の表示
// Z軸
cylinder{<0,0,-5>,<0,0,10>,0.05
pigment{color Red}
finish{phong 1 reflection 0.1}
}
cone{<0,0,10>,0.3
<0,0,11.5>,0
pigment{color Red}
}
// Z文字
cylinder{<-0.5,0.5,0>,<0.5,0.5,0>,0.08
pigment{color Red}
finish{phong 1 reflection 0.1}
translate <0,1.1,12>
}
cylinder{<0.5,0.5,0>,<-0.5,-0.5,0>,0.08
pigment{color Red}
finish{phong 1 reflection 0.1}
translate <0,1.1,12>
}
cylinder{ <-0.5,-0.5,0>, <0.5,-0.5,0>,0.08
pigment{color Red}
finish{phong 1 reflection 0.1}
translate <0,1.1,12>
}
// X軸
cylinder{<-5,0,0>,<12,0,0>,0.05
pigment{color Green}
finish{phong 1 reflection 0.1}
}
cone{<12,0,0>,0.3
<13.5,0,0>,0
pigment{color Green}
}
// X文字
cylinder{<-0.5,-0.5,0>,<0.5,0.5,0>,0.08
pigment{color Green}
finish{phong 1 reflection 0.1}
rotate y*90
translate <13,1.1,0>
}
cylinder{ <-0.5,0.5,0>, <0.5,-0.5,0>,0.08
pigment{color Green}
finish{phong 1 reflection 0.1}
rotate y*90
translate <13,1.1,0>
}

// Y軸
cylinder{<0,-5,0>,<0,7,0>,0.05
pigment{color Blue}
finish{phong 1 reflection 0.1}
}
cone{<0,7,0>,0.3
<0,8.5,0>,0
pigment{color Blue}
}
// Y文字
cylinder{<-0.5,0.5,0>,<0,0,0>,0.08
pigment{color Blue}
finish{phong 1 reflection 0.1}
translate <0,9,0>
}
cylinder{<0.5,0.5,0>,<0,0,0>,0.08
finish{phong 1 reflection 0.1}
translate <0,9,0>
}
cylinder{ <0,0,0>, <0,-0.5,0>,0.08
pigment{color Blue}
finish{phong 1 reflection 0.1}
translate <0,9,0>
}

//■■■ボックスの図形操作■■■
box{<0,0,0>,<0.1,10,5>
pigment{color Red} //オリジナル
}

//縦桟平行移動
#declare K=1;
#while(K<12)
box{<0,0,0>,<0.1,10,5>
pigment{color Red}
translate<1+K*1,0,2>//移動先の座標を指定
}
#declare K=K+1;
#end

//横桟平行移動
#declare K=0;
#while(K<11)
box{<0,0,0>,<0.1,10,5>
pigment{color Red}
rotate z*-90
translate<2,K*1+0.1,2>//移動先の座標を指定
}
#declare K=K+1;
#end

//ずれた分の補正

box{<0,0,0>,<0.1,10,5>
pigment{color Red}
scale <1,1.01,1>
rotate z*-90

translate<2,10*1+0.1,2>//移動先の補正
}

background{color White}

サンプル box08B.pov

//box08B.pov
// POV-Ray 3.6 scene file by Kajiyama

#include "colors.inc"
#include "shapes.inc"

//カメラ設定
camera{
    location <4,8,-30>
    look_at <5,4,3>
    angle 35
}
//ライト設定
light_source{
    <15,30,-20> color White*1.9
}

// XYZ座標空間
// チェック柄の床
object{
    Plane_XZ
    pigment{checker color Gray color White*0.9}
    translate <0,-0.5,0>
}

// 座標系の表示
// Z軸
cylinder{<0,0,-5>,<0,0,10>,0.05
pigment{color Red}
finish{phong 1 reflection 0.1}
}
cone{<0,0,10>,0.3
<0,0,11.5>,0
pigment{color Red}
}
// Z文字
cylinder{<-0.5,0.5,0>,<0.5,0.5,0>,0.08
pigment{color Red}
finish{phong 1 reflection 0.1}
translate <0,1.1,12>
}
cylinder{<0.5,0.5,0>,<-0.5,-0.5,0>,0.08
pigment{color Red}
finish{phong 1 reflection 0.1}
translate <0,1.1,12>
}
cylinder{ <-0.5,-0.5,0>, <0.5,-0.5,0>,0.08
pigment{color Red}
finish{phong 1 reflection 0.1}
translate <0,1.1,12>
}
// X軸
cylinder{<-5,0,0>,<12,0,0>,0.05
pigment{color Green}
finish{phong 1 reflection 0.1}
}
cone{<12,0,0>,0.3
<13.5,0,0>,0
pigment{color Green}
}
// X文字
cylinder{<-0.5,-0.5,0>,<0.5,0.5,0>,0.08
pigment{color Green}
finish{phong 1 reflection 0.1}
rotate y*90
translate <13,1.1,0>
}
cylinder{ <-0.5,0.5,0>, <0.5,-0.5,0>,0.08
pigment{color Green}
finish{phong 1 reflection 0.1}
rotate y*90
translate <13,1.1,0>
}

// Y軸
cylinder{<0,-5,0>,<0,7,0>,0.05
pigment{color Blue}
finish{phong 1 reflection 0.1}
}
cone{<0,7,0>,0.3
<0,8.5,0>,0
pigment{color Blue}
}
// Y文字
cylinder{<-0.5,0.5,0>,<0,0,0>,0.08
pigment{color Blue}
finish{phong 1 reflection 0.1}
translate <0,9,0>
}
cylinder{<0.5,0.5,0>,<0,0,0>,0.08
finish{phong 1 reflection 0.1}
translate <0,9,0>
}
cylinder{ <0,0,0>, <0,-0.5,0>,0.08
pigment{color Blue}
finish{phong 1 reflection 0.1}
translate <0,9,0>
}


//■■■ボックスの図形操作■■■
box{<0,0,0>,<0.1,10,0.2>
pigment{color Red} //オリジナル
}

//縦桟平行移動
#declare K=1;
#while(K<12)
box{<0,0,0>,<0.1,10,0.2>
pigment{color Red}
translate<1+K*1,0,2>//移動先の座標を指定
}
#declare K=K+1;
#end

//横桟平行移動
#declare K=0;
#while(K<11)
box{<0,0,0>,<0.1,10,0.2>
pigment{color Red}
rotate z*-90
translate<2,K*1+0.1,2>//移動先の座標を指定
}
#declare K=K+1;
#end

//ずれた分の補正

box{<0,0,0>,<0.1,10,0.2>
pigment{color Red}
scale <1,1.01,1>
rotate z*-90

translate<2,10*1+0.1,2>//移動先の補正
}

background{color White}


[ 目次に戻る ]