POV-Ray : Newsgroups : povray.text.scene-files : Tangents between circles Server Time
31 Oct 2024 19:45:01 EDT (-0400)
  Tangents between circles (Message 1 to 10 of 19)  
Goto Latest 10 Messages Next 9 Messages >>>
From: Bald Eagle
Subject: Tangents between circles
Date: 17 Nov 2019 10:30:01
Message: <web.5dd1666f8983c4eb4eec112d0@news.povray.org>
Minimal scene to show the basics.
Still LONG due to all the calculations, etc.


Post a reply to this message


Attachments:
Download 'tangentscene.pov.txt' (22 KB)

From: jr
Subject: Re: Tangents between circles
Date: 17 Nov 2019 16:35:00
Message: <web.5dd1ba8e1b345bf5feeb22ff0@news.povray.org>
hi,

"Bald Eagle" <cre### [at] netscapenet> wrote:
> Minimal scene to show the basics.

thanks.

> Still LONG due to all the calculations, etc.

to make it useful to .. numpties like me, a documented interface of sorts is
needed[*], a few thoughts on this below (disclaimer, working on some non-POV-Ray
stuff and haven't thought everything through in full).

[*] cf semver.org.  ;-)

for the 'pulleys', in addition to centre + radius, having a texture would be
cool.  either as a "parallel" array, or perhaps using the new mixed array type.
now wondering how one could prepare for/support animation.

if a start and end point get specified, that would get a "cable", while no
points would be a "belt", ie closed.  either way, the belt/cable goes around a
pulley either clockwise or counter (a boolean), so could be represented as an
array of floats for automatic "routing", 'N.0' for clockwise and 'N.1' for the
reverse, where N is the pulley array index.

and a belt/cable texture.

then bundle those in a dictionary to keep everything in one place? packaged in a
"standalone" include file.

anyway.  will be happy to do testing and help document, and what other (small)
help I can give.


regards, jr.


Post a reply to this message

From: Bald Eagle
Subject: Re: Tangents between circles
Date: 17 Nov 2019 20:20:01
Message: <web.5dd1f0a31b345bf54eec112d0@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:

Right-o.   I just got a quick demo scene posted before it dropped off the
back-burner.


> for the 'pulleys', in addition to centre + radius, having a texture would be
> cool.  either as a "parallel" array, or perhaps using the new mixed array type.
> now wondering how one could prepare for/support animation.

Well there's no reason that can't be appended to the scene.
Just make a cylinder or disc right below the circle array.
Or a separate texture array that will use the current loop value in the arc/line
plotting section.

> if a start and end point get specified, that would get a "cable", while no
> points would be a "belt", ie closed.  either way, the belt/cable goes around a
> pulley either clockwise or counter (a boolean), so could be represented as an
> array of floats for automatic "routing", 'N.0' for clockwise and 'N.1' for the
> reverse, where N is the pulley array index.

There are two portions of the post-calculation section.   one to make the
bezier-arcs, one to make all 4 (if they exist) tangents.
I have oh-so much of that in the developmental "full" version.   The logic and
flags and texturing is bewildering, thus, the cut-down version.
See the original developmental renders with the colored lines, arcs, and the
color coded oriented/Boolean directional final belt path.

> anyway.  will be happy to do testing and help document, and what other (small)
> help I can give.

I'd say that the best help at the moment might be to just look it over and do a
parallel implementation, starting from what I posted.   That would give me new
ideas for how to process the data, and other things with what to do with the
results that I might not have thought of yet.

Also, asking any questions you may have about specific bits of the code would
help me document it, and in the process re-read and re-think what I've already
done.

Certainly I'd love to work out the logic of animating it, and doing something
like a toothed belt or chain to run along gears or sprockets.

I haven't done much pathological case testing, because it's already a miracle
that it even works at all.


Post a reply to this message

From: jr
Subject: Re: Tangents between circles
Date: 17 Nov 2019 21:05:00
Message: <web.5dd1fb141b345bf5feeb22ff0@news.povray.org>
hi,

