POV-Ray : Newsgroups : povray.general : Tiling hexagons Server Time
5 Nov 2024 11:18:58 EST (-0500)
  Tiling hexagons (Message 1 to 10 of 28)  
Goto Latest 10 Messages Next 10 Messages >>>
From: SharkD
Subject: Tiling hexagons
Date: 20 Nov 2008 11:40:00
Message: <web.492592872dcccb62ba26248c0@news.povray.org>
I want to create an image of hexagons that is tilable (such as a Desktop image).
However, I don't think it's possible to create a rectangular image with the
correct width/height ratio due to the odd angles. What's the best way to go
about doing this?

-Mike


Post a reply to this message

From: SharkD
Subject: Re: Tiling hexagons
Date: 20 Nov 2008 11:50:00
Message: <web.4925943c1539762dba26248c0@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> I want to create an image of hexagons that is tilable (such as a Desktop image).
> However, I don't think it's possible to create a rectangular image with the
> correct width/height ratio due to the odd angles. What's the best way to go
> about doing this?
>
> -Mike

I forgot to describe the math behind the needed aspect ratio:

Width  = 2*cos(30)
Height = 1

I don't believe there exists a multiple of this ratio where the numerator and
denominator are both integers. Hence the problem.

-Mike


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Tiling hexagons
Date: 20 Nov 2008 12:00:01
Message: <web.492597351539762d81c811d20@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> I want to create an image of hexagons that is tilable (such as a Desktop image).
> However, I don't think it's possible to create a rectangular image with the
> correct width/height ratio due to the odd angles. What's the best way to go
> about doing this?
>
> -Mike

If I understand you correctly:

The ratio of width/height of a hexagon is (2 x cos(60) + 1)/(2 x sin(60) ~1.732
You can use this ratio or multiple to base your image size/resolution on
eg: 600 x 520
Due to rounding and that pixels need to be integers there is a slight
distortion, but it shouldn't be noticeable (actual size 600 x 519.6152, image
width is only 0.074% larger)

-tgq


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Tiling hexagons
Date: 20 Nov 2008 12:25:00
Message: <web.49259d331539762d81c811d20@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> "SharkD" <nomail@nomail> wrote:
> > I want to create an image of hexagons that is tilable (such as a Desktop image).
> > However, I don't think it's possible to create a rectangular image with the
> > correct width/height ratio due to the odd angles. What's the best way to go
> > about doing this?
> >
> > -Mike
>
> I forgot to describe the math behind the needed aspect ratio:
>
> Width  = 2*cos(30)
> Height = 1
>
> I don't believe there exists a multiple of this ratio where the numerator and
> denominator are both integers. Hence the problem.
>
> -Mike


1351 X 1170
1560 x 1351
both have a difference of 0.000027%

-tgq


Post a reply to this message

From: Dan Connelly
Subject: Re: Tiling hexagons
Date: 20 Nov 2008 12:54:47
Message: <4925a467$1@news.povray.org>
Trevor G Quayle wrote:

> 1351 X 1170
> 1560 x 1351
> both have a difference of 0.000027%

Here's a list of ratios which do the best, for sizes up to that ratio, or reproducing
the desired aspect ration:

W    H    error
1    1    0.154700538379252
4    3    0.133974596215561
5    4    0.0762395692965987
6    5    0.0377495513506236
7    6    0.010256681389213
15   13   0.00074046659535143
52   45   0.000739918710263021
67   58   0.000408489164229975
82   71   0.000198314330160265
97   84   5.31420220913903e-05
209  181  3.81553418438152e-06
724  627  3.815519626027e-06
933  808  2.10609814010887e-06
1142 989  1.02236683030554e-06
1351 1170 2.7394246893131e-07
2911 2521 1.96681873010363e-08


Post a reply to this message

