POV-Ray : Newsgroups : povray.binaries.images : --- Server Time
29 Mar 2024 04:28:19 EDT (-0400)
  --- (Message 1 to 9 of 9)  
From: AQ
Subject: Re: Harmonograph simulation
Date: 20 Sep 2016 16:06:00
Message: <9j53ublkn6273do4dm0rhcq940prr4aqe3@4ax.com>
On Tue, 20 Sep 2016 21:04:32 +0100, AQ <AQ### [at] worldcom> wrote:

>After some help from Clipka with some code I thought I would post one
>of the images from a 2 pendulum  Harmonograph simulator.  
>It is from some code I was playing with in 2005 !! 
>
>If anyone is interested I will post the source code
>
>AQ

Whoops. Sorry !!   I obviously need to learn how to post an image when
using Forte Agent

AQ


Post a reply to this message

From: Anthraqunione
Subject: Re: Harmonograph simulation
Date: 20 Sep 2016 16:30:01
Message: <web.57e19b653023a69a9934c0510@news.povray.org>
AQ <AQ### [at] worldcom> wrote:
> On Tue, 20 Sep 2016 21:04:32 +0100, AQ <AQ### [at] worldcom> wrote:
>
> >After some help from Clipka with some code I thought I would post one
> >of the images from a 2 pendulum  Harmonograph simulator.
> >It is from some code I was playing with in 2005 !!
> >
> >If anyone is interested I will post the source code
> >
> >AQ
>
> Whoops. Sorry !!   I obviously need to learn how to post an image when
> using Forte Agent
>
> AQ

Let me try again


Post a reply to this message


Attachments:
Download 'harmonograph 12 small.jpg' (296 KB)

Preview of image 'harmonograph 12 small.jpg'
harmonograph 12 small.jpg


 

From: William F Pokorny
Subject: Re: Harmonograph simulation
Date: 21 Sep 2016 13:02:48
Message: <57e2bd38$1@news.povray.org>
On 09/20/2016 04:26 PM, Anthraqunione wrote:
> AQ <AQ### [at] worldcom> wrote:
>> On Tue, 20 Sep 2016 21:04:32 +0100, AQ <AQ### [at] worldcom> wrote:
>>
>>> After some help from Clipka with some code I thought I would post one
>>> of the images from a 2 pendulum  Harmonograph simulator.
>>> It is from some code I was playing with in 2005 !!
>>>
>>> If anyone is interested I will post the source code
>>>
>>> AQ
>>
>> Whoops. Sorry !!   I obviously need to learn how to post an image when
>> using Forte Agent
>>
>> AQ
>
> Let me try again
>
Neat! I'd like to see the source code.

Bill P.


Post a reply to this message

From: AQ
Subject: Re: Harmonograph simulation
Date: 23 Sep 2016 12:17:52
Message: <dclaub5mogeqv89d6ecm2m1aa4mrf9epq5@4ax.com>
On Wed, 21 Sep 2016 13:02:48 -0400, William F Pokorny <ano### [at] anonymousorg> wrote:

>On 09/20/2016 04:26 PM, Anthraqunione wrote:
>> AQ <AQ### [at] worldcom> wrote:
>>> On Tue, 20 Sep 2016 21:04:32 +0100, AQ <AQ### [at] worldcom> wrote:
>>>
>>>> After some help from Clipka with some code I thought I would post one
>>>> of the images from a 2 pendulum  Harmonograph simulator.
>>>> It is from some code I was playing with in 2005 !!
>>>>
>>>> If anyone is interested I will post the source code
>>>>
>>>> AQ
>>>
>>> Whoops. Sorry !!   I obviously need to learn how to post an image when
>>> using Forte Agent
>>>
>>> AQ
>>
>> Let me try again
>>
>Neat! I'd like to see the source code.
>
>Bill P.

See P.B.S-F

I hope that is the correct folder


Post a reply to this message

From: William F Pokorny
Subject: Re: Harmonograph simulation
Date: 23 Sep 2016 12:35:29
Message: <57e559d1$1@news.povray.org>
On 09/23/2016 12:17 PM, AQ wrote:
> On Wed, 21 Sep 2016 13:02:48 -0400, William F Pokorny <ano### [at] anonymousorg>
wrote:
>> Neat! I'd like to see the source code.
>>
>> Bill P.
>
> See P.B.S-F
>
> I hope that is the correct folder
>
Thanks much John.