"Bald Eagle" <cre### [at] netscapenet> wrote:
> "jr" <cre### [at] gmailcom> wrote:
>
> Right-o.   I just got a quick demo scene posted before it dropped off the
> back-burner.
>
> > for the 'pulleys', in addition to centre + radius, having a texture would be
> > cool.  either as a "parallel" array, or perhaps using the new mixed array type.
> > now wondering how one could prepare for/support animation.
>
> Well there's no reason that can't be appended to the scene.
> Just make a cylinder or disc right below the circle array.
> Or a separate texture array that will use the current loop value in the arc/line
> plotting section.
>
> > if a start and end point get specified, that would get a "cable", while no
> > points would be a "belt", ie closed.  either way, the belt/cable goes around a
> > pulley either clockwise or counter (a boolean), so could be represented as an
> > array of floats for automatic "routing", 'N.0' for clockwise and 'N.1' for the
> > reverse, where N is the pulley array index.
>
> There are two portions of the post-calculation section.   one to make the
> bezier-arcs, one to make all 4 (if they exist) tangents.
> I have oh-so much of that in the developmental "full" version.   The logic and
> flags and texturing is bewildering, thus, the cut-down version.
> See the original developmental renders with the colored lines, arcs, and the
> color coded oriented/Boolean directional final belt path.

won't look at the code too closely for now.  just .. speculating.  :-)

> > anyway.  will be happy to do testing and help document, and what other (small)
> > help I can give.
>
> I'd say that the best help at the moment might be to just look it over and do a
> parallel implementation, starting from what I posted.   That would give me new
> ideas for how to process the data, and other things with what to do with the
> results that I might not have thought of yet.

will do this, sometime nearer weekend.  sorry.

> Also, asking any questions you may have about specific bits of the code would
> help me document it, and in the process re-read and re-think what I've already
> done.
>
> Certainly I'd love to work out the logic of animating it, and doing something
> like a toothed belt or chain to run along gears or sprockets.

just support for the pulley rotation should do, I think.

> I haven't done much pathological case testing, because it's already a miracle
> that it even works at all.

will play with it etc.  cheers.


regards, jr.


Post a reply to this message

From: jr
Subject: Re: Tangents between circles
Date: 20 Nov 2019 16:45:00
Message: <web.5dd5b2d31b345bf5feeb22ff0@news.povray.org>
hi,

"Bald Eagle" <cre### [at] netscapenet> wrote:
> Right-o.   I just got a quick demo scene posted before it dropped off the
> back-burner.
> ...
> I'd say that the best help at the moment might be to just look it over and do a
> parallel implementation, starting from what I posted.   That would give me new
> ideas for how to process the data, and other things with what to do with the
> results that I might not have thought of yet.
>
> Also, asking any questions you may have about specific bits of the code would
> help me document it, and in the process re-read and re-think what I've already
> done.

one question is: in the #for() loop near bottom, you test for IFlag and OFlag.
naively, given two circles A + B which do not touch/overlap, you always get 4
tangents, no?  by mandating "sane" scenarios you might be able to get rid of
some conditional code.

the comments in the code suggest that you can "classify" the tangents (order +
direction) and used colour to see that info; is that code available too?

> Certainly I'd love to work out the logic of animating it, and doing something
> like a toothed belt or chain to run along gears or sprockets.

given knowledge of radius of A, and the number of degrees it revolves from one
frame to the next, it would just require to map that length of arc to B to get
the corresponding angle (not that I could actually do it).

provides all needed info when combined with the frame number.

> I haven't done much pathological case testing, because it's already a miracle
> that it even works at all.

I hope I can make some headway understanding the code, and hopefully learn how
to "assemble" the correct tangents into a belt or cable.  I probably won't be
able to avoid stumbling into problems.  :-)


regards, jr.


Post a reply to this message

From: Bald Eagle
Subject: Re: Tangents between circles
Date: 20 Nov 2019 17:40:01
Message: <web.5dd5bfbf1b345bf54eec112d0@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:

