lsurf.surfaces.CurvedWaveSurface
- class lsurf.surfaces.CurvedWaveSurface(wave_params, role, name='curved_wave', earth_center=(0, 0, -6371000.0), earth_radius=6371000.0, time=0.0, material_front=None, material_back=None)[source]
Ocean wave surface on a curved (spherical) Earth (CPU-only).
Combines Earth’s spherical curvature with Gerstner wave perturbations applied in local tangent space.
- Parameters:
wave_params (list of GerstnerWaveParams) – List of wave components.
role (SurfaceRole) – What happens when a ray hits (typically OPTICAL).
name (str) – Human-readable name.
earth_center (tuple of float, optional) – Center of Earth sphere. Default is (0, 0, -EARTH_RADIUS).
earth_radius (float, optional) – Earth radius in meters. Default is EARTH_RADIUS.
time (float, optional) – Time for wave animation in seconds. Default is 0.0.
material_front (MaterialField, optional) – Material above surface (atmosphere).
material_back (MaterialField, optional) – Material below surface (ocean water).
Examples
>>> from lsurf.surfaces import CurvedWaveSurface, GerstnerWaveParams, SurfaceRole >>> from lsurf.materials import ExponentialAtmosphere, WATER >>> >>> wave = GerstnerWaveParams(amplitude=1.0, wavelength=50.0) >>> ocean = CurvedWaveSurface( ... wave_params=[wave], ... role=SurfaceRole.OPTICAL, ... name="ocean", ... material_front=ExponentialAtmosphere(), ... material_back=WATER, ... )
- __init__(wave_params, role, name='curved_wave', earth_center=(0, 0, -6371000.0), earth_radius=6371000.0, time=0.0, material_front=None, material_back=None)
Methods
__init__(wave_params, role[, name, ...])default_kernel()Return the default intersection kernel for this surface type.
get_gpu_parameters()Return parameters for GPU kernel.
Return materials for Fresnel calculation.
Get maximum possible wave displacement.
intersect(origins, directions[, ...])Find ray-surface intersections using ray marching.
normal_at(positions[, incoming_directions])Compute surface normal at given positions.
set_time(time)Update the wave animation time.
signed_distance(positions)Compute signed distance from positions to surface.
supported_kernels()Return list of intersection kernels supported by this surface type.
Attributes
geometryuse geometry_id instead.
GPU geometry type ID (0 = CPU-only).
This surface does NOT support GPU acceleration.
kernel_idReturn the kernel ID configured for this surface instance.
- wave_params: list[GerstnerWaveParams]
- role: SurfaceRole
- intersect(origins, directions, min_distance=1e-06, max_iterations=200, tolerance=0.001, max_distance=None)[source]
Find ray-surface intersections using ray marching.
- Parameters:
origins (ndarray, shape (N, 3)) – Ray origin positions.
directions (ndarray, shape (N, 3)) – Ray direction unit vectors.
min_distance (float) – Minimum valid intersection distance.
max_iterations (int) – Maximum ray marching iterations.
tolerance (float) – Convergence tolerance in meters.
max_distance (float, optional) – Maximum search distance.
- Returns:
distances (ndarray, shape (N,)) – Distance to intersection (inf if no hit).
hit_mask (ndarray, shape (N,), dtype=bool) – True for rays that hit the surface.
- Return type:
tuple[ndarray[tuple[Any, …], dtype[float32]], ndarray[tuple[Any, …], dtype[bool]]]
- normal_at(positions, incoming_directions=None)[source]
Compute surface normal at given positions.
- Parameters:
positions (ndarray, shape (N, 3)) – Points on the surface.
incoming_directions (ndarray, shape (N, 3), optional) – Incoming ray directions.
- Returns:
normals – Unit normal vectors.
- Return type:
ndarray, shape (N, 3)
- __init__(wave_params, role, name='curved_wave', earth_center=(0, 0, -6371000.0), earth_radius=6371000.0, time=0.0, material_front=None, material_back=None)