
Algebra PreAlgebra and Basic Algebra Math Forum 
 LinkBack  Thread Tools  Display Modes 
March 9th, 2009, 07:34 AM  #1 
Newbie Joined: Mar 2009 Posts: 2 Thanks: 0  Calculating the side length of a hexagon from a rect.w/h?
Hi, I need to calculate the side length of a hexagon. To make things easy let's say I want to create a hexagon whose six sides have all the same length and I want to get the side length by providing values for the width and height of a rectangle in that the hexagon fits in... To give an example let's say I decide a rectangle area with a width and height of 80 pixels and I want to create a hexagon that fits into this rectangle. The hexagon should be a vertical one, where the top/bottom has straight lines e.g. like this http://en.wikipedia.org/wiki/File:Regular_hexagon.svg Could anyone give me a hint on how to calculate this? I know I have to calculate the right triangle and the hypotenuse of it etc. but so far I haven't been really successful. Another question I'm wondering is if it's possible to calculate a hexagon the same way from a rectangle that has different values for width and height? Some help would be very appreciated! Thanks a lot! 
March 9th, 2009, 09:14 AM  #2 
Senior Member Joined: Feb 2009 From: Adelaide, Australia Posts: 1,519 Thanks: 3  Re: Calculating the side length of a hexagon from a rect.w/h?
The regular hexagon is just six equilateral triangles glued together. In that diagram, the height is one side times root 3, and the width is twice one side. So if you put a regular hexagon in a rectangle, each side of the hexagon will be equal to the shorter side of the rectangle divided by root 3. Two of the hexagon's sides will be flat against, or parallel to, the longer sides of the rectangle. If you want the largest possible regular hexagon that will fit into the rectangle, the solution is the same unless the rectangle is almost a square. In that case, the hexagon has to be slightly squint. That's an interesting problem itself. 
March 11th, 2009, 05:19 AM  #3 
Newbie Joined: Mar 2009 Posts: 2 Thanks: 0  Re: Calculating the side length of a hexagon from a rect.w/h?
Thanks a lot aswoods! I think I figured it out. Probably different than your explanation but it works. I've calculated the triangle (that is one corner of the 'square' the hexagon fits in) from a specified height. The width then results automatically from it (do not wonder! i write this in ActionScript3, hence the Math functions etc.)... Code: // angle in Radians angle = 30 * Math.PI / 180 height = 42 oppositeLeg = height / 2 adjacentLeg = Math.round(oppositeLeg * Math.tan(angle)); hypotenuse = Math.round(Math.sqrt(Math.pow(oppositeLeg , 2) + Math.pow(adjacentLeg , 2))); width = (a * 2) + h; 

Tags 
calculating, hexagon, length, rectw or h, side 
Thread Tools  
Display Modes  

Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Finding Side length of Rhombus inside Isosceles Triangle.  Spaghett  Algebra  8  June 24th, 2011 07:52 PM 
Calculating this integral and getting the length  Riazy  Calculus  5  March 10th, 2011 09:08 AM 
Trigonometry, finding angle when only one side length known  lesterxburnham  Algebra  5  June 15th, 2010 09:31 AM 
Calculating Arc Length  mollymcf2009  Calculus  1  February 27th, 2009 06:29 PM 
Calculate the length of the side of an irregular tetragon.  Mr Spot  Algebra  15  November 20th, 2008 05:56 PM 