This scales the hexagon to have unit area.
   hexagonArea=: 3 : '3*y*(-:y)*%:3'  NB. Where y is side length
   sideOfUnitHexagon=: 0.6204032394013997
   hexagonArea sideOfUnitHexagon
1
   ]r=. sideOfUnitHexagon*-:%:3
0.537285
   'title Regular Hexagons Centered at Origin;type line;pensize 2; aspect
0.866' plot (],.{."1) (r,1)*"(0 1) (_1^1r3)^i.6

See
https://code.jsoftware.com/wiki/NYCJUG/2021-02-09#Corners_of_Unit_Hexagon_Centered_at_Origin
for a diagram illustrating why we use the square root of 3.

On Sun, Feb 7, 2021 at 4:00 PM Hauke Rehr <[email protected]> wrote:

> I wonder about that scaling factor in
>
>    */ , 5e_7 > | hexCorners - 0.537285 * +. (_1^1r3)^i.6
>
> Is there anything special about it?
>
>
> Am 07.02.21 um 21:28 schrieb Devon McCormick:
> > I'm trying to draw a unit hexagon centered at the origin with the
> > horizontal sides parallel to the X-axis.  I've come up with these
> > co-ordinates for the corners but when I plot them, the drawing looks a
> > little too wide:
> >
> >    hexCorners=. _2]\,0.537285 0 0.268642 0.465302 _0.268642 0.465302
> > _0.537285 0 _0.268642 _0.465302 0.268642 _0.465302
> >    'title Regular Unit Hexagon Centered at Origin;type line;pensize 2'
> plot
> > (],{.) j./"1 hexCorners
> >
> > I can use my paint program to distort a picture of this plot until it
> looks
> > like it has a square aspect ratio (roughly, width height * 0.92 1.06) but
> > how can I plot this with the correct aspect ratio in the first place?
> >
>
> --
> ----------------------
> mail written using NEO
> neo-layout.org
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

Quantitative Consultant
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to