// // Script to draw a 3D man (height 180cm) in a 3D view. // Copyright (C) 2007 Christian Holm Christensen // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later // version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free // Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, // MA 02110-1301 USA // void DrawMan(Double_t x0, Double_t y0, Double_t z0, Int_t color) { // Draw a 3D man using TMarker3DBox (not in the geometry proper), at // (x0,y0,z0) with the color color. Double_t height = 180; TVector3 head(20, 25, 20); TVector3 neck(15, 8, 15); TVector3 torso(40, 66, 30); TVector3 upperArm(8,36,8); TVector3 lowerArm(8,30,8); TVector3 thigh(15,46,15); TVector3 shin(12,30,12); TVector3 foot(10,5,25); Double_t degrad = TMath::Pi()/180.; Double_t x = x0; Double_t y = y0 + height-head.Y()/2; Double_t z = z0; TMarker3DBox* headB = new TMarker3DBox(x, y, z,head.X()/2,head.Y()/2,head.Z()/2,10,2); headB->SetLineColor(color); headB->Draw(); y -= head.Y()/2+neck.Y()/2; TMarker3DBox* neckB = new TMarker3DBox(x,y,z, neck.X()/2,neck.Y()/2,neck.Z()/2,0,0); neckB->SetLineColor(color); neckB->Draw(); Double_t y1 = y - neck.Y() - TMath::Cos(30*degrad)*upperArm.Y()/2; Double_t x1 = ((torso.X()+upperArm.X())/2+ TMath::Sin(30*degrad)*upperArm.Y()/2); TMarker3DBox* upperArmB1 = new TMarker3DBox(x0-x1,y1,z, upperArm.X()/2,upperArm.Y()/2,upperArm.Z()/2, 0,-30); upperArmB1->SetLineColor(color); upperArmB1->Draw(); TMarker3DBox* upperArmB2 = new TMarker3DBox(x0+x1,y1,z, upperArm.X()/2,upperArm.Y()/2,upperArm.Z()/2, 0,30); upperArmB2->SetLineColor(color); upperArmB2->Draw(); y1 -= upperArm.Y()/2 + lowerArm.Y()/2; TMarker3DBox* lowerArmB1 = new TMarker3DBox(x0-x1,y1,z, lowerArm.X()/2,lowerArm.Y()/2,lowerArm.Z()/2, 0,30); lowerArmB1->SetLineColor(color); lowerArmB1->Draw(); x1 += lowerArm.X(); TMarker3DBox* lowerArmB2 = new TMarker3DBox(x0+x1,y1,z, lowerArm.Z()/2,lowerArm.X()/2,lowerArm.Y()/2, -80,80); lowerArmB2->SetLineColor(color); lowerArmB2->Draw(); y -= neck.Y()/2+torso.Y()/2; TMarker3DBox* torsoB = new TMarker3DBox(x, y, z, torso.X()/2,torso.Y()/2,torso.Z()/2,0,0); torsoB->SetLineColor(color); torsoB->Draw(); y -= torso.Y()/2+thigh.Y()/2; x = (torso.X() - thigh.X())/2; TMarker3DBox* thighB1 = new TMarker3DBox(x0-x,y,z, thigh.X()/2,thigh.Y()/2,thigh.Z()/2,0,0); thighB1->SetLineColor(color); thighB1->Draw(); TMarker3DBox* thighB2 = new TMarker3DBox(x0+x,y,z,thigh.Z()/2,thigh.X()/2,thigh.Y()/2,80,-80); thighB2->SetLineColor(color); thighB2->Draw(); y -= thigh.Y()/2+shin.Y()/2; TMarker3DBox* shinB1 = new TMarker3DBox(x0-x,y,z, shin.X()/2,shin.Y()/2,shin.Z()/2,0,0); shinB1->SetLineColor(color); shinB1->Draw(); x += TMath::Sin(10*degrad)*thigh.X(); z += TMath::Sin(10*degrad)*thigh.Z(); TMarker3DBox* shinB2 = new TMarker3DBox(x0+x,y,z, shin.X()/2,shin.Y()/2,shin.Z()/2,0,0); shinB2->SetLineColor(color); shinB2->Draw(); y -= shin.Y()/2+foot.Y()/2; x = (torso.X() - thigh.X())/2; z = z0 + foot.Z()/2 - shin.Z()/2; TMarker3DBox* footB1 = new TMarker3DBox(x0-x,y,z, foot.X()/2,foot.Y()/2,foot.Z()/2,0,0); footB1->SetLineColor(color); footB1->Draw(); x += TMath::Sin(10*degrad)*thigh.X(); z += TMath::Sin(10*degrad)*thigh.X(); TMarker3DBox* footB2 = new TMarker3DBox(x0+x,y,z, foot.X()/2,foot.Y()/2,foot.Z()/2,0,0); footB2->SetLineColor(color); footB2->Draw(); } // // EOF //