POV-Ray : Newsgroups : povray.general : Tiling hexagons Server Time
30 Jul 2024 22:22:42 EDT (-0400)
  Tiling hexagons (Message 9 to 18 of 28)  
<<< Previous 8 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Trevor G Quayle
Subject: Re: Tiling hexagons
Date: 20 Nov 2008 14:10:00
Message: <web.4925b5791539762d81c811d20@news.povray.org>
Further, if you need small resolutions here is a list of the best resolutions
under 1600 wide under 0.1% error.

1351 x 1170 (0.00003%)
1142 x 989 (0.00010%)
933 x 808 (0.00021%)
724 x 627 (0.00038%)
627 x 543 (0.00038%)
209 x 181 (0.00038%)
97 x 84 (0.00531%)
82 x 71 (0.01983%)
67 x 58 (0.04085%)
52 x 45 (0.07399%)
15 x 13 (0.07405%)


-tgq


Post a reply to this message

From: SharkD
Subject: Re: Tiling hexagons
Date: 20 Nov 2008 14:20:01
Message: <web.4925b7a11539762db73646fd0@news.povray.org>
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> Actually precision isn't that important as the camera aspect ratio and image
> ratio do not need to be the same.  While the image aspect ratio is restricted
> to integer combinations, the aspect ratio of the camera can be set to the exact
> mathematical ratio.  For example try setting your image resolution as square
> (say 400X400) and your camera as 2:1 and reder a sphere.  The 1x1 ratio render
> will get stretched to the 2x1 ratio image and look distorted.
> What happens is that the image gets distorted to fit the image size, but with a
> low ratio error, it should be unnoticeable

Ah, that's a clever trick. I will definitely try that. I'm not sure how to
calculate the proper "correction" to introduce the correct level of distortion,
though.

> For resolutions of width 1600 or less, these are the ones with less than 0.001%
> error:

I'm talking resolutions of 200px or less. The image is meant as a background
image for an HTML page.

Also, none of these aspect ratios still match the aspect ratio. You need to
multiply the height of the image by 2*cos(30). Is there a formula you used to
determine "close" matches? Maybe I can adapt that.

-Mike


Post a reply to this message

From: Dan Connelly
Subject: Re: Tiling hexagons
Date: 20 Nov 2008 14:29:07
Message: <4925ba83$1@news.povray.org>
SharkD wrote:
> Also, none of these aspect ratios still match the aspect ratio. You need to
> multiply the height of the image by 2*cos(30). Is there a formula you used to
> determine "close" matches? Maybe I can adapt that.

Where did you get the factor of 2?


             +         +



(-1,0) +         +(0,0)    + (1,0)




             +         +


Post a reply to this message

From: SharkD
Subject: Re: Tiling hexagons
Date: 20 Nov 2008 14:50:01
Message: <web.4925be9e1539762d45ff78e0@news.povray.org>
Dan Connelly <djc### [at] yahoocom> wrote:
> SharkD wrote:
> > Also, none of these aspect ratios still match the aspect ratio. You need to
> > multiply the height of the image by 2*cos(30). Is there a formula you used to
> > determine "close" matches? Maybe I can adapt that.
>
> Where did you get the factor of 2?
>

>              +         +
>
>
>
> (-1,0) +         +(0,0)    + (1,0)
>
>
>

>              +         +

Ah, sorry. I didn't explain things thoroughly enough. In order for the image to
be tilable, you have to cleverly select a *portion* of the hexagon--you can't
just select the entire thing! This *portion* happens to have double the aspect
ratio. Actually, there is another option, but the resulting image can't be made
as small.

Here is a graphic:

http://img505.imageshack.us/img505/1075/tileablehexagonvo7.png

The blue rectangle is the minimum area that can be tiled to produce a repeating
hexagon (assuming that the hexagon doesn't also have any greebles that result
in it being asymmetric).

