Manakin
Human Stick Figure
Last updated
Human Stick Figure
Last updated
basePoint=Point.Origin();
h=stature;
s=Point.ByCartesianCoordinates(CoordinateSystem.ByOrigin(basePoint),-0.0955*h,0,0);
dirX=Vector.XAxis();
dirY=Vector.YAxis();
dirZ=Vector.ZAxis();
sll1=Line.ByStartPointDirectionLength(s,dirZ,0.039*h);
sll2=Line.ByStartPointDirectionLength(sll1.EndPoint,dirZ,0.246*h);
dlkn=seated?dirY.Reverse():dirZ;
sll3=Line.ByStartPointDirectionLength(sll2.EndPoint,dlkn,0.245*h);
shp1=Line.ByStartPointDirectionLength(sll3.EndPoint,dirX,0.191*h);
drkn=seated?dirY:dirZ.Reverse();
slr3=Line.ByStartPointDirectionLength(shp1.EndPoint,drkn,0.245*h);
slr2=Line.ByStartPointDirectionLength(slr3.EndPoint,dirZ.Reverse(),0.246*h);
slr1=Line.ByStartPointDirectionLength(slr2.EndPoint,dirZ.Reverse(),0.039*h);
ssp1=Line.ByStartPointDirectionLength(shp1.PointAtParameter(0.5),dirZ,0.288*h);
slh1=Line.ByStartPointDirectionLength(ssp1.EndPoint,dirX.Reverse(),0.1295*h);
slh2=Line.ByStartPointDirectionLength(slh1.EndPoint,dirZ.Reverse(),0.186*h);
slh3=Line.ByStartPointDirectionLength(slh2.EndPoint,elbowBent?dirY:dirZ.Reverse(),0.146*h);
slh4=Line.ByStartPointDirectionLength(slh3.EndPoint,elbowBent?dirY:dirZ.Reverse(),0.108*h);
srh1=Line.ByStartPointDirectionLength(ssp1.EndPoint,dirX,0.1295*h);
srh2=Line.ByStartPointDirectionLength(srh1.EndPoint,dirZ.Reverse(),0.186*h);
srh3=Line.ByStartPointDirectionLength(srh2.EndPoint,elbowBent?dirY:dirZ.Reverse(),0.146*h);
srh4=Line.ByStartPointDirectionLength(srh3.EndPoint,elbowBent?dirY:dirZ.Reverse(),0.108*h);
chn1=Line.ByStartPointDirectionLength(ssp1.EndPoint,dirZ,0.051*h);
hed1=Circle.ByCenterPointRadiusNormal((chn1.EndPoint).Translate(dirZ,h*0.0655),h*0.0655,dirY);
sktn=[sll1,sll2,sll3,shp1,slr3,slr2,slr1,ssp1,slh1,slh2,slh3,slh4,srh1,srh2,srh3,srh4,chn1,hed1];
psnrt=sktn.Rotate(basePoint,dirZ,rotate);
//Reach boundary extents
rlxl=1.1;
rlxh=1.2;
rchll=Surface.ByPatch(Circle.ByCenterPointRadiusNormal(shp1.StartPoint,0.530*h*rlxl,dirY));
rchrl=Surface.ByPatch(Circle.ByCenterPointRadiusNormal(shp1.EndPoint,0.530*h*rlxl,dirY));
rchlh=Surface.ByPatch(Circle.ByCenterPointRadiusNormal(slh1.StartPoint,0.440*h*rlxh,dirY));
rchrh=Surface.ByPatch(Circle.ByCenterPointRadiusNormal(srh1.StartPoint,0.440*h*rlxh,dirY));
rchsol1=Solid.ByUnion([rchll.Thicken(h*0.001,true),rchrl.Thicken(h*0.001,true),rchlh.Thicken(h*0.001,true),rchrh.Thicken(h*0.001,true)]);
rchsol=rchsol1.Trim(Plane.ByOriginNormal(basePoint,Vector.ZAxis()),basePoint.Add(Vector.ByCoordinates(0,0,-1)));
rchsur=rchsol.Intersect(Plane.ByOriginNormal(rchsol1.Centroid(),Vector.YAxis()));
rchper=Flatten(rchsur.PerimeterCurves());
rchpnt1=Flatten(rchper<1><2>.PointAtParameter(0.1..0.9..#6)<1>);
rchpnt=rchpnt1.Rotate(basePoint,dirZ,rotate);
rchcur=NurbsCurve.ByControlPoints(rchpnt,3,true);
skull = 300;
frhed = 200;
shldr = 500;
uparm = 300;
lwarm = 300;
torso = 650;
waist = 350;
femur = 500;
tibia = 500;
fooot = 150;
headAn = -5;
trsoAn = -30;
ftTbAn = 30;
tbFmAn = 150;
vct01 = Vector.ZAxis().Rotate(Vector.XAxis(),[headAn,trsoAn,tbFmAn,ftTbAn]);
toe01 = Point.Origin();
ank01 = toe01.Translate(Vector.YAxis(),fooot);
kne01 = ank01.Translate(vct01[3].Reverse(),tibia);
hip01 = kne01.Translate(Vector.YAxis(),femur);
tor01 = hip01.Translate(vct01[1],torso);
hed01 = tor01.Translate(vct01[0],skull);
// head
hed02 = hed01.Translate(Vector.XAxis(),[frhed/2,-frhed/2]);
hed03 = PolyCurve.ByPoints(List.Flatten([hed02,tor01],-1),true).Explode();
// torso
tor02 = tor01.Translate(Vector.XAxis(),[shldr/2,-shldr/2]);
hip02 = hip01.Translate(Vector.XAxis(),[waist/2,-waist/2]);
tor03 = PolyCurve.ByPoints(List.Flatten([tor02,List.Reverse(hip02)],-1),true).Explode();
// arm
arm01 = tor02.Translate(Vector.ByCoordinates(0,-1,-1),uparm).Translate(Vector.ByCoordinates([1,-1],0,0),100);
arm02 = arm01.Translate(Vector.YAxis(),-lwarm);
arm03 = PolyCurve.ByPoints(List.Transpose([tor02,arm01,arm02]),false);
// legs
leg01 = PolyCurve.ByPoints([hip01,kne01,ank01,toe01],false).Translate(Vector.XAxis(),[waist/2,-waist/2]);
List.Flatten([hed03,tor03,arm03,leg01].Explode(),-1);