POV-Ray : Newsgroups : povray.binaries.images : Tangents with analytical geomtery Server Time
17 Nov 2026 22:25:16 EST (-0500)
  Tangents with analytical geomtery (Message 1 to 18 of 18)  
From: Bald Eagle
Subject: Tangents with analytical geomtery
Date: 12 Oct 2019 21:15:01
Message: <web.5da27a2a65c96eb4eec112d0@news.povray.org>
So I tried doing this "the old way" by calculating the angle between the center
line and the tangent and then rotating and translating - but that got too messy
too fast for my second test case, and the first one was hairy enough.

So I implemented a fully analytical method to calculate the endpoints of the
tangent lines "in place" for any arbitrary set of circles.

Input for the macro is just a list of circle centers and radii.

Now to implement some further logic, and then try non-circular "pulleys", and
linear bends.


Post a reply to this message


Attachments:
Download 'serpentinebeltprism.png' (442 KB)

Preview of image 'serpentinebeltprism.png'
serpentinebeltprism.png


 

From: Bald Eagle
Subject: Re: Tangents with analytical geomtery
Date: 12 Oct 2019 21:50:00
Message: <web.5da2828521826f334eec112d0@news.povray.org>
Here's another with more pulleys, including one with radius 1x10^-6 to simulate
a point, and make a sharp bend.

One thing I probably have to explore is where I get a division by 0 warning for
circles of equal radius (I'm adding E-6 to one as a fudge factor), and what
ahppens if I don't have 4 tangents - what if I have special cases of circle
cotangency, etc.

One thing I noticed early on when trying to head off pathological cases and
where user choice might be needed is illustrated by the largest circle (lower
right).
Out and around (red path) vs in and around (green path)

Another interesting possibility for "belt" path is the largest circle in
Quadrant I.   There, one could select outside tangents on the same side, and get
a sort of curved "scraper" / hollow-ground shape.

Questions, comments, advice, suggestions, math, research, links, coding
expertise, etc. are welcome as always.   :)


Post a reply to this message


Attachments:
Download 'serpentinebeltprism.png' (509 KB)

Preview of image 'serpentinebeltprism.png'
serpentinebeltprism.png


 

From: jr
Subject: Re: Tangents with analytical geomtery
Date: 13 Oct 2019 11:25:00
Message: <web.5da3417621826f33feeb22ff0@news.povray.org>
hi,

"Bald Eagle" <cre### [at] netscapenet> wrote:
> ...
> Now to implement some further logic, and then try non-circular "pulleys", and
> linear bends.

any chance of your fashioning an .inc file (with html usage/tutorial?!), looks
really interesting + potentially useful.


regards, jr.


Post a reply to this message

From: Bald Eagle
Subject: Re: Tangents with analytical geomtery
Date: 13 Oct 2019 15:25:05
Message: <web.5da3799b21826f334eec112d0@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:

> any chance of your fashioning an .inc file (with html usage/tutorial?!), looks
> really interesting + potentially useful.

Highly likely, since I think this is far superior to the "old" way.

I'm not sure there's going to be much of a tutorial - and I already have the
link to the source math in the macro.

I have to see about the special cases and how to handle them, and get the Bezier
spline points into a prism {} definition to at the very least get THAT far.

I also need to figure out how to tame the radius on my polygon equation - I may
just stick with something inelegant but gets the job done. (see attached)


Post a reply to this message


Attachments:
Download 'polarhexagon.png' (45 KB)

Preview of image 'polarhexagon.png'
polarhexagon.png


 

From: Bald Eagle
Subject: Re: Tangents with analytical geomtery
Date: 14 Oct 2019 19:25:00
Message: <web.5da5039121826f334eec112d0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
..... and get the Bezier
> spline points into a prism {} definition to at the very least get THAT far.

I must say, the x, y, and z going one way, and the left handed coordinate system
going the other...   it may drive me crazy.


Still fighting with making a set of bezier segments spanning an arbitrary
circular arc.   Close - but close isn't really that good...


Post a reply to this message

From: Bald Eagle
Subject: Re: Tangents with analytical geomtery
Date: 14 Oct 2019 21:40:01
Message: <web.5da5235221826f334eec112d0@news.povray.org>
I hammered it out after fixing some weird problems - which I believe must have
something to do with the coordinate system.

