POV-Ray : Newsgroups : povray.general : Interested in 16-bit height field functions? : Re: Interested in 16-bit height field functions? Server Time
30 Jul 2024 08:26:10 EDT (-0400)
  Re: Interested in 16-bit height field functions?  
From: mone
Date: 10 Jan 2010 18:45:00
Message: <web.4b4a6617dee126c3fa00a0a00@news.povray.org>
stbenge <UN### [at] hotmailcom> wrote:

>
> Do you know about sin/cos functions?

I recall dimly there was sth. like that at school that I never quite understood.

With them, you can make polygonal
> shapes with any number of sides. For instance, to make a 6-sided prism
> you can use sin/cos like so:
>
> prism{
>   -1,1,7,
>   <sin(pi*2/6*0),cos(pi*2/6*0)>,
>   <sin(pi*2/6*1),cos(pi*2/6*1)>,
>   <sin(pi*2/6*2),cos(pi*2/6*2)>,
>   <sin(pi*2/6*3),cos(pi*2/6*3)>,
>   <sin(pi*2/6*4),cos(pi*2/6*4)>,
>   <sin(pi*2/6*5),cos(pi*2/6*5)>,
>   <sin(pi*2/6*0),cos(pi*2/6*0)> // closing the hexagon
>   pigment{rgb 1}
> }
>
> Essentially, sin/cos functions map a circle. By studying this code, you
> can figure out how to make polygons with any number of sides. You can
> apply it towards other objects, like cylinders and spheres to make
> skeletal frameworks.
>

I see. I just checked that with cylinders, it becomes a hexagon when one puts
the sin/cos lines in the end and start points coordinates. There are some ugly
gaps in between but basically it works. Might be useful for some other things
I'll put it in my "tipps & tricks" folder :).



> > The little yellow star thing inspired me to try to make a whole field of sphere
> > sweep hexagons in a row with a while loop. But I still haven't figured out the
> > correct distance between them.
>
> I included two functions and two variables in the include file for
> working in trigonal space, you might want to check them out. With them,
> you can find the correct distances :) They are called: h1, h2, ht(x,y),
> ht2(x,y).

I had a look at them but I don't understand them.
The distances between points I tried to find out yesterday with graph paper,
which didn't work, then I looked them up at wikipedia which did work.

But what I meant with distances in the rows and columns of the hexagonal
sphere_sweeps was not the distances between the points of one hexagon but
between the single hexagons. Though I could calculate the distance, I wanted
them to overlap, so two of them always share one border because that looks
better. The width of the borders I could not calculate because it is determined
by the width of the gradient in the heightfield texture. Maybe some mastermind
can calculate them too, but it will be no problem to just trial&error a bit.



> I think he might have been talking about making a basic height_field
> tile, like this (Thunderbird might put a line directly through the hexagon):
>      ____
>     /    \
> __/      \__
>    \      /
>     \____/
>
>
> It's a height_field with only one hexagon, an object you can place in a
> nested #while loop to make a larger honeycomb. You can use the
> previously mentioned variables and functions from my hex patterns
> include file to scale the hexagon correctly.
>

Oh, I see. I have understood that now :)

I'll try to do my best and output some final images now, which should be no
problem with all the useful advice and before anybody will get hexagonized :))


Thanks & Best wishes

Simone


Post a reply to this message

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