POV-Ray : Newsgroups : povray.binaries.images : hilbert2d utility Server Time
19 Apr 2024 23:54:35 EDT (-0400)
  hilbert2d utility (Message 33 to 42 of 42)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Stephen
Subject: Re: hilbert2d utility
Date: 26 May 2018 03:15:29
Message: <5b090991@news.povray.org>
On 26/05/2018 07:37, Thomas de Groot wrote:
> On 25-5-2018 22:53, Stephen wrote:
>> On 25/05/2018 21:35, Bald Eagle wrote:
>>> This actually suggests that since a Hilbert curve is a continuous 
>>> function that
>>> can fill 2D (3d?)
>>
>>
>> That's how jr hooked me, with a 3D Hilbert curve. ;-)
>>
>> You might be able to twist his arm. ☺
>>
>>
> 
> Which reminds me: how do you run this utility?
> 

In a *nix environment. I installed Cygwin so it runs in a DOS box. If 
you want it to run the included example. You will need to have 
pvengine.exe in your path.

-- 

Regards
     Stephen


Post a reply to this message

From: Stephen
Subject: Re: hilbert2d utility
Date: 26 May 2018 04:37:03
Message: <5b091caf$1@news.povray.org>
On 26/05/2018 08:15, Stephen wrote:
>>
>> Which reminds me: how do you run this utility?
>>
> 
> In a *nix environment. I installed Cygwin so it runs in a DOS box. If 
> you want it to run the included example. You will need to have 
> pvengine.exe in your path.

Once you have done that. Put hilbert2d.c and makefile in a directory 
then type make [enter]. This will compile hilbert2d.exe.
Run hilbert2d –n13 –Dobigtest
And it will create an include file and a pov file.

Or drop me a mail and I will give you a copy of the one I compiled.


-- 

Regards
     Stephen


Post a reply to this message

From: Stephen
Subject: Re: hilbert2d utility
Date: 26 May 2018 04:39:40
Message: <5b091d4c$1@news.povray.org>
On 26/05/2018 09:37, Stephen wrote:
> hilbert2d –n13 –Dobigtest

<sigh>
-n N the program generates Hilbert curves which are always 2ˆN units 
long, the length argument provides the value of N, the range is: 2 <= N 
<= 24. the default is "6", that is, a length of 64, covering 8x8 units 
(unscaled).


-- 

Regards
     Stephen


Post a reply to this message

From: Thomas de Groot
Subject: Re: hilbert2d utility
Date: 26 May 2018 07:10:38
Message: <5b0940ae$1@news.povray.org>
On 26-5-2018 10:37, Stephen wrote:
> On 26/05/2018 08:15, Stephen wrote:
>>>
>>> Which reminds me: how do you run this utility?
>>>
>>
>> In a *nix environment. I installed Cygwin so it runs in a DOS box. If 
>> you want it to run the included example. You will need to have 
>> pvengine.exe in your path.
> 
> Once you have done that. Put hilbert2d.c and makefile in a directory 
> then type make [enter]. This will compile hilbert2d.exe.
> Run hilbert2d –n13 –Dobigtest
> And it will create an include file and a pov file.
> 
> Or drop me a mail and I will give you a copy of the one I compiled.
> 
> 

Thanks indeed. It has no high priority at the moment. I shall first try 
to extend my skills by myself ;-)

-- 
Thomas


Post a reply to this message

From: jr
Subject: Re: hilbert2d utility
Date: 29 May 2018 16:40:00
Message: <web.5b0db9aeff7db64c82a92ab90@news.povray.org>
hi,

"Kenneth" <kdw### [at] gmailcom> wrote:
> Stephen <mca### [at] aolcom> wrote:
> > Hi Kenneth,
> > jr has asked me to ask you, to drop him an email on the subject. As he
> > has lost access to the newsgroups.
> Just tried to contact him, but his email address is showing up here on the web
> interface as
>   jr <cre### [at] gmailcom>
> I'm seeing ### after  cre   and they don't work. Apparently those hash marks are
> substituting for something else. :-(  Maybe it's a web-interface vs. newsreader
> difference?

sorry for lengthy delay, can post again at last.  unfortunately via web
interface, not Thunderbird.  anyhow, will put thoughts to paper before weekend.

regards, jr.


Post a reply to this message

From: jr
Subject: Re: hilbert2d utility
Date: 29 May 2018 16:40:01
Message: <web.5b0dba6aff7db64c82a92ab90@news.povray.org>
hi,

"Bald Eagle" <cre### [at] netscapenet> wrote:
> Just ran across a very interesting video about the Hilbert Curve.
> https://www.youtube.com/watch?v=3s7h2MHQtxc

v natty.  and many more "goodies" on this channel.  thank you.

> This actually suggests that since a Hilbert curve is a continuous function that
> can fill 2D (3d?)  that it can be implemented as a pigment pattern.
>
> Perhaps others with more free time can imagine other interesting uses.  :)

how does/would distance relate to colour?


regards, jr.


Post a reply to this message

From: Bald Eagle
Subject: Re: hilbert2d utility
Date: 29 May 2018 21:35:01
Message: <web.5b0dff97ff7db64c10874a080@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:

