POV-Ray : Newsgroups : povray.binaries.images : hilbert2d utility Server Time
2 Jun 2024 08:28:24 EDT (-0400)
  hilbert2d utility (Message 41 to 42 of 42)  
<<< Previous 10 Messages Goto Initial 10 Messages
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.