Need to dig up the code for the bezier sphere sweep and plug that in too.

I'll need to clean it up a LOT, and then make it work as a macro in the
tangent/pulley scene - hopefully I can get it all to work by tomorrow afternoon.

Oh, the headaches....


Post a reply to this message


Attachments:
Download 'arcangle.png' (341 KB)

Preview of image 'arcangle.png'
arcangle.png


 

From: Bald Eagle
Subject: Re: Tangents with analytical geomtery
Date: 16 Oct 2019 20:50:01
Message: <web.5da7ba6321826f334eec112d0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:

hopefully I can get it all to work by tomorrow afternoon.

So, I didn't make it as far as I wanted to by this point, but did manage to
ruminate on the issues for a bit today, and implement some further ideas.

No sense in trying to automate any sort of convex hull / belt path at this
point, so I first got it worked out so that each of the 4 tangent lines was
color coded, and you could then select which one to use in the setup array.
That one stays colored, and the rest get grayed out.

Then as I was working on transferring the code over from the concatenated Bezier
arcs scene, I knew I had to make sure all of the spline segments were
DIRECTIONAL, and so I elaborated the tangent line preview to draw a gradient
pigment line going from green at the start to red at the end.

See attached.

Now I have to start integrating the Arc segments code, and hopefully it will all
hang together and give me a nice prism.

I need to "scale" and rotate the radial pigment to match arcs of different
angles and orientations, figure out some sort of orderly manner in which to
export and transfer the array of points for each line and arc into a master
prism array, and make sure it's easy to switch segment directions.

Grid labels, secondary gridlines, circle center and Bezier endpoint markers, and
of course an image_map to overlay everything onto for copying a part diagram.

Maybe this will finally spur me to implement some dimensioning macros - but I
will probably start with just output to the #debug stream.

AND adding in the right version of screen.inc to use the orthographic camera.


Post a reply to this message


Attachments:
Download 'serpentinebeltprism.png' (548 KB)

Preview of image 'serpentinebeltprism.png'
serpentinebeltprism.png


 

From: Bald Eagle
Subject: Re: Tangents with analytical geomtery
Date: 17 Oct 2019 21:20:01
Message: <web.5da912bb21826f334eec112d0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:

> Now I have to start integrating the Arc segments code, and hopefully it will all
> hang together and give me a nice prism.

Still picking apart bits and pieces and seeing many new ways in which the data
can be interpreted.  Trying to keep it simple enough to get to rendering a prism
sometime by the weekend.

Got some more internal bits of code cleaned up, and some new parts written, and
managed to puzzle out the circles so that there are endpoints of two arcs that
match the endpoints of the 2 chosen tangent lines attached to that circle.
(Black and white)

> I need to "scale" and rotate the radial pigment to match arcs of different
> angles and orientations,

That seems really confusing right now, as I would have thought that the
frequency would have changed the pattern so that it had some sort of static
starting angle, but it doesn't look that way to me - unless the colors are just
confusing me.
(See bottom set of tori labeled with radial frequencies)

And I just got done working this last part out, so I didn't have time to remap
the color map, write an experimental radial scene, and look at the pattern
source code to see how it works.

The goal is to get a green-to-red pattern to span any given arc - be it a black
or white segment - using frequency to "scale" the color map to the desired arc
angle, and then rotate it to match the Segment_of_Torus in the preview.

Maybe there's a completely different way to accomplish the same task?

Tomorrow is a new day.


Post a reply to this message


Attachments:
Download 'serpentinebeltprism.png' (554 KB)

Preview of image 'serpentinebeltprism.png'
serpentinebeltprism.png


 

From: Bald Eagle
Subject: Re: Tangents with analytical geomtery
Date: 22 Oct 2019 17:35:00
Message: <web.5daf75ce21826f334eec112d0@news.povray.org>
Update:

OK,  So after fixed the radial pigment pattern, I worked out a bunch of little
bits to pigment the arcs and recolor the chosen arcs.  Then I worked in the
linear bezier code, the segmented bezier arc code, played with the
directionality of the segments, got an array to collect all the data, and
started to tidy up the prism definition.

