Geometry
Box, Structure, Material, and other geometry primitives API reference
Overview#
Geometry and material classes come from witwin.core but are re-exported through witwin.channel so you only need one import:
import witwin.channel as wc
wall = wc.Structure(
name="wall",
geometry=wc.Box(position=(0.0, 0.0, 1.5), size=(0.25, 4.0, 3.0), device="cuda"),
material=wc.Material(eps_r=4.0, sigma_e=0.0),
)Material#
Defines the electromagnetic properties of a surface.
wc.Material(eps_r=4.0, mu_r=1.0, sigma_e=0.01)| Parameter | Type | Default | Description |
|---|---|---|---|
eps_r | float | 1.0 | Relative permittivity |
mu_r | float | 1.0 | Relative permeability |
sigma_e | float | 0.0 | Electrical conductivity. Must be >= 0 |
name | str | None | None | Optional material name |
ITU Presets#
ITU standard material presets are installed automatically at import time. Use them as class attributes:
wc.Material.concrete
wc.Material.glass
wc.Material.wood
wc.Material.metalMethods#
material.evaluate_static() — Returns a StaticMaterialSample with eps_r, mu_r, sigma_e.
material.evaluate_at_frequency(frequency) — Returns a FrequencyMaterialSample with complex eps_r accounting for conductivity at the given frequency in Hz.
Structure#
Pairs a geometry with a material to create a physical object in the scene.
wc.Structure(
name="wall",
geometry=wc.Box(position=(0.0, 0.0, 1.5), size=(0.25, 4.0, 3.0), device="cuda"),
material=wc.Material(eps_r=4.0, sigma_e=0.0),
)| Parameter | Type | Default | Description |
|---|---|---|---|
geometry | GeometryBase | required | Any geometry primitive |
material | Material | required | Material defining EM properties |
name | str | None | None | Unique name required by Scene |
priority | int | 0 | Render priority for overlapping structures |
enabled | bool | True | Whether this structure is included in simulation |
tags | tuple[str] | () | Optional tags for grouping |
metadata | dict | None | None | Optional metadata |
Warning
Scene requires every Structure to have a unique non-empty name.
Box#
An axis-aligned rectangular box. The most common geometry for building indoor scenes.
wc.Box(
position=(0.0, 0.0, 1.5),
size=(0.25, 4.0, 3.0),
device="cuda",
)| Parameter | Type | Default | Description |
|---|---|---|---|
position | tuple[float, float, float] | (0, 0, 0) | Center position in world coordinates |
size | tuple[float, float, float] | (1, 1, 1) | Full extent along each axis |
rotation | tuple | None | None | Optional rotation |
device | str | None | None | PyTorch device string |
Other Geometry Primitives#
All primitives follow the same pattern: position, rotation, and device are shared base parameters. Each has a to_mesh() method that returns (vertices, faces).
Sphere#
wc.Sphere(position=(0, 0, 0), radius=1.0, device="cuda")Cylinder#
wc.Cylinder(position=(0, 0, 0), radius=1.0, height=2.0, axis="z", device="cuda")Cone#
wc.Cone(position=(0, 0, 0), radius=1.0, height=2.0, axis="z", device="cuda")Ellipsoid#
wc.Ellipsoid(position=(0, 0, 0), radii=(1.0, 0.5, 0.5), device="cuda")Pyramid#
wc.Pyramid(position=(0, 0, 0), base_size=1.0, height=2.0, axis="z", device="cuda")Prism#
wc.Prism(position=(0, 0, 0), radius=1.0, height=2.0, num_sides=6, axis="z", device="cuda")Torus#
wc.Torus(position=(0, 0, 0), major_radius=1.0, minor_radius=0.25, axis="z", device="cuda")HollowBox#
wc.HollowBox(position=(0, 0, 0), outer_size=(2, 2, 2), inner_size=(1.8, 1.8, 1.8), device="cuda")Mesh#
Load arbitrary triangle mesh geometry from vertex and face arrays:
wc.Mesh(vertices=verts, faces=faces, position=(0, 0, 0), device="cuda")