#include "colors.inc" #include "shapes.inc" // -------- 部品 ------------------------------------------------------- // キー本体 #declare KeyBody = object { Cube scale <1, 1, 0.5> translate y*1 } // キー側面 #declare KeySide = intersection { object { Cube rotate z*45 scale <0.5/sqrt(2), 2/sqrt(2), 1> } object { Cube translate <1, 1, 0> scale <0.5, 1, 2> } } // キーエッジ部 #declare KeyEdge = intersection { object { Cone_Y scale <0.5, 1, 0.5> } object { Cube translate <1, 0, -1> } translate y*1 } // キー(左右 ±WIDTH,上下 [0, +1],前後 ±1) #macro Key(WIDTH) #local W=WIDTH-0.5; intersection { merge { merge { object { KeyBody } // 本体 object { KeySide rotate y*90 translate -z*0.5 } // 前側面 object { KeySide rotate y*270 translate z*0.5 } // 後側面 scale x*W // 左右方向に伸縮 } object { KeySide scale z*0.5 translate x*W } // 右側面 object { KeySide scale z*0.5 rotate y*180 translate -x*W } // 左側面 object { KeyEdge rotate y*0 translate < W, 0, -0.5> } // 右前角 object { KeyEdge rotate y*90 translate <-W, 0, -0.5> } // 左前角 object { KeyEdge rotate y*180 translate <-W, 0, 0.5> } // 左後角 object { KeyEdge rotate y*270 translate < W, 0, 0.5> } // 右後角 } object { Cube scale <2*WIDTH, 1, 2> } // 上半分を切り落とし pigment { color Gray70 } } #end // -------- 配置 ------------------------------------------------------- // キーボード object { Key(1) translate <-2.0, 0, 2.0> } object { Key(1) translate < 0.0, 0, 2.0> } object { Key(1) translate < 2.0, 0, 2.0> } object { Key(1) translate <-2.0, 0, 0.0> } object { Key(2) translate < 1.0, 0, 0.0> } object { Key(2) translate <-1.0, 0, -2.0> } object { Key(1) translate < 2.0, 0, -2.0> } // 座標軸 object { Cylinder_X scale 0.02 pigment{color Red} } // x軸 object { Cylinder_Y scale 0.02 pigment{color Green} } // y軸 object { Cylinder_Z scale 0.02 pigment{color Blue} } // z軸 // -------- 撮影 ------------------------------------------------------- // 背景 background {color LightBlue} // 照明 light_source { < 100, 200, -100> // 照明の位置 color White*2.0 parallel point_at <0, 0, 0> } // カメラ camera{ location <4.0, 8.0, -12.0> // カメラの位置 look_at <0.0, 0.0, 0.0> // カメラの注目する位置 angle 35 // カメラの視野角 // up <0.0, 0.0, 1.0> // right <2.00, 0.0, 0.0> }