POV-Ray : Newsgroups : povray.binaries.images : A method to plot histograms for patterns / functions. Server Time
15 Jul 2024 02:00:00 EDT (-0400)
  A method to plot histograms for patterns / functions. (Message 1 to 5 of 5)  
From: William F Pokorny
Subject: A method to plot histograms for patterns / functions.
Date: 4 Sep 2023 07:37:34
Message: <64f5c17e$1@news.povray.org>
I'm attaching the scene file from the povr fork, but I'm 90% sure the 
method used will work for v3.7 and v3.8 official releases - if the povr 
inbuilt function 'f_range2range()' is replaced with whatever the SDL 
coded version is that is shipped with official POV-Ray releases. The 
name escapes me at the moment.

Image on top is 'wrinkles' with noise_generator 2 and on the bottom with 
noise_generator 3 - FWIW.

Bill P.


Post a reply to this message


Attachments:
Download 'histogram.pov.txt' (4 KB) Download 'histwrinklesnoise2an3.png' (11 KB)

Preview of image 'histwrinklesnoise2an3.png'
histwrinklesnoise2an3.png


 

From: Bald Eagle
Subject: Re: A method to plot histograms for patterns / functions.
Date: 4 Sep 2023 14:30:00
Message: <web.64f6215f80a29cb21f9dae3025979125@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:
> I'm attaching the scene file from the povr fork, but I'm 90% sure the
> method used will work for v3.7 and v3.8 official releases - if the povr
> inbuilt function 'f_range2range()' is replaced with whatever the SDL
> coded version is that is shipped with official POV-Ray releases. The
> name escapes me at the moment.
>
> Image on top is 'wrinkles' with noise_generator 2 and on the bottom with
> noise_generator 3 - FWIW.
>
> Bill P.

Well, there's a histogram macro in math.inc

Histogram(ValArr, Intervals): This macro declares a global, 2D array named
HistogramArray. The first value in the array is the center of the interval/bin,
the second the number of values in that interval.

Parameters:

ValArr = An array with values.
Intervals = The desired number of intervals/bins.


Not sure if that's what you were looking for.

- BW


Post a reply to this message

From: William F Pokorny
Subject: Re: A method to plot histograms for patterns / functions.
Date: 4 Sep 2023 22:11:36
Message: <64f68e58$1@news.povray.org>
On 9/4/23 14:26, Bald Eagle wrote:
> Well, there's a histogram macro in math.inc
> 
> Histogram(ValArr, Intervals): This macro declares a global, 2D array named
> HistogramArray. The first value in the array is the center of the interval/bin,
> the second the number of values in that interval.
> 
> Parameters:
> 
> ValArr = An array with values.
> Intervals = The desired number of intervals/bins.
> 
> 
> Not sure if that's what you were looking for.
> 
> - BW

Thanks for the prompt! I was aware of it. In the povr fork it is located 
in an include file called arraystatistics.inc almost completely 
re-written by Tor Olav Kristensen back in mid 2021.

On seeing your post though, I immediately had the thought: "Ya know Bill 
(the me version of Bill)..., you didn't code up anything using this 
include file and compare performance."

Aside: I need a slightly modified version of the macro.

My thinking was anything mostly an all functions alternative would be 
faster than a pure parser method. However, with some hacked, not quite 
right, pure parser code just now - it looks like what I have coded is 
running a lot (~10x) slower! I'll play with this stuff more tomorrow. 


Bill P.


Post a reply to this message

From: ingo
Subject: Re: A method to plot histograms for patterns / functions.
Date: 5 Sep 2023 01:35:00
Message: <web.64f6bd9780a29cb217bac71e8ffb8ce3@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:
> I'll play with this stuff more tomorrow.
>

Hah, I wrote these and the distribution macro's in rand.inc last century. The
original include file also had macro's and scene for visualizations not unlike
your images (i.i.r.c. ... last century).

ingo


Post a reply to this message

From: William F Pokorny
Subject: Re: A method to plot histograms for patterns / functions.
Date: 6 Sep 2023 11:15:29
Message: <64f89791$1@news.povray.org>
On 9/5/23 01:33, ingo wrote:
> William F Pokorny <ano### [at] anonymousorg> wrote:
>> I'll play with this stuff more tomorrow.
>>
> 
> Hah, I wrote these and the distribution macro's in rand.inc last century. The
> original include file also had macro's and scene for visualizations not unlike
> your images (i.i.r.c. ... last century).
> 
> ingo
> 
> 
> 
Ah, I knew you had a big hand in rand.inc, didn't know about (or at 
perhaps remember... the histogram macro) :-). Suppose the need has been 
around a long time too. I'd for years been using external tools, but a 
few days ago I decided to code up something which better aligned with 
what I wanted - all POV-Ray.

And Bill W., Thanks again for mentioning the histogram macro - it got me 
thinking and I've finished now a couple re-writes and have one slightly 
faster than an all SDL one, but both run in a few seconds as a rule. My 
updated code will be part of the next, published povr fork tarball.

It's interesting what you see on cranking up the bin and sample counts. 
Attached an image using 1 million samples and 8192 bins - some of the 
quirks start to show (again wrinkles, noise generator 3) - though doubt 
they matter too much practically.

Bill P.


Post a reply to this message


Attachments:
Download 'histogram.png' (54 KB)

Preview of image 'histogram.png'
histogram.png


 

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