> one question is: in the #for() loop near bottom, you test for IFlag and OFlag.
> naively, given two circles A + B which do not touch/overlap, you always get 4
> tangents, no?  by mandating "sane" scenarios you might be able to get rid of
> some conditional code.

Right, but computing the arcs and tangent lines wasn't meant to solely address
the "belt/pulley problem" - the point was to get tangent lines to circles to
design a prism.  I don't much care about the conditional code, and it all seems
fast enough, especially since it won't be in a loop that gets executed 1000
times.

It would also be nice to have a block of code that doesn't crap out if the
"wrong" data gets entered into the circle array.


> the comments in the code suggest that you can "classify" the tangents (order +
> direction) and used colour to see that info; is that code available too?

Right.  If you look at the original thread, ALL the tangents and arcs get shown.
Then you can eliminate the tangents that don't apply, and then with only two
endpoints on a circle, you can then highlight two discrete arcs to choose from.
Then you can select/correct the direction so that the ordering of the points to
generate the prism is correct.

Let me see where I'm at with that scene file - just put it back on my radar if I
don't get back to you on it in the next week or so.


> > Certainly I'd love to work out the logic of animating it, and doing something
> > like a toothed belt or chain to run along gears or sprockets.
>
> given knowledge of radius of A, and the number of degrees it revolves from one
> frame to the next, it would just require to map that length of arc to B to get
> the corresponding angle (not that I could actually do it).

That's great for - one arc.  Now picture 5 pulleys and you want to highlight one
link in the chain and follow that around the whole system.

It's sounds - excessive to do, but from an animator's standpoint - to give the
viewer that visual cue with which to infer motion and direction... it makes a
BIG difference.


> I hope I can make some headway understanding the code, and hopefully learn how
> to "assemble" the correct tangents into a belt or cable.  I probably won't be
> able to avoid stumbling into problems.  :-)

Well in that end section, there's the parts that control the outer tangents, and
the inner tangents.  Just change "pigment {LinePigment}" into something
different for all 4 lines, and you'll see exactly which one is which.


Post a reply to this message

From: Leroy
Subject: Re: Tangents between circles
Date: 22 Nov 2019 22:00:00
Message: <web.5dd89fb61b345bf57d6f06630@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "jr" <cre### [at] gmailcom> wrote:
>

>
> > > Certainly I'd love to work out the logic of animating it, and doing something
> > > like a toothed belt or chain to run along gears or sprockets.
> >
> > given knowledge of radius of A, and the number of degrees it revolves from one
> > frame to the next, it would just require to map that length of arc to B to get
> > the corresponding angle (not that I could actually do it).
>
> That's great for - one arc.  Now picture 5 pulleys and you want to highlight one
> link in the chain and follow that around the whole system.
>
> It's sounds - excessive to do, but from an animator's standpoint - to give the
> viewer that visual cue with which to infer motion and direction... it makes a
> BIG difference.
>

I'm back. I glances over Eagles code. A lot of math there!
But I'm here to talk about the animated belt. I through away all my belt parts.
(pieces of prisms and lathes) and made a large mesh2 using the same variables
that where use to cut and place the belt parts. Now with UV mapping I can have a
different texture on each of the 6 faces of a belt.
 While I was playing with the textures I can up with idea for that toothed belt.
Every where there is a space between the teeth move the vertex_vectors in that
area so that they are flush.
 I haven't done a done a complete animation yet. But the plain belt should be no
problem, just translate late the textures. The tooth belt would have to be
remade for every scene.

Have fun! I have.


Post a reply to this message

From: jr
Subject: Re: Tangents between circles
Date: 23 Nov 2019 11:05:00
Message: <web.5dd958591b345bf5feeb22ff0@news.povray.org>
hi,

