|
|
"jr" <cre### [at] gmailcom> wrote:
>
> Leroy:
>
> your code is compiled for Windows, which I do not have. have you published the
> source?
>
>
> regards. jr.
I need to clean it up a bit.
Right now I have several POV files. A few for placing and making pulleys and
then of course the mesh belt.
I've been thinking of making a pulley belt system along the lines of Eagle
started. The trouble with pulleys is that they really start with the
belt/rope/chain they use. I've been playing with the standard V belt. There is a
lot of files! I got to go to work Now. So I'll just drop a few here to make a
mesh belt.
Have Fun!
// belt maker.pov
// make mesh2 belt
// Vers: 3.7
// Auth: Leroy Whetstone
// Email whe### [at] gmailcom
//====================================================================
#version 3.7;
global_settings {assumed_gamma 1 max_trace_level 20}
#include "colors.inc"
#include "finish.inc"
#include "Math.inc"
#include"Macs.inc"
camera{ orthographic
location <10,2.5,-10>
look_at <0,2.5,0>
right x*15//image_width/image_height
up y*15
}
/*/ Test camera
camera{ orthographic
location <-2.19942,-5.1885,1>
look_at <-2.19942,-3.1885,0>
right x*2//image_width/image_height
up y*2
}
*/
//#default{ finish{ambient .5}}
light_source{<0,0,-10> color White}
light_source{<0,20,10> color White}
light_source{<0,-20,-10> color White}
background{Pink}
//================================= Change
====================================================
#include"V8dat.inc"//Pulley & belt placement data
// belt shape
#declare L1=5/16;
#declare L2=L1;
#declare T1=8/16;
#declare T4=4/16;
#declare Dc=.1;//mesh cut size
#declare Teeth=no;// y/n tooth belt
#declare Twid= 8/16;//tooth width
#declare Tspc= 4/16;//space between teeth
#declare Rate=.1;//test animation
#declare Dr=1;//animation test direction
#declare SaveMesh="Belt1.inc";//Belt1.inc save Mesh for including
#declare Remark="Testing";//remark for save
//=========================== end of Change
====================================================
//-------------============== Belt mesh Shape / uv pigment_map values
===========----------------
//#declare
Mase=array[6]{<0,-T1/2,L2>,<0,-T1/2,0>,<0,-T4/2,-L1>,<0,T4/2,-L1>,<0,T1/2,0>,<0,T1/2,L2>}
#declare
Mase=array[6]{<0,L2,-T1/2>,<0,0,-T1/2>,<0,-L1,-T4/2>,<0,-L1,T4/2>,<0,0,T1/2>,<0,L2,T1/2>}
#declare PL=L2+L1+T4+L1+L2+T1;
#declare BPase=array[7];
#declare BPase[0]=0; #debug concat("\n___ Belt texture Map Points___\nBPase[0]
=",str(BPase[0],3,3),"\n")
#declare BPase[1]=L2/PL; #debug concat("BPase[1] =",str(BPase[1],3,3),"\n")
#declare BPase[2]=(L2+L1)/PL; #debug concat("BPase[2] =",str(BPase[2],3,3),"\n")
#declare BPase[3]=(L2+L1+T4)/PL; #debug concat("BPase[3]
=",str(BPase[3],3,3),"\n")
#declare BPase[4]=(L2+L1+T4+L2)/PL; #debug concat("BPase[4]
=",str(BPase[4],3,3),"\n")
#declare BPase[5]=(L2+L1+T4+L2+L1)/PL;#debug concat("BPase[5]
=",str(BPase[5],3,3),"\n")
#declare BPase[6]=(L2+L1+T4+L2+L1+T1)/PL;#debug concat("BPase[6]
=",str(BPase[6],3,3),"\n")
//-------------============== clac Belt length
======================------------------------
#declare Ang=array[Pnts];
#declare Plen=array[Pnts];
#declare TL=0;
#for(I,0,Pnts-1)
#declare TL=TL+vlength(Bpnts[0][I]-Bpnts[1][I]);
//sphere{Bpnts[0][i]-z*Bsize,.2}
//sphere{Bpnts[1][i]-z*Bsize,.2 pigment{rgb 1}}
#end
//#debug concat("LineLength =",str(TL,3,3),"\n")
#for(I,0,Pnts-1)
#declare J=Rod(I+1,Pnts);
#declare W1=Bpnts[1][I]-Loc[J]; #declare W2=Bpnts[0][J]-Loc[J];
#declare A=VAngleD(W1,W2);
#if(Type[J]) //check for super wide
#if(vlength((Bpnts[1][I]+Bpnts[0][J])/2)<vlength(Loc[J]))
#declare A=(360-A); //#debug concat("i1 =",str(J,0,0),"\n")
//sphere {(Bpnts[1][i]+Bpnts[0][J])/2-Bsize*z,.2}
#end
#else
#if(vlength((Bpnts[1][I]+Bpnts[0][J])/2)>vlength(Loc[J]))
#declare A=(360-A); //#debug concat("i2 =",str(J,0,0),"\n")
#end
#end
//#debug concat(str(J,0,0)," A =",str(A,3,3)," ")
#declare Ang[J]=A;
#declare A=A/360;
#declare D=2*Rad[J]; //#debug concat("D =",str(D*pi,9,6)," L
=",str(D*pi*A,-9,6)," A =",str(A,-9,6),"\n")
#declare Plen[J]=D*pi*A;
#declare TL=TL+(D*pi*A);
#end
#debug concat("\nBelt Length =",str(TL,3,3),"\n")
//#debug concat("Tri_Points =",str(int(TL/Dc+.5)*6,3,3),"\n")
//-------------============== End of clac Belt length
======================------------------------
//---------------------================= Points
============================--------------
#declare MaxMpnts=int(TL/Dc+.5)*6;
#declare Mpnts=array[MaxMpnts];// mesh points
#declare Cnt=0;
#for(I,0,Pnts-1)
#declare J=Rod(I+1,Pnts);
//#debug concat("I =",str(I,0,0)," Cnt =",str(Cnt,0,0),"\n")
//Belt-rods
#declare An= VAngleD(Bpnts[1][I]-Bpnts[0][I],x);
#if(Bpnts[1][I].y<Bpnts[0][I].y) #declare An=-An; #end
//cylinder{Bpnts[0][I]-z,Bpnts[0][I]+z,Bsize pigment{rgb 0}}
//cylinder{Bpnts[1][I]-z,Bpnts[1][I]+z,Bsize pigment{rgb 1}}
// cylinder{Bpnts[0][I],Bpnts[1][I],Bsize
// pigment{PigB translate -x*(RL+ML) rotate An*z translate Bpnts[0][I]}}
#declare VL=vlength(Bpnts[0][I]-Bpnts[1][I]);
#for(P,0,VL,Dc)
#for(W,0,5)
#declare Mpnts[Cnt]= vrotate(Mase[W]+x*P,An*z)+Bpnts[0][I];
// #if(Cnt<27) sphere{Mpnts[Cnt],.02 pigment{rgb W/5}} #end
#declare Cnt=Cnt+1;//#debug concat("Cnt =",str(Cnt,0,0),"\n")
#end
#end
#declare H=Plen[J]/Dc;//#debug concat("H =",str(H,3,3),"\n")
#declare Da=Ang[J]/H; //#debug concat("Da =",str(Da,3,3),"\n")
// pully curves
#if(Type[J]) #declare Rm=-1;
#else #declare Rm=1;
#end
//#debug " \n"
#declare Q= Bpnts[1][I]-Loc[J];
#declare Sa=VAngleD(Q,-x);
#declare Rn=1; #if(Q.y>0) #declare Rn=-1;#end
#for(P,0,Ang[J]-Da,Da)
#for(W,0,5)
#declare Tp=vrotate(vrotate(Mase[W],-Rm*90*z)-x*Rad[J],Rn*Sa*z);
#declare Mpnts[Cnt]= vrotate(Tp,Rm*P*z)+Loc[J];
//#if(Cnt>3065) sphere{Mpnts[Cnt],.01 pigment{rgb W/5}} #end
#declare Cnt=Cnt+1; //#debug concat("Cnt =",str(Cnt,0,0),"\n")
#end
#end
//#debug "pass\n"
#end //loop
//--------------------------Teeth-------------------------------------
#if(Teeth)
#declare TLen=Twid+Tspc;
#declare Gt=int(TLen/Dc)*6; #debug concat("Gt =",str(Gt,0,0),"\n")
#declare Gu=int(Tspc/Dc); #debug concat("Gu =",str(Gu,0,0),"\n")
#for(I,Gt,Cnt-1,Gt)
#declare Tat= I-3; #debug concat("Tat =",str(Tat,0,0),"\n")
#for(J,0,Gu-1)
#declare TV=vnormalize(Mpnts[I-2]-Mpnts[I-1]);
#declare Mpnts[Tat]=Mpnts[Tat]-TV*L2;
#declare Mpnts[Tat-1]=Mpnts[Tat-1]-TV*L2;
#declare Tat= Tat-6;
#end
#end
#end
//---------------------================= Triangles
============================--------------
#debug concat("\nvertex_vectors->Cnt =",str(Cnt,0,0),"\n")
#declare Tris=array[4*Cnt];
#declare Cnt2=0;
#for(I,0,Cnt-1,6)
#for(J,0,4)
#declare K=mod(J+I,Cnt);
#declare Tris[Cnt2]=<K,mod(K+6,Cnt),mod(K+7,Cnt)>;
#declare Cnt2=Cnt2+1;
#declare Tris[Cnt2]=<K,mod(K+7,Cnt),mod(K+1,Cnt)>;
#declare Cnt2=Cnt2+1;
#end
#declare K=mod(I+5,Cnt);
#declare Tris[Cnt2]=<I,mod(K+1,Cnt),mod(K+6,Cnt)>;
#declare Cnt2=Cnt2+1;
#declare Tris[Cnt2]=<mod(I,Cnt),mod(K,Cnt),mod(I+11,Cnt)>;
#declare Cnt2=Cnt2+1;
#end
#debug concat("face_indices->Cnt2 =",str(Cnt2,0,0),"\n")
//---------------------================= UV Values
============================--------------
#declare Tcn=Cnt2+TL; #debug concat("uv_vectors->Tcn = ",str(Tcn,0,0),"\n")
#declare UVar=array[Tcn];
#for(I,0,Tcn-1)
#declare K=mod(I,7);
#declare J=int(I/7);
#declare UVar[I]=<J*Dc,BPase[K]>;
#end
#declare UVin=array[Cnt2];
#declare Cnt3=0;#declare Trs=0;
#for(W,0,Cnt-1,6)
#declare I=Trs+W;
#for(J,0,4)
#declare K=mod(J+I,Tcn);
#declare UVin[Cnt3]=<K,mod(K+7,Tcn),mod(K+8,Tcn)>;
#declare Cnt3=Cnt3+1;
#declare UVin[Cnt3]=<K,mod(K+8,Tcn),mod(K+1,Tcn)>;
#declare Cnt3=Cnt3+1;
#end
#declare K=mod(I+6,Tcn);
#declare UVin[Cnt3]=<I+5,mod(K+6,Tcn),mod(K+7,Tcn)>;
#declare Cnt3=Cnt3+1;
#declare UVin[Cnt3]=<mod(I+5,Tcn),mod(K,Tcn),mod(K+7,Tcn)>;
#declare Cnt3=Cnt3+1;
#declare Trs=Trs+1;
#end
//#debug concat("I+12 =",str(I+12,0,0),"\n")
#debug concat("UV_indices->Cnt3 =",str(Cnt3,0,0),"\n")
//---------------------=========== Mesh2 Test textures
============================--------------
#declare Pig1=pigment{agate}
#declare Pig2=pigment{bozo}
#declare Pig3=pigment{agate}
#declare Pig4=pigment{agate color_map{[0 Gold][1 Brown]}}
#declare Pig9=pigment{gradient y }
#declare PigY=pigment{gradient y
color_map{ [BPase[1] Red]
[BPase[1] Blue]
[BPase[2] Blue]
[BPase[2] Green]
[BPase[3] Green]
[BPase[3] Gold]
[BPase[4] Gold]
[BPase[4] Pink]
[BPase[5] Pink]
[BPase[5] rgb 0]
}
}
#declare PigX=pigment{gradient y
pigment_map{ [BPase[1] Pig1]
[BPase[1] Pig2]
[BPase[2] Pig2]
[BPase[2] Pig3]
[BPase[3] Pig3]
[BPase[3] Pig4]
[BPase[4] Pig4]
[BPase[4] Pig3]
[BPase[5] Pig3]
[BPase[5] Pig2]
}
}
#declare Tex=texture{pigment{PigX} normal{granite scale<1/TL,.5,1>} }
#declare Cm=color_map{[.4 rgb 0][.5 rgb .5][1 rgb .25]}
#declare Tex1=texture{pigment{granite color_map{Cm} scale<5,.01,1>}
normal{agate scale<10/TL,.05,.1>}finish{brilliance 4}}
#declare Tex2=texture{pigment{granite color_map{Cm} scale<2,.01,1>}
normal{agate scale<1/TL,.1,1>} finish{brilliance 3}}
#declare Tex3=texture{pigment{rgb .25} normal{agate scale<.2,1,1>} finish{Dull}}
#declare Tex4=texture{pigment{image_map {sys "Belt2.bmp" }scale
<6,T1/PL,1>}finish{Phong_Glossy}}
//#declare Tex5=texture{pigment{agate} }//normal{agate } }
#debug concat("T1/PL =",str(T1/PL,3,3),"\n")
#declare TexX=texture{gradient y
texture_map{ [BPase[1] Tex1]
[BPase[1] Tex2]
[BPase[2] Tex2]
[BPase[2] Tex3]
[BPase[3] Tex3]
[BPase[3] Tex2]
[BPase[4] Tex2]
[BPase[4] Tex1]
[BPase[5] Tex1]
[BPase[5] Tex4]
}
}
//---------------------================= Mesh2
============================--------------
mesh2{
vertex_vectors{
Cnt
#for(I,0,Cnt-1)
Mpnts[I]
#end
}
uv_vectors{
Tcn
#for(I,0,Tcn-1)
UVar[I]
#end
}
face_indices{
Cnt2
#for(I,0,Cnt2-1)
Tris[I]
#end
}
uv_indices{
Cnt3
#for(I,0,Cnt3-1)
UVin[I]
#end
}
uv_mapping
texture{TexX translate x*Dr*Rate*frame_number}}
/*/show ring
#for(I,0,5)
#declare K=mod(I+1,6);
cylinder{Mpnts[I],Mpnts[K],.01 pigment{rgb I/5}}
#end
*/
//===========================Save Mesh
=============================================++++++
#if(strlen(SaveMesh))
#fopen Mfile SaveMesh write
#write (Mfile "// ",Remark,"\n")
#write (Mfile "#local TL=",TL,";\n")
#write (Mfile "#local Tex1=texture{pigment{granite scale<5,.01,1>} normal{agate
scale<10/TL,.05,.1>}}\n")
#write (Mfile "#local Tex2=texture{pigment{granite scale<2,.01,1>} normal{agate
scale<1/TL,.1,1>} }\n")
#write (Mfile "#local Tex3=texture{pigment{rgb .25} normal{agate scale<.2,1,1>}
finish{Dull}}\n")
#write (Mfile "#local Tex4=texture{pigment{agate} normal{bozo }
finish{Dull}}\n\n")
#write (Mfile "#local TexX=texture{gradient y \n")
#write (Mfile " texture_map{ [",BPase[1]," Tex1] // top left
side\n")
#write (Mfile " [",BPase[1]," Tex2] // bottom left
side\n")
#write (Mfile " [",BPase[2]," Tex2]\n")
#write (Mfile " [",BPase[2]," Tex3] // bottom :
inside\n")
#write (Mfile " [",BPase[3]," Tex3]\n")
#write (Mfile " [",BPase[3]," Tex2] // bottom right
side\n")
#write (Mfile " [",BPase[4]," Tex2]\n")
#write (Mfile " [",BPase[4]," Tex1] // top right
side\n")
#write (Mfile " [",BPase[5]," Tex1]\n")
#write (Mfile " [",BPase[5]," Tex4] // top :
outside\n")
#write (Mfile " } \n")
#write (Mfile " } \n")
#write (Mfile "#declare Belt=\n")
#write (Mfile "mesh2{\n")
#write (Mfile " vertex_vectors{\n")
#write (Mfile " ",Cnt,"\n")
#declare Tdf=0;
#for(I,0,Cnt-1)
#if(Tdf=0) #write (Mfile " ") #end
#write (Mfile Mpnts[I])
#if(I<Cnt-1) #write (Mfile ",") #end
#declare Tdf=Tdf+1;
#if(Tdf=3) #declare Tdf=0;#write (Mfile "\n") #end
#end
#if(Tdf) #write (Mfile "\n") #end
#write (Mfile " }\n")
#write (Mfile " uv_vectors{\n")
#write (Mfile " ",int(Tcn),"\n")
#declare Tdf=0;
#for(I,0,Tcn-1)
#if(Tdf=0) #write (Mfile " ") #end
#write (Mfile UVar[I])
#if(I<Tcn-1) #write (Mfile ",") #end
#declare Tdf=Tdf+1;
#if(Tdf=5) #declare Tdf=0;#write (Mfile "\n") #end
#end
#if(Tdf) #write (Mfile "\n") #end
#write (Mfile " }\n")
#write (Mfile " face_indices{\n")
#write (Mfile " ",Cnt2,"\n")
#declare Tdf=0;
#for(I,0,Cnt2-1)
#if(Tdf=0) #write (Mfile " ") #end
#write (Mfile Tris[I])
#if(I<Cnt2-1) #write (Mfile ",") #end
#declare Tdf=Tdf+1;
#if(Tdf=5) #declare Tdf=0;#write (Mfile "\n") #end
#end
#if(Tdf) #write (Mfile "\n") #end
#write (Mfile " }\n")
#write (Mfile " uv_indices{\n")
#write (Mfile " ",Cnt3,"\n")
#declare Tdf=0;
#for(I,0,Cnt3-1)
#if(Tdf=0) #write (Mfile " ") #end
#write (Mfile UVin[I])
#if(I<Cnt3-1) #write (Mfile ",") #end
#declare Tdf=Tdf+1;
#if(Tdf=5) #declare Tdf=0; #write (Mfile "\n") #end
#end
#if(Tdf) #write (Mfile "\n") #end
#write (Mfile " }\n")
#write (Mfile " uv_mapping\n")
#write (Mfile " texture{TexX translate x*Tloc}\n")
#write (Mfile " }\n")
#end
// V8dat.inc Data for belt
#declare Pnts=4;
#declare Bsize=0.3;
#declare Loc=array[Pnts]{<0,-3,0> ,<-5.25,4.5,0> ,<0,3.1,0> ,
<5.25,4.5,0> }
#declare Rad=array[Pnts]{2,1.5,1,1.5}
#declare Type=array[Pnts]{1,1,0,1}
#declare Bpnts=array[2][Pnts]{{<-1.69866,-4.05573,0> ,<-4.23998,5.60899,0>
,<0.673345,2.36067,0> ,
<6.52399,3.7082,0> }
{<-6.52399,3.7082,0> ,<-0.673345,2.36067,0>
,<4.23998,5.60899,0> ,
<1.69866,-4.05573,0> }
}
Post a reply to this message
|
|