The path looks mostly ok - except that somehow I'm dropping a circle and its
tangents.   :|   And since something is amiss, the prism isn't closed, and so
there's no prism.

I will have to work that out - hopefully soon. So very very close.

Anyway:
Here's how it works:

First an array of circles is declared -
x,y,z of center, and radius
two more values for when I get around to polygonal pulleys,
and then which tangents and arcs to use, along with a directional adjustment for
each.


 #declare CircleArray = array [11][10]{
  { 0.00, 0,  0.00, 0.10,   0, 0,  _Red, _Fwd, _Blk, _Fwd},
  { 1.75, 0,  2.25, 0.50,   0, 0,  _Grn, _Fwd, _Wht, _Rev},
  { 2.00, 0,  0.50, 0.15,   0, 0,  _Red, _Fwd, _Blk, _Rev},
  { 5.50, 0,  3.00, 0.25,   0, 0,  _Grn, _Fwd, _Wht, _Rev},
  { 2.50, 0, -1.00, 1.00,   0, 0,  _Red, _Fwd, _Blk, _Fwd},
  { 1.00, 0, -2.00, 0.25,   0, 0,  _Grn, _Fwd, _Wht, _Fwd},
  { 0.50, 0, -1.00, 0.25,   0, 0,  _All, _Fwd, _All, _Fwd},
  {-1.00, 0, -1.50, 0.50,   0, 0,  _All, _Fwd, _All, _Fwd},
  {-3.00, 0,  0.00, 0.50,   0, 0,  _All, _Fwd, _All, _Rev},
  {-2.50, 0,  2.00, 0.10,   0, 0,  _All, _Fwd, _All, _Rev},
  {-1.25, 0, -0.25, 0.20,   0, 0,  _All, _Fwd, _All, _Fwd},
  //{-1.00, 0,  3.00, 0.30,   0, 0,  _Blu, _Fwd, _Blk, _Fwd},
  }


The circles and all of the tangents get drawn out, and then you use that first
render to choose the path.  Once a circle has two tangents chosen, there are now
endpoints for 2 arcs, and those arcs get colored.  Pick which arc you want, and
you get a continuous path, colored green-to-red start -to-finish.

Then a loop cranks through the circle array and assigns Bezier spline segments
to everything and writes that into an array.

Then a loop inside a prism declaration unwraps all of those points for the
prism.


In the attached image, circles 0-5 all have the tangent and arc paths selected.
circle 6 has both tangents selected, but the arc path still isn't defined.
7, 8, and 9 are all in the initial stage.