> v natty.  and many more "goodies" on this channel.  thank you.

No prob.   There's lots of cool stuff out there, and SO much to learn!


> how does/would distance relate to colour?

3.6.1.1.2 Color Map

Most of the color patterns do not use abrupt color changes of just two or three
colors like those in the brick, checker or hexagon patterns. They instead use
smooth transitions of many colors that gradually change from one point to the
next. The colors are defined in a pigment modifier called a color_map that
describes how the pattern blends from one color to the next. New in version
3.7.1 non-linear color map interpolation support has been added.


:D   :P


I suppose if the Hilbert curve is a "curve" that is continuous function and can
go from a value to a 2D coordinate, then perhaps there is the inverse of the
function that can go from 2D coordinates to the 0-1 values in a color map.

It might take some finagling to get it to work in a practical sense, but I guess
I'm envisioning a pseudo-Hilbert curve function, where you can specify a number
for the "order" or whatever the proper term is, or there's a function for the
"real" Hilbert curve, and you'd "just" fill a unit square with it.

I was guessing you were much more well versed in the topic and would have some
idea as to how to implement it.


Post a reply to this message

From: jr
Subject: Re: hilbert2d utility
Date: 30 May 2018 05:30:00
Message: <web.5b0e6dfcff7db64c82a92ab90@news.povray.org>
hi,

"Bald Eagle" <cre### [at] netscapenet> wrote:
> > how does/would distance relate to colour?
> 3.6.1.1.2 Color Map

I thought (think) of a colour map as 1D, so not sure how that relates ("maps")
to 2D, however..

> I suppose if the Hilbert curve is a "curve" that is continuous function and can
> go from a value to a 2D coordinate, then perhaps there is the inverse of the
> function that can go from 2D coordinates to the 0-1 values in a color map.

there is. example code on https://en.wikipedia.org/wiki/Hilbert_curve.

interestingly, the animated gif in the top right of that page is "coloured in".
is that similar to what you're thinking of?

> I was guessing you were much more well versed in the topic and would have some
> idea as to how to implement it.

heh.  I wouldn't know maths if it came and bit me.  the 'hilbert2d' utility is
just a "wrapper" around the code taken from that wiki page.

the output of the 'xy2d()' code could be scaled to the 0..1 range.  would that
do the trick?


regards, jr.


Post a reply to this message

From: Bald Eagle
Subject: Re: hilbert2d utility
Date: 30 May 2018 06:45:00
Message: <web.5b0e8080ff7db64c10874a080@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:

> I thought (think) of a colour map as 1D, so not sure how that relates ("maps")
> to 2D, however..


That what the Hilbert curve does, right?   Maps 1D input to 2D output?

> > I suppose if the Hilbert curve is a "curve" that is continuous function and can
> > go from a value to a 2D coordinate, then perhaps there is the inverse of the
> > function that can go from 2D coordinates to the 0-1 values in a color map.
>
> there is. example code on https://en.wikipedia.org/wiki/Hilbert_curve.
>
> interestingly, the animated gif in the top right of that page is "coloured in".
> is that similar to what you're thinking of?

Sure - but the way to think about a pigment_pattern is as an equation - for any
<x, y, z> plugged in, you should get some 0-1 out.  Then POV-Ray takes that
value and further processes it with a color map, texture map, material map,
normal, heightfield height, etc.


> the output of the 'xy2d()' code could be scaled to the 0..1 range.  would that
> do the trick?

That's literally all there is to it.

If you can find code for the 3D version, then that would provide a full
space-filling function.


Post a reply to this message

From: jr
Subject: Re: hilbert2d utility
Date: 30 May 2018 11:15:00
Message: <web.5b0ebf1bff7db64c82a92ab90@news.povray.org>
hi,

"Bald Eagle" <cre### [at] netscapenet> wrote:
> That what the Hilbert curve does, right?   Maps 1D input to 2D output?
>
> > > I suppose if the Hilbert curve is a "curve" that is continuous function and can
> > > go from a value to a 2D coordinate, then perhaps there is the inverse of the
> > > function that can go from 2D coordinates to the 0-1 values in a color map.
> >
> > there is. example code on https://en.wikipedia.org/wiki/Hilbert_curve.
> >
> > interestingly, the animated gif in the top right of that page is "coloured in".
> > is that similar to what you're thinking of?
>
> Sure - but the way to think about a pigment_pattern is as an equation - for any
> <x, y, z> plugged in, you should get some 0-1 out.  Then POV-Ray takes that
> value and further processes it with a color map, texture map, material map,
> normal, heightfield height, etc.
>
> > the output of the 'xy2d()' code could be scaled to the 0..1 range.  would that
> > do the trick?
>
> That's literally all there is to it.

it should be relatively straightforward to convert the 2D code to idiomatic C++*
and make it available as an intrinsic function which, given the length of a
curve + xy coords, spits out an index.  one for the developers, I think.

* an educated guess, I do not "speak" C++.

> If you can find code for the 3D version, then that would provide a full
> space-filling function.

there's an archive on the interweb, from ca 1999, which provides some 3D code.
if I find an unmodified copy I will post it here.


regards, jr.


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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