"Bald Eagle" <cre### [at] netscapenet> wrote:
> "jr" <cre### [at] gmailcom> wrote:
>
> > one question is: in the #for() loop near bottom, you test for IFlag and OFlag.
> > naively, given two circles A + B which do not touch/overlap, you always get 4
> > tangents, no?  by mandating "sane" scenarios you might be able to get rid of
> > some conditional code.
>
> Right, but computing the arcs and tangent lines wasn't meant to solely address
> the "belt/pulley problem" - the point was to get tangent lines to circles to
> design a prism.  I don't much care about the conditional code, and it all seems
> fast enough, especially since it won't be in a loop that gets executed 1000
> times.
>
> It would also be nice to have a block of code that doesn't crap out if the
> "wrong" data gets entered into the circle array.

that's kind of what I meant by "sane".  should be easy enough to write a bit of
code which checks the input arguments.

I think the existing macros/code can easily be "wrapped" in two distinct,
specialised macros: one to make prisms, the other for pulley systems.

> > the comments in the code suggest that you can "classify" the tangents (order +
> > direction) and used colour to see that info; is that code available too?
>
> Right.  If you look at the original thread, ALL the tangents and arcs get shown.
> Then you can eliminate the tangents that don't apply, and then with only two
> endpoints on a circle, you can then highlight two discrete arcs to choose from.
> Then you can select/correct the direction so that the ordering of the points to
> generate the prism is correct.

all the arc stuff is missing from the code, as posted, though.  ;-)

> Let me see where I'm at with that scene file - just put it back on my radar if I
> don't get back to you on it in the next week or so.
>
> > > Certainly I'd love to work out the logic of animating it, and doing something
> > > like a toothed belt or chain to run along gears or sprockets.
> > given knowledge of radius of A, and the number of degrees it revolves from one
> > frame to the next, it would just require to map that length of arc to B to get
> > the corresponding angle (not that I could actually do it).
>
> That's great for - one arc.  Now picture 5 pulleys and you want to highlight one
> link in the chain and follow that around the whole system.
>
> It's sounds - excessive to do, but from an animator's standpoint - to give the
> viewer that visual cue with which to infer motion and direction... it makes a
> BIG difference.

number of pulleys is a bit of a red herring.  for me, the focus is (ought to be)
on the chain/belt/cable.

say you have a structure like

#declare D = dictionary {
  .pulleys:  array {
               array mixed {<x,y,z>, r, cc, texture{}},
                 ...
             },
  .route:    array {3,1,0,2},
  .ndegree:  n.n
};

then "only" .route needs processing, and the belt gets "threaded" according to
pulley index and counter-clockwise (cc) flag; assuming .ndegree is number of
degrees first pulley turns per frame all other pulleys can be derived knowing
the frame number.  and some other keys for belt texture, start and end points
(if provided draw a cable), etc too.

but I just read Leroy's post, and while I've no idea of the complexity involved,
having one mesh vs many separate parts does sound good/better.

> > I hope I can make some headway understanding the code, and hopefully learn how
> > to "assemble" the correct tangents into a belt or cable.  I probably won't be
> > able to avoid stumbling into problems.  :-)
>
> Well in that end section, there's the parts that control the outer tangents, and
> the inner tangents.  Just change "pigment {LinePigment}" into something
> different for all 4 lines, and you'll see exactly which one is which.

now the main "problem" is not having a code example to glean the usage of the
Bezier_* macros to shape the connecting arcs.


Leroy:

your code is compiled for Windows, which I do not have.  have you published the
source?


regards. jr.


Post a reply to this message

From: Leroy
Subject: Re: Tangents between circles
Date: 25 Nov 2019 12:00:00
Message: <web.5ddc07d61b345bf55843bbac0@news.povray.org>
"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

From: jr
Subject: Re: Tangents between circles
Date: 25 Nov 2019 15:15:12
Message: <web.5ddc361a1b345bf5feeb22ff0@news.povray.org>
"Leroy" <whe### [at] gmailcom> wrote:
> "jr" <cre### [at] gmailcom> wrote:
> > your code is compiled for Windows, which I do not have.  have you published the
> > source?
>
> 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.

yes.  a small set of profiles to select from, perhaps?

> 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!

phew.  a lot of code.  thank you.  intend to look into it in the coming days.


regards, jr.


Post a reply to this message

Goto Latest 10 Messages Next 9 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.