Hard Light Productions Forums

Off-Topic Discussion => General Discussion => Topic started by: Sandwich on April 07, 2016, 08:24:59 am

Title: Math/geometry Question
Post by: Sandwich on April 07, 2016, 08:24:59 am
I'm trying to figure out SVG hexagons. I want to find some size values that result in integers. I know that the height of a hexagon is height = sqrt(3)/2 * width. I'd like 'height' and 'width' to be integers.

So the question is, can the square root of 3, divided by 2, be multiplied by some integer to result in another integer? :)
Title: Re: Math/geometry Question
Post by: The E on April 07, 2016, 08:35:56 am
Short answer: No.

Slightly longer answer: Given that sqrt(3) is an irrational number, no integer exists that, when multiplied by sqrt(3), results in another integer.
Title: Re: Math/geometry Question
Post by: Phantom Hoover on April 07, 2016, 11:13:54 am
Longer answer still: no, and you can't trisect the angle on its corner with a straightedge and compass either.
Title: Re: Math/geometry Question
Post by: GhylTarvoke on April 07, 2016, 11:19:10 am
No integer except zero.    :p
Title: Re: Math/geometry Question
Post by: Bobboau on April 07, 2016, 11:39:51 am
You know... I didn't see a constraint about this needing to be a regular hexagon.
You can just squish the thing to be any integer in any direction you want.
Title: Re: Math/geometry Question
Post by: Kobrar44 on April 07, 2016, 11:57:46 am
Well, floating point numbers only have like 8 digit precision, and double 15-16 so some 9 or 17+ digit integer should work for whatever you need that, and 64bit type has 19 IIRC.
Title: Re: Math/geometry Question
Post by: The E on April 07, 2016, 12:01:19 pm
Are you volunteering to search that number space for possible solutions?
Title: Re: Math/geometry Question
Post by: Phantom Hoover on April 07, 2016, 02:07:40 pm
Well, floating point numbers only have like 8 digit precision, and double 15-16 so some 9 or 17+ digit integer should work for whatever you need that, and 64bit type has 19 IIRC.

OK you've misunderstood floats a fair bit here; anyway, what you're describing is basically no different to just using the float approximation of sqrt(3).
Title: Re: Math/geometry Question
Post by: Sandwich on April 07, 2016, 04:31:28 pm
Given that sqrt(3) is an irrational number...

It makes perfect sense though.... :nervous:

Ok, thanks guys. Just checking. I found a few options that are "close enough" (one integer in the 100-200 range resulted in a number that had .0023###-something tacked on to it, which is near enough for web accuracy IMO).