And now to do more debugging.   :(


Post a reply to this message


Attachments:
Download 'serpentinebeltprism.png' (531 KB)

Preview of image 'serpentinebeltprism.png'
serpentinebeltprism.png


 

From: Bald Eagle
Subject: Re: Tangents with analytical geomtery
Date: 22 Oct 2019 21:00:01
Message: <web.5dafa52521826f334eec112d0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:

> And now to do more debugging.   :(

After fixing some bad wrapping code and a few other small things, and adding a
new debugging array to track the joining of the Bezier segments, ....

WHEEEEE!


Post a reply to this message


Attachments:
Download 'serpentinebeltprism.png' (203 KB)

Preview of image 'serpentinebeltprism.png'
serpentinebeltprism.png


 

From: Thomas de Groot
Subject: Re: Tangents with analytical geomtery
Date: 23 Oct 2019 02:25:12
Message: <5daff248@news.povray.org>
Op 23/10/2019 om 02:56 schreef Bald Eagle:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
> WHEEEEE!
> 

Nicely done, sir. Now take your dried frog pills (as Stephen would say). :-)

-- 
Thomas


Post a reply to this message

From: Gergely Szaktilla
Subject: Re: Tangents with analytical geomtery
Date: 23 Oct 2019 12:30:06
Message: <5db0800e$1@news.povray.org>
On 23.10.19 02:56, Bald Eagle wrote:
> WHEEEEE!

Yeah!

Reminds me of Helga Philipp
(https://de.wikipedia.org/wiki/Helga_Philipp). I saw some of her „Poesie
der Logik“ work.

It's nice to see how things evolve :-)

Gregor


Post a reply to this message

From: Bald Eagle
Subject: Re: Tangents with analytical geomtery
Date: 27 Oct 2019 18:55:01
Message: <web.5db61fe221826f334eec112d0@news.povray.org>
So I cleaned up a few things,

made the native prism transparent to allow for further development
moved the small side and rotated view to the side, and widened the view
added a small region of black to each end of the color map to make things
clearer, esp in the case of small wrong-direction arcs
Put the image map at the back, labeled the gridlines...
switched over to orthographic camera

Saving that file as a backup and proceeding to try to model the original part
highlighted the need to consider the cases where adjacent circles are not
exterior to each other, and likely a need to include a proper _point_ where 2
linear segments can meet at a bend.

Also need to work out - or find - some code to keep most of the scene elements a
constant perceived size - like the line width, text size, etc when the camera
zoom is changed to switch between large and small dimension designs.


I made some progress on sorting out 0,1,2,3,4 tangent cases, and filtering the
code to bypass calculations for nonexistent tangent lines.

Hopefully I will have the time, energy, and focus to work through most of that
over the next several days.


Post a reply to this message


Attachments:
Download 'serpentinebeltprism_dev1.png' (640 KB)

Preview of image 'serpentinebeltprism_dev1.png'
serpentinebeltprism_dev1.png


 

From: Leroy
Subject: Re: Tangents with analytical geomtery
Date: 29 Oct 2019 16:40:00
Message: <web.5db8a2f321826f33a83d0ced0@news.povray.org>
Very well done!


Post a reply to this message

From: Leroy
Subject: Re: Tangents with analytical geomtery
Date: 5 Nov 2019 15:10:05
Message: <web.5dc1d6ab21826f33632789d20@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> So I tried doing this "the old way" by calculating the angle between the center
> line and the tangent and then rotating and translating - but that got too messy
> too fast for my second test case, and the first one was hairy enough.
>
> So I implemented a fully analytical method to calculate the endpoints of the
> tangent lines "in place" for any arbitrary set of circles.
>
> Input for the macro is just a list of circle centers and radii.
>
> Now to implement some further logic, and then try non-circular "pulleys", and
> linear bends.

Why did you start this? I had to try it for my self. Not the prism part but
getting the belt around a set of pulleys.
 I spent the last week working on it. I started with placing a random number of
pulleys of different sizes around the origin. Then did a simple test to mark
weather the belt was inside or outside a particular pulley.
 That test was:: if the vlength of the midpoint of the two pulleys on each side
of the test pulley was shorter than the vlength of the test then the belt was on
the outside.

 Then I came the deciding which tangent formula to use and calculating the
tangent on two adjacent pulleys. There are basic two formulas one for the cross
over, one for going from Outside to Inside, and the other for Outside to
Outside. Those formula can also be used for the reversed Inside to Outside and
Inside to Inside.

So I had those all 4 tangents that you have shown. But I only needed the one
tangent for two pulleys.

 Then came the curved part of the belt. Each pulley has two tangent points, one
where the belt comes in and one where the belt goes out. Using the
Inside/Outside value and those tangent points I make a prism to cut a torus. Did
I mention the the belt was made of cylinders.

 While testing lots of randomly place Pulleys I came across an error in the
Inside/Outside test and made a second routine that took in account the radius of
the pulleys involved.
 When all is said and done I have 4 arrays::
      Location, Size, Inside/Outside, Tangent points

Now maybe I'll try and animate it;)
Here a look:


Post a reply to this message


Attachments:
Download 'pully1.jpg' (21 KB)

Preview of image 'pully1.jpg'
pully1.jpg


 

From: Bald Eagle
Subject: Re: Tangents with analytical geomtery
Date: 5 Nov 2019 16:55:00
Message: <web.5dc1efa321826f334eec112d0@news.povray.org>
"Leroy" <whe### [at] gmailcom> wrote:

> Why did you start this?

Because making parts from CSG can be a big pain, and I figured that I could
model a prism which would give me smooth curves and the proper alignment with
the straight sections.  Not so easy without a good modeler or drawing program.

> I had to try it for my self. Not the prism part but
> getting the belt around a set of pulleys.

I did that ages ago.  I used Friedrich Lohmueller's method, with the angles and
all of that, but doing that for multiple pulleys was a bit overwhelming.
So I found a purely analytical method using the radii and the coordinates of the
centers.

>  I spent the last week working on it. I started with placing a random number of
> pulleys of different sizes around the origin. Then did a simple test to mark
> weather the belt was inside or outside a particular pulley.
>  That test was:: if the vlength of the midpoint of the two pulleys on each side
> of the test pulley was shorter than the vlength of the test then the belt was on
> the outside.
>
>  Then I came the deciding which tangent formula to use and calculating the
> tangent on two adjacent pulleys. There are basic two formulas one for the cross
> over, one for going from Outside to Inside, and the other for Outside to
> Outside. Those formula can also be used for the reversed Inside to Outside and
> Inside to Inside.

Nice - when I was analyzing the possible configurations, I realized that it
could get quite complicated, and there was no good way to automate the process -
and different results might be wanted compared to what an algorithm chose.

> So I had those all 4 tangents that you have shown. But I only needed the one
> tangent for two pulleys.

Correct, unless you only have two pulleys.   ;)
I also knew that one might want to model a system with an idler pulley or
tensioner, so i made everything manually selectable.

>  Then came the curved part of the belt. Each pulley has two tangent points, one
> where the belt comes in and one where the belt goes out. Using the
> Inside/Outside value and those tangent points I make a prism to cut a torus. Did
> I mention the the belt was made of cylinders.

Nice.   The animation I did used a belt made out of truncated cones in order to
simulate a V-belt, and to have an odd-colored cone to mark the belt and give a
better visual cue.


> Now maybe I'll try and animate it;)
> Here a look:

You've done a great job as always   :)

Most belt animations are done with only a short, repeating series of frames, but
with multiple radii, or if marking the pulleys or belt to really show the
rotation, then what constitutes a "single" cycle can be much longer and somewhat
challenging to calculate.


Post a reply to this message

From: Leroy
Subject: Re: Tangents with analytical geomtery
Date: 12 Nov 2019 14:00:01
Message: <web.5dcb00ce21826f33fc7719580@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
>
> Most belt animations are done with only a short, repeating series of frames, but
> with multiple radii, or if marking the pulleys or belt to really show the
> rotation, then what constitutes a "single" cycle can be much longer and somewhat
> challenging to calculate.

I hadn't even thought of that!

I was so intent on the math of the problem, that I didn't even think of making a
looped animation. With 10 pulleys that could run awhile!

 I did make a prism belt and 'real' pulleys. I got into a problem with the
texturing of the belt. My idea was to have a texture scaled so that it would be
the length of the belt and translate it to each section of the belt parts.
 Then all you have to do to animate the belt is change the translate value.
I did get a pigment_map to work, using the toroidal Warp for around the pulleys.
 While writing this I had a Idea on how to get texture to work. Got to give it a
try.

 I still don't know why I'm working on this :0
 Well it bets any other thing I need to do :)

 Have Fun!


Post a reply to this message

From: Bald Eagle
Subject: Re: Tangents with analytical geomtery
Date: 12 Nov 2019 17:15:01
Message: <web.5dcb2dcc21826f334eec112d0@news.povray.org>
"Leroy" <whe### [at] gmailcom> wrote:

> I hadn't even thought of that!

Yeah.   I can't even remember how I did it with just my 2 pulleys - I'll have to
go back and look some time.

> I was so intent on the math of the problem, that I didn't even think of making a
> looped animation. With 10 pulleys that could run awhile!

Yeah - I'll have to see if there's an equation for that.


> I did get a pigment_map to work, using the toroidal Warp for around the pulleys.
>  While writing this I had a Idea on how to get texture to work. Got to give it a
> try.

That's clever.  You should have seen the headache I went through with radial
recently.  :O

>  I still don't know why I'm working on this :0
>  Well it bets any other thing I need to do :)

Ha!   You and me both.
Something always captures my interest and I pursue it --- BECAUSE!

I hope to see some of your work on this soon.  Maybe I can draw you further into
this with --- GEARS!  :D

Glad you're having fun though.


Post a reply to this message

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