convert_hex_coord#

sionna.sys.convert_hex_coord(coord: torch.Tensor, conversion_type: str, hex_radius: torch.Tensor | None = None, precision: Literal['single', 'double'] | None = None, device: str | None = None) torch.Tensor[source]#

Converts the center coordinates of a hexagon within a grid between any two of the types {“offset”, “axial”, “euclid”}.

Parameters:
  • coord (torch.Tensor) – Coordinates of the center of a hexagon contained in a hexagonal grid with shape […, 2]

  • conversion_type (str) – Type of coordinate conversion. One of ‘offset2euclid’, ‘euclid2offset’, ‘euclid2axial’, ‘offset2axial’, ‘axial2offset’, ‘axial2euclid’.

  • hex_radius (torch.Tensor | None) – Hexagon radius, i.e., distance between its center and any of its corners with shape […]. It must be specified if conversion_type is ‘offset2euclid’, ‘axial2euclid’, ‘euclid2offset’, or ‘euclid2axial’.

  • precision (Literal['single', 'double'] | None) – Precision used for internal calculations and outputs. If set to None, precision is used.

  • device (str | None) – Device for computation. If None, device is used.

Outputs:

coord_out – Output coordinates with shape […, 2]

Examples

import torch
from sionna.sys import convert_hex_coord

# Convert offset to Euclidean coordinates
offset_coord = torch.tensor([1, 2])
euclid = convert_hex_coord(offset_coord, 'offset2euclid', hex_radius=1.0)
print(euclid)
# tensor([1.5000, 4.3301])