From: SharkD
Subject: Re: Tiling hexagons
Date: 20 Nov 2008 13:25:01
Message: <web.4925aae81539762db73646fd0@news.povray.org>
Dan Connelly <djc### [at] yahoocom> wrote:
> Trevor G Quayle wrote:
>
> > 1351 X 1170
> > 1560 x 1351
> > both have a difference of 0.000027%
>
> Here's a list of ratios which do the best, for sizes up to that ratio, or
reproducing the desired aspect ration:
>
> W    H    error
> 1    1    0.154700538379252
> 4    3    0.133974596215561
> 5    4    0.0762395692965987
> 6    5    0.0377495513506236
> 7    6    0.010256681389213
> 15   13   0.00074046659535143
> 52   45   0.000739918710263021
> 67   58   0.000408489164229975
> 82   71   0.000198314330160265
> 97   84   5.31420220913903e-05
> 209  181  3.81553418438152e-06
> 724  627  3.815519626027e-06
> 933  808  2.10609814010887e-06
> 1142 989  1.02236683030554e-06
> 1351 1170 2.7394246893131e-07
> 2911 2521 1.96681873010363e-08

None of the values you've listed match the correct aspect ratio. For instance,
2521 * ~1.73 = ~4367, and 1170 * ~1.73 = ~2026. Also, precision is important
because the pattern in the tiles needs to line up with an identical pattern in
a larger image. Also, the tiles themselves must have a low resolution. None of
the low-resolution options seem to have an acceptible margin of error.

-Mike


Post a reply to this message

From: Dan Connelly
Subject: Re: Tiling hexagons
Date: 20 Nov 2008 13:44:36
Message: <4925b014@news.povray.org>
SharkD wrote:

> None of the values you've listed match the correct aspect ratio.

The ratio of the width to the height of a hexagon = sqrt(3)/2.

Dan


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Tiling hexagons
Date: 20 Nov 2008 13:55:00
Message: <web.4925b2391539762d81c811d20@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> Dan Connelly <djc### [at] yahoocom> wrote:
> > Trevor G Quayle wrote:
> >
> > > 1351 X 1170
> > > 1560 x 1351
> > > both have a difference of 0.000027%
> >
> > Here's a list of ratios which do the best, for sizes up to that ratio, or
reproducing the desired aspect ration:
> >
> > W    H    error
> > 1    1    0.154700538379252
> > 4    3    0.133974596215561
> > 5    4    0.0762395692965987
> > 6    5    0.0377495513506236
> > 7    6    0.010256681389213
> > 15   13   0.00074046659535143
> > 52   45   0.000739918710263021
> > 67   58   0.000408489164229975
> > 82   71   0.000198314330160265
> > 97   84   5.31420220913903e-05
> > 209  181  3.81553418438152e-06
> > 724  627  3.815519626027e-06
> > 933  808  2.10609814010887e-06
> > 1142 989  1.02236683030554e-06
> > 1351 1170 2.7394246893131e-07
> > 2911 2521 1.96681873010363e-08
>
> None of the values you've listed match the correct aspect ratio. For instance,
> 2521 * ~1.73 = ~4367, and 1170 * ~1.73 = ~2026. Also, precision is important
> because the pattern in the tiles needs to line up with an identical pattern in
> a larger image. Also, the tiles themselves must have a low resolution. None of
> the low-resolution options seem to have an acceptible margin of error.
>
> -Mike

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


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

1351 x 1170 (0.000027%)
1560 x 1351 (0.000027%)
1142 x 989 (0.000102%)
933 x 808 (0.000211%)
724 x 627 (0.000382%)
1448 x 1254 (0.000382%)
627 x 543 (0.000382%)
1045 x 905 (0.000382%)
1254 x 1086 (0.000382%)
1463 x 1267 (0.000382%)
209 x 181 (0.000382%)
418 x 362 (0.000382%)
836 x 724 (0.000382%)
1239 x 1073 (0.000510%)
515 x 446 (0.000691%)
1030 x 892 (0.000691%)
1545 x 1338 (0.000691%)
1575 x 1364 (0.000732%)
1366 x 1183 (0.000786%)
1336 x 1157 (0.000859%)
1157 x 1002 (0.000859%)
821 x 711 (0.000964%)
948 x 821 (0.000964%)

-tgq


Post a reply to this message

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

Goto Latest 10 Messages Next 10 Messages >>>

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