The usual place for text scene files is P.T.S-F, but where it is works 
for me. :-)

Bill P.


Post a reply to this message

From: Bald Eagle
Subject: Re: Harmonograph simulation
Date: 27 Sep 2016 12:20:00
Message: <web.57ea9b8e3023a69ab488d9aa0@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:

> Neat! I'd like to see the source code.
>
> Bill P.

I was interested too, and just grabbed some info from Wikipedia and worked out
something functional.
My head was not in "function-space" at the time, so I just embedded the formulas
in the loop.
I think initially I was going to try to make it an isosurface...

The HSV to RGB macros are copied into the SDL to keep the parse time down, as I
haven't had the roundtuits to install 3.71-etc

I was surprised and delighted to see how closely related these are to Lissajous
figures, which I was just recently fiddling with.  I guess if there's no
damping, then they are identical things.

I haven't implemented the moving paper portion of the code yet.

Now we just need an animated inverse kinematic harmonograph machine to go with
the output...   :D

I haven't gotten anything near as beautiful as Anthraquinone did - I guess it's
all in the skill of acquiring a good feel for the oscillation parameters, and
writing up a nice texture for the trace.

#######################################################################

#version 3.7;

global_settings {assumed_gamma 1.0}

#include "colors.inc"
#include "consts.inc"
#include "textures.inc"

#declare Size = 20;

camera {
 location <0, 0, -Size*2> // Front
 //location <0, Size*3, 10> // Top
 look_at  <0, 0, 10>
 right     x*image_width/image_height
 up y
}


light_source {<10, 10, -100> White shadowless}

#macro _CH2RGB (HH)
   #local H = mod(HH, 360);
   #local H = (H < 0 ? H+360 : H);
   #switch (H)
      #range (0, 120)
         #local R = (120-  H) / 60;
         #local G = (  H-  0) / 60;
         #local B = 0;
      #break
      #range (120, 240)
         #local R = 0;
         #local G = (240-  H) / 60;
         #local B = (  H-120) / 60;
      #break
      #range (240, 360)
         #local R = (  H-240) / 60;
         #local G = 0;
         #local B = (360-  H) / 60;
      #break
   #end
   <min(R,1), min(G,1), min(B,1)>
#end

#macro _CHSV2RGB(Color)
   #local HSVFT = color Color;
   #local H = (HSVFT.red);
   #local S = (HSVFT.green);
   #local V = (HSVFT.blue);
   #local SatRGB = _CH2RGB(H);
   #local RGB = ( ((1-S)*<1,1,1> + S*SatRGB) * V );
   <RGB.red,RGB.green,RGB.blue,(HSVFT.filter),(HSVFT.transmit)>
#end


#declare Line = 0.1;

#declare Amp = 4;
#declare Amp1 = 10;  // X
#declare Amp2 = 5;  // X
#declare Amp3 = 10;  // Y
#declare Amp4 = 5;  // Y

#declare Freq = 1;
#declare Freq1 = 10; // X
#declare Freq2 = 10; // X
//--------------------------------
#declare Freq3 = 10; // Y
#declare Freq4 = 160; // Y

#declare Phase = 0;
#declare Phase1 = pi/2; // X
#declare Phase2 = pi/3; // X
#declare Phase3 = 0; // Y
#declare Phase4 = pi/6; // Y

#declare Damp = 0.1;
#declare Damp1 = 0.1; // X
#declare Damp2 = 0.1; // X
#declare Damp3 = 0.1; // Y
#declare Damp4 = 0.1; // Y

// From:  https://en.wikipedia.org/wiki/Harmonograph
// movement of a damped pendulum:
// #declare X = function (T) { Amp*sin(T*Freq+Phase)*pow(e, (-Damp*T)) };


//the motion of a rod connected to the bottom of the pendulum along one axes
will be described by the equation

// #declare X = function (T) { Amp1*sin(T*Freq1+Phase1)*pow(e, (-Damp1*T)) +
Amp2*sin(T*Freq2+Phase2)*pow(e, (-Damp2*T)) };

// A typical harmonograph has two pendulums that move in such a fashion, and a
pen that is moved by two perpendicular rods connected to these pendulums.
// Therefore the path of the harmonograph figure is described by the parametric
equations

