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.

get_materials()

Return materials for Fresnel calculation.

get_max_wave_height()

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

earth_center

earth_radius

geometry

use geometry_id instead.

geometry_id

GPU geometry type ID (0 = CPU-only).

gpu_capable

This surface does NOT support GPU acceleration.

kernel_id

Return the kernel ID configured for this surface instance.

material_back

material_front

name

time

wave_params

role

wave_params: list[GerstnerWaveParams]
role: SurfaceRole
name: str = 'curved_wave'
earth_center: tuple[float, float, float] = (0, 0, -6371000.0)
earth_radius: float = 6371000.0
time: float = 0.0
material_front: Any = None
material_back: Any = None
property gpu_capable: bool

This surface does NOT support GPU acceleration.

property geometry_id: int

GPU geometry type ID (0 = CPU-only).

get_materials()[source]

Return materials for Fresnel calculation.

get_max_wave_height()[source]

Get maximum possible wave displacement.

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)

set_time(time)[source]

Update the wave animation time.

__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)