// ピク太郎(ピクトグラム男)パーツ定義ファイル Ver.2022.05.17 // by yanagawa@kushiro-ct.ac.jp // 2022.05.16: 左右足位置算出.例:translate -LeftFootPos で左足を原点に移動(着地) // 2022.05.17: 履物基準位置変更.足先→足首 #include "shapes.inc" // 基本形状の組み込み #include "colors.inc" // 色名の組み込み // 腕の寸法 #declare ArmR1 = 0.075; // 根本部分(肩)の半径 #declare ArmR2 = ArmR1/2; // 先端部分(手首/拳)の半径 #declare ArmSegL = 0.30; // 各部の長さ // 脚・腰の寸法 #declare LegR1 = 0.10; // 根本部分(股)の半径 #declare LegR2 = LegR1/2; // 先端部分(足首/踵)の半径 #declare LegSegL = 0.40; // 各部の長さ #declare HipW = LegR1*4 + 0.0; // 腰の幅 // 手・足の寸法 #declare HandR = ArmR2; // 拳の半径 #declare FootR = LegR2; // 足の半径 // 胴の寸法 #declare TorsoH = 0.45; // 胴の上下幅(腰-鎖骨の中心間) #declare TorsoW1 = HipW - LegR1*0.5; // 胴下側(腰部分)の横幅 #declare TorsoW2 = HipW + ArmR1*0.5; // 胴上側(肩・胸部分)の横幅 #declare SHR = TorsoW2/TorsoW1; // 肩幅/腰幅比(shoulder to hip ratio) #declare TorsoD1 = LegR1*2; // 胴下側(腰部分)の前後幅 #declare TorsoD2 = TorsoD1*SHR; // 胴上側(胸部分)の前後幅 // 頭・首の寸法 #declare HeadR = 0.15; // 頭の半径 #declare NeckL = 0.25; // 首の長さ(鎖骨〜頭の中心間) #declare NeckR = 0.075; // 首の半径 // 身長 = HeadR + NeckL + TorsoH + LegL = 1.70 [m] // 部品の取り付け位置 #declare LegX = HipW/2 - LegR1; // 脚のx座標 #declare ArmX = TorsoW2/2; // 腕のx座標 #declare ArmY = TorsoH; // 腕のy座標 #declare HeadY = TorsoH + NeckL; // 頭のy座標 // 色 #declare Color1 = White; #declare Color2 = Navy; // 頭(基準点:中心) #declare Head = object { Sphere scale HeadR pigment { color Color2 } } // 首(基準点:鎖骨の中心) #declare Neck = object { Sphere scale } // 胴(基準点:腰の中心)+首 #declare Torso = union { object { Round_Cone2(y*TorsoH, TorsoD2/2, y*LegR1, TorsoD1/2, 0) scale } // 本体 object { Neck translate y*TorsoH } // 首 pigment { color Color1 } } // 腰(基準点:腰の中心) #declare Hip = object { Disk_X scale pigment { color Color2 } } // 腕の部品 #declare ArmR = (ArmR1 + ArmR2)/2; // 中央部分の半径 #declare ArmL = ArmSegL*2 + ArmR2; // 全体の長さ #declare ArmSeg1 = object { Round_Cone2(0*y, ArmR1, -ArmSegL*y, ArmR, 0) } // 上腕 #declare ArmSeg2 = object { Round_Cone2(0*y, ArmR, -ArmSegL*y, ArmR2, 0) } // 前腕 // 腕の原型(基準点:肩関節中心) #macro Arm(A, Eqp) union { object { ArmSeg1 } // 上腕 union { object { ArmSeg2 } // 前腕 object { Eqp translate -ArmSegL*y } // 持物 rotate A*x translate -ArmSegL*y // 肘の屈曲 } rotate -x*A/2 // 上腕を後へ引き,手を真下に pigment { color Color2 } } #end // 左右の腕 // A:肘を曲げる(腕を縮める)角度 // Y:肘を外へ張る(脇を開ける)角度 // Z:腕を横へ開く(羽ばたく)角度 // X:腕を前へ出す(腕を振る)角度 // Eqp:手に持つ用具等のオブジェクト #macro LeftArm(A, Y, Z, X, Eqp) object { Arm(A, Eqp) rotate Y*y rotate Z*z rotate X*x translate < ArmX, ArmY, 0> } #end #macro RightArm(A, Y, Z, X, Eqp) object { Arm(A, Eqp) rotate -Y*y rotate -Z*z rotate X*x translate <-ArmX, ArmY, 0> } #end /* 使用例: RightArm(0, 0, 0, 90, object { Baton rotate 45 }) LeftArm(45, 0, -45, -90, object { Null }) */ // 脚の部品 #declare LegR = (LegR1 + LegR2)/2; // 中央部分の半径 #declare LegL = LegSegL*2 + LegR2; // 全体の長さ #declare LegSeg1 = object { Round_Cone2(0*y, LegR1, -LegSegL*y, LegR, 0) } // 大腿 #declare LegSeg2 = object { Round_Cone2(0*y, LegR, -LegSegL*y, LegR2, 0) } // 下腿 // 脚の原型(基準点:股関節中心) #macro Leg(A, Eqp) union { object { LegSeg1 } // 大腿 union { object { LegSeg2 } // 下腿 // object { Eqp translate -(LegSegL + LegR2)*y } // 履物 object { Eqp translate -LegSegL*y } // 履物 ver20220517 rotate -x*A translate -LegSegL*y // 膝の屈曲 } rotate x*A/2 // 大腿を上げ,足を真下に pigment { color Color2 } } #end // 左右の脚 // A:膝を曲げる(脚を縮める)角度 // Y:膝を外へ張る(足の向きを変える)角度 // Z:脚を横へ開く角度 // X:脚を前へ出す角度 // Eqp:足に履く用具等のオブジェクト #macro LeftLeg(A, Y, Z, X, Eqp) object { Leg(A, Eqp) rotate -Y*y rotate Z*z rotate X*x translate LegX*x } #local R1 = LegSegL*2*cos(radians(A/2)); #local R2 = R1*cos(radians(Z)); #local PX = R1*sin(radians(Z)) + LegX; #local PY = R2*cos(radians(X)); #local PZ = R2*sin(radians(X)); #declare LeftAnklePos = ; // 左足首の位置 #declare LeftFootPos = LeftAnklePos - y*FootR; // 左足の位置 #end #macro RightLeg(A, Y, Z, X, Eqp) object { Leg(A, Eqp) rotate Y*y rotate -Z*z rotate X*x translate -LegX*x } #local R1 = LegSegL*2*cos(radians(A/2)); #local R2 = R1*cos(radians(Z)); #local PX = R1*sin(radians(Z)) + LegX; #local PY = R2*cos(radians(X)); #local PZ = R2*sin(radians(X)); #declare RightAnklePos = <-PX, -PY, -PZ>; // 右足首の位置 #declare RightFootPos = RightAnklePos - y*FootR; // 右足の位置 #end // 無(持物,履物) #declare Null = union { } /* // 選手全体の組み立て例 #declare Pictaro = union { union { // 上体 object { Torso } object { Head translate y*HeadY } object { LeftArm(0, 0, 0, 0, Null) } object { RightArm(0, 0, 0, 0, Null) } rotate -0*x // 上体前傾 } object { LeftLeg(0, 0, 0, 0, Null) } object { RightLeg(0, 0, 0, 0, Null) } } */