POV-Ray : Newsgroups : povray.binaries.images : hilbert2d utility : Re: hilbert2d utility Server Time
3 May 2024 10:38:42 EDT (-0400)
  Re: hilbert2d utility  
From: jr
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

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