-Mike


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Tiling hexagons
Date: 20 Nov 2008 14:55:00
Message: <web.4925bffa1539762d81c811d20@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> Ah, that's a clever trick. I will definitely try that. I'm not sure how to
> calculate the proper "correction" to introduce the correct level of distortion,
> though.
>

There is no correction to calculate, just set your camera vectors to the proper
ratios for the actual hex pattern.

>
> I'm talking resolutions of 200px or less. The image is meant as a background
> image for an HTML page.
>
> Also, none of these aspect ratios still match the aspect ratio. You need to
> multiply the height of the image by 2*cos(30). Is there a formula you used to
> determine "close" matches? Maybe I can adapt that.
>
> -Mike

You are right about the ratio.  The 2:2cos(30) ratio I've been using is the
ratio of hex width to height, but for tiling of a hex pattern it should be
3:2cos(30) or 2cos(30):1.

To get the values I basically just used an excel spreadsheet to calculate and
tabulate the values.


Best ratios under 1600 width:
1351 x 780 ( 0.000027% )
989 x 571 ( 0.000102% )
362 x 209 ( 0.000382% )
724 x 418 ( 0.000382% )
1086 x 627 ( 0.000382% )
1448 x 836 ( 0.000382% )
627 x 362 ( 0.000382% )
1254 x 724 ( 0.000382% )
1519 x 877 ( 0.000563% )
1545 x 892 ( 0.000691% )
892 x 515 ( 0.000691% )
1183 x 683 ( 0.000786% )
1157 x 668 ( 0.000859% )
821 x 474 ( 0.000964% )
1422 x 821 ( 0.000964% )


Best ratios ranked by size:
1351 x 780 ( 0.00003% )
989 x 571 ( 0.00010% )
362 x 209 ( 0.00038% )
265 x 153 ( 0.00142% )
97 x 56 ( 0.00531% )
71 x 41 ( 0.01984% )
26 x 15 ( 0.07399% )
19 x 11 ( 0.27663% )
7 x 4 ( 1.02567% )



-tgq


Post a reply to this message

From: SharkD
Subject: Re: Tiling hexagons
Date: 20 Nov 2008 15:10:00
Message: <web.4925c3df1539762d670187080@news.povray.org>
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> There is no correction to calculate, just set your camera vectors to the proper
> ratios for the actual hex pattern.

Awesome! Thanks!


> You are right about the ratio.  The 2:2cos(30) ratio I've been using is the
> ratio of hex width to height, but for tiling of a hex pattern it should be
> 3:2cos(30) or 2cos(30):1.

Actually, you were correct to begin with!!!! :) I looked at it again and
realized the method I described only reproduces the "isometric" pattern of
intersecting lines (which is sufficient for my needs). To reproduce the actual
*hexagon* in its entirety you need to take things a step further:

http://img505.imageshack.us/img505/1909/tileablehexagon2rn5.png


> To get the values I basically just used an excel spreadsheet to calculate and
> tabulate the values.

Thanks for the tip! I was hoping for an algorithmic approach, but I guess
there's no real need to go to all that effort.

Thanks again!

-Mike


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Tiling hexagons
Date: 20 Nov 2008 15:35:00
Message: <web.4925c9971539762d81c811d20@news.povray.org>
"SharkD" <nomail@nomail> wrote:
>
> > You are right about the ratio.  The 2:2cos(30) ratio I've been using is the
> > ratio of hex width to height, but for tiling of a hex pattern it should be
> > 3:2cos(30) or 2cos(30):1.
>
> Actually, you were correct to begin with!!!! :) I looked at it again and
> realized the method I described only reproduces the "isometric" pattern of
> intersecting lines (which is sufficient for my needs). To reproduce the actual
> *hexagon* in its entirety you need to take things a step further:
>
> http://img505.imageshack.us/img505/1909/tileablehexagon2rn5.png
>

OK I need to go through step by step.

If we want a hex pattern that is purely tileable (no mirroring) using your
image, the width is the same as the green area:
W=2*cos(30)
the height should actually be twice what your green area is:
H=2+2*sin(30)
=2+1
=3

