hexagon_default_params: [!] Calculate parameters for (regular) hexagon

Description Usage Arguments Details Value Author(s) Examples

View source: R/hexagon_default_params.R

Description

Function calculates parameters l and r for hexagon.

Usage

1

Arguments

r

radius of circle inscribed in hexagon. Default value is 0.5.

l

distance from the center to the upper/lower vertices of hexagon.

x, y

numeric vectors with hexagon center coordinates in hexagon grid.

Details

Function assumes regular pointy topped hexagon. (More on geometry of hexagons can be found here). Relation between parameters l and r in this kind of hexagon:
l = r / cos(pi/6)
r = l * cos(pi/6)

These proportions can be distorted to mach grid of x and y values so that hexahons vere plotted without gaps.

Value

List with calculated values of parameters r and l.

Author(s)

Vilmantas Gegzna

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
hexagon_default_params()

hexagon_default_params(r = 1)

hexagon_default_params(l = 1)

data <- class::somgrid(8,6,"hexagonal")$pts
hexagon_default_params(x = data[,"x"], y = data[,"y"])

hexagon_default_params(x = data[,"x"], y = data[,"y"]*2)

hexagon_default_params(x = data[,"x"]*2, y = data[,"y"])

GegznaV/kohonen.hexagons documentation built on May 6, 2019, 5:36 p.m.