//========================================================================================= #version 3.6; global_settings { assumed_gamma 1.0 } // ---------------------------------------- camera { location <0.0, 0.5, -10.0> direction 1.5*z 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> // light's position (translated below) color rgb <1, 1, 1> // light's color translate <-30, 30, -30> } // ---------------------------------------- plane { y, -5 pigment { color rgb <0.7,0.5,0.3> } } /*Just change the rotation values (upparm_r, forarm_r, and hand_r) and everything moves accordingly. Is this inverse or forward kinematics, or have I got the whole idea wrong? Oh, and please excuse my bad coding but I prefer to get something working first and then worry about whether it's badly written or not.*/ #include "colors.inc" camera {location <0,0,-6> look_at <0,0,0>} light_source {<0,0,-20> color White} background {color Blue} #declare upparm_l=<0,-1.7,0>; //Upperarm length #declare forarm_l=<0,-2,0>; //Forearm length #declare shoulder=sphere {<0,0,0>,0.4 pigment {color Red} finish {phong 1}} #declare upparm=cylinder {<0,0,0>,upparm_l,0.3 pigment {color Yellow} finish {phong 1}} #declare elbow=sphere {<0,0,0>,0.35 pigment {color Green} finish {phong 1}} #declare forarm=cone {<0,0,0>,0.3,forarm_l,0.25 pigment {color Yellow} finish {phong 1}} #declare wrist=sphere {<0,0,0>,0.3 pigment {color White} finish {phong 1}} #declare hand=sphere {<0,0,0>,0.5 scale <1,1.5,1> pigment {color Orange} finish {phong 1} translate y*-0.7} #declare upparm_r=<0,0,0>; //Upperarm rotation (about shoulder) #declare forarm_r=<0,0,5>; //Forearm rotation (about elbow) #declare hand_r=<0,0,0>; //Hand rotation (about wrist) union { object {shoulder} object {upparm rotate upparm_r} object {elbow translate upparm_l rotate upparm_r} object {forarm rotate forarm_r translate upparm_l rotate upparm_r} object {wrist translate forarm_l rotate forarm_r translate upparm_l rotate upparm_r} object {hand rotate hand_r translate forarm_l rotate forarm_r translate upparm_l rotate upparm_r} translate y*2.5 translate z*25 } //============================================================================================================= #declare RightUpperarm = lathe { cubic_spline 4 // control points <0.3, -6.0>, <0.6, -4.5>, <0.65, 0.0>, <-1.5, 9.0> rotate <90,0,90> // All transformations fixed } #declare RightLowerarm = lathe { cubic_spline 4 // control points <0.3, -6.0>, <0.5, -4.3>, <0.55, 0.0>, <-1.6, 9.0> rotate <90,0,90> // All transformations fixed } //-------------------------------------------------- #declare R_HAND_JOINT_Zrot = intersection { sphere { // RightPalm <0,0,0>,1 // All transformations fixed scale <0.55, 0.55, 1.25> } box { // RightPalmIntersection <-1, -1, -1>, <1, 1, 1> // All transformations fixed scale <0.4, 0.65, 1.3> rotate 15.0*y translate <-0.3, 0.0, 0.1> } bounded_by { // Bound00096 box { <-1.0, -1.0, -1.0>, <1.0, 1.0, 1.0> scale <0.822166, 0.687255, 1.396486> translate <-0.237924, 0.0, 0.1> } } // Scaling fixed // Rot Z limited (-90.0 to 90.0) // Translation fixed rotate 8.261403*z translate -1.5*z } #declare R_WRIST_JOINT_Yrot = union { sphere { // RightWrist <0,0,0>,1 // All transformations fixed scale 0.5 } object { R_HAND_JOINT_Zrot } // Scaling fixed // Rot Y limited (-90.0 to 45.0) // Translation fixed rotate -18.897455*y translate -4.6*z } #declare R_LOWERARM_JOINT_Yrot = union { object { RightLowerarm } object { R_WRIST_JOINT_Yrot } translate -0.35*z // Scaling fixed // Rot Y limited (-90.0 to 20.0) // Translation fixed rotate 7.211936*y } #declare R_ELBOW_JOINT_Xrot = union { sphere { // RightElbow <0,0,0>,1 // All transformations fixed scale 0.55 } object { R_LOWERARM_JOINT_Yrot } // Scaling fixed // Rot X limited (-150.0 to 0.0) // Translation fixed rotate -39.631805*x translate -4.8*z } #declare R_UPPERARM_JOINT_Yrot = union { object { RightUpperarm } object { R_ELBOW_JOINT_Xrot } translate -0.58*z // Scaling fixed // Rot Y limited (-45.0 to 179.0) // Translation fixed rotate 25.64633*y } #declare R_SHOULDER_JOINT_Xrot = union { sphere { // RightShoulder <0,0,0>,1 // All transformations fixed scale <0.9, 0.75, 0.75> } object { R_UPPERARM_JOINT_Yrot } // Scaling fixed // Rot X limited (-179.0 to 70.0) // Translation fixed rotate -19.843288*x translate <-2.7, 0.0, 3.5> } object {R_SHOULDER_JOINT_Xrot scale <1,1,-1> rotate <90,0,0> translate 25*z pigment {rgb 0.5} }