W/H=2*cos(30)/3 or 1/2*cos(30)

The green box you have drawn is:
W/H=4*cos(30)/3 or 1/cos(30)
but this only works if you mirror the pattern on the x-axis

and if you want to mirror across both the x and y axis, you may as well cut the
width in half again which is the same as the first ratio:
W/H=2*cos(30)/3 or 1/2*cos(30)

So it depends on how you intend to map you pattern.  Usually desktop tiling
doesn't mirror so you would want tne first ratio for a directly tileable
pattern.  I hope this clarifies things a bit.

-tgq


Post a reply to this message

From: Dan Connelly
Subject: Re: Tiling hexagons
Date: 20 Nov 2008 15:40:37
Message: <4925cb45$1@news.povray.org>
SharkD wrote:

> Actually, you were correct to begin with!!!! :) I looked at it again and
> realized the method I described only reproduces the "isometric" pattern of
> intersecting lines (which is sufficient for my needs). To reproduce the actual
> *hexagon* in its entirety you need to take things a step further:

So we're back with sqrt(3)/2 (or 2/sqrt(3)) ?

> Thanks for the tip! I was hoping for an algorithmic approach, but I guess
> there's no real need to go to all that effort.
> 

This is what I did:

% perl -e 'my $fmin = 10; for (my $n = 1; $n < 10000; $n ++) { my $m = int(sqrt(3) / 2
* $n + 0.5); my $f = abs( $m / $n / (sqrt(3) / 2) - 1); if ($f < $fmin) { $fmin = $f;
$n0 = $n; $m0 = $m; printf "%6d %6d %g\n", $n0, $m0, $fmin } }'


Post a reply to this message

From: "Jérôme M. Berger"
Subject: Re: Tiling hexagons
Date: 20 Nov 2008 16:32:12
Message: <4925d75c$1@news.povray.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Trevor G Quayle wrote:
> "SharkD" <nomail@nomail> wrote:
>>> You are right about the ratio.  The 2:2cos(30) ratio I've been using is the
>>> ratio of hex width to height, but for tiling of a hex pattern it should be
>>> 3:2cos(30) or 2cos(30):1.
>> Actually, you were correct to begin with!!!! :) I looked at it again and
>> realized the method I described only reproduces the "isometric" pattern of
>> intersecting lines (which is sufficient for my needs). To reproduce the actual
>> *hexagon* in its entirety you need to take things a step further:
>>
>> http://img505.imageshack.us/img505/1909/tileablehexagon2rn5.png
>>
> 
> OK I need to go through step by step.
> 
> If we want a hex pattern that is purely tileable (no mirroring) using your
> image, the width is the same as the green area:
> W=2*cos(30)
> the height should actually be twice what your green area is:
> H=2+2*sin(30)
> =2+1
> =3
> 
> W/H=2*cos(30)/3 or 1/2*cos(30)
> 
> The green box you have drawn is:
> W/H=4*cos(30)/3 or 1/cos(30)
> but this only works if you mirror the pattern on the x-axis
> 
	Actually, it works without mirroring, but you need to offset every
other line by half the width of the green area.

		Jerome
- --
+------------------------- Jerome M. BERGER ---------------------+
|    mailto:jeb### [at] freefr      | ICQ:    238062172            |
|    http://jeberger.free.fr/     | Jabber: jeb### [at] jabberfr   |
+---------------------------------+------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkkl16wACgkQd0kWM4JG3k8WMQCfVoSAEPLSZMdpoil3FtMuLx7/
6YIAniN3pvcDibyQ64fWRHUFoXNAmTv+
=imnu
-----END PGP SIGNATURE-----


Post a reply to this message

From: Dan Connelly
Subject: Re: Tiling hexagons
Date: 20 Nov 2008 18:31:22
Message: <4925f34a$1@news.povray.org>
Can someone post some sample code here regarding this issue?


Post a reply to this message

<<< Previous 8 Messages Goto Latest 10 Messages Next 10 Messages >>>

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