How about drawing a six-sided buffer around the midpoint of your
line with a radius equal to one-half its length? This works well
if you aren't fussy about the orientation of the hexagon:

dim x,y as float
dim r as float
dim objHexagon as object

'calculate midpoint:
x = (x1 + cell.lon) / 2
y = (y1 + cell.lat) / 2

'determine radius:
r = distance (x1, y1, Cell.lon, cell.lat, "km") / 2

'Create the hexagon:
objHexagon = Buffer (CreatePoint(x,y), 6, r, "km")

If you want to draw a tesselation of heaxagons, and don't mind
spending $25 (but the downloadable samples are free), take a look
at: http://www.ctmap.com/gisnet/catalog/sw/hexgrid.html 

- Bill Thoen

Xu Xiaoning wrote:
> 
> Hello,All:
> 
> How to draw a hexagon in MapInfo?
> 
> There are some words in VB and MapInfo ,such as,
> 
> mapinfo.do "Set Style Pen MakePen(1,60," & j & ")";
> mapinfo.do "update cell set Obj= CreateLine(x1,y1,cell.lon, cell.Lat) where rowid=" 
>& i;
> 
> Their function is to draw a line between two points.But what i really want to know 
>is how to
> draw a hexagon between two points.Who can teach me?
> 
> Thanks,
> 
>    Your sincerely,
> 
>             Xu Xiaoning
>             [EMAIL PROTECTED]
>             [EMAIL PROTECTED]
>             ICQ:46904055
> 
> ----------------------------------------------------------------------
> To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
> "unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to