//#declare X = function (T) { Amp1*sin(T*Freq1+Phase1)*pow(e, (-Damp1*T)) +
Amp2*sin(T*Freq2+Phase2)*pow(e, (-Damp2*T)) };
//#declare Y = function (T) { Amp3*sin(T*Freq3+Phase3)*pow(e, (-Damp3*T)) +
Amp4*sin(T*Freq4+Phase4)*pow(e, (-Damp4*T)) };


#declare Iterations = 20;
#declare Step = 0.0001;

#for (i, 0, Iterations*2*pi, Step)
 #local T = i;
 #local X = Amp1*sin(T*Freq1+Phase1)*pow(e, (-Damp1*T)) +
Amp2*sin(T*Freq2+Phase2)*pow(e, (-Damp2*T));
 #local Y = Amp3*sin(T*Freq3+Phase3)*pow(e, (-Damp3*T)) +
Amp4*sin(T*Freq4+Phase4)*pow(e, (-Damp4*T));
 #local H = (360/Iterations)*i;
 #local Color = _CHSV2RGB(<H, 1, 1, 0, 0>);
   sphere {
    <X, Y, i>, Line
    texture {pigment {rgbft Color} finish {specular 0.6} }
    }
#end // end for i


Post a reply to this message

From: AQ
Subject: Re: Harmonograph simulation
Date: 9 Oct 2016 11:41:27
Message: <k96kvb1na0575fh43ehiagoa1gth70f3fr@4ax.com>
On Tue, 27 Sep 2016 12:17:18 EDT, "Bald Eagle" <cre### [at] netscapenet> wrote:

>William F Pokorny <ano### [at] anonymousorg> wrote:
>
>> Neat! I'd like to see the source code.
>>
>> Bill P.
>
>I was interested too, and just grabbed some info from Wikipedia and worked out
>something functional.
>My head was not in "function-space" at the time, so I just embedded the formulas
>in the loop.
>I think initially I was going to try to make it an isosurface...
>
>The HSV to RGB macros are copied into the SDL to keep the parse time down, as I
>haven't had the roundtuits to install 3.71-etc
>
>I was surprised and delighted to see how closely related these are to Lissajous
>figures, which I was just recently fiddling with.  I guess if there's no
>damping, then they are identical things.
>
>I haven't implemented the moving paper portion of the code yet.
>
>Now we just need an animated inverse kinematic harmonograph machine to go with
>the output...   :D
>
>I haven't gotten anything near as beautiful as Anthraquinone did - I guess it's
>all in the skill of acquiring a good feel for the oscillation parameters, and
>writing up a nice texture for the trace.
>

You have a lot of parameters to play with there.  
I simplified the code a bit so I could try to understand it and changed the colouring
again for simplicity. It needs to be simple for me to understand
it.  I had not seen those macros before.  I will have to have a look at them later.

AQ


Post a reply to this message

From: Bald Eagle
Subject: Re: Harmonograph simulation
Date: 10 Oct 2016 10:20:00
Message: <web.57fba2633023a69ab488d9aa0@news.povray.org>
AQ <AQ### [at] worldcom> wrote:

> You have a lot of parameters to play with there.
> I simplified the code a bit so I could try to understand it and changed the
colouring again for simplicity. It needs 
to be simple for me to understand
> it.

It does seem like a lot of parameters at first, but it's not really a lot to
understand.

2 pendulums, each has amplitude, frequency, phase, and dampening.
each one has a second "wiggle" to it - thus there are four sets of 4 parameters.
I didn't even apply the first equation again to simulate the moving paper as
suggested in the Wikipedia article!  :)  :O

> I had not seen those macros before.  I will have to have a look at them later.

I discovered them after trying to follow some of the discussions about different
color spaces, and finally tracked down a thread where their location was
disclosed.
Now that I know that they're there, I find I play with them quite a bit for
scenes requiring lots of color changes.

Thanks for you initial image post - it's still quite inspiring!

> AQ


Post a reply to this message

From: Bald Eagle
Subject: Re: Harmonograph simulation
Date: 18 Nov 2016 12:35:01
Message: <web.582f3b133023a69ac437ac910@news.povray.org>
Just found this recently:

http://wheelof.com/sketch/

There's a link to source code on GitHub


Post a reply to this message

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