Skip to content

taps.apps.configs.physics

PhysicsConfig

Bases: AppConfig

Physics application configuration.

Parameters:

  • name (Literal[str], default: 'physics' ) –

    Application name.

  • simulations (int) –

    Number of parallel simulations.

  • ball_diameter (float, default: 0.2 ) –

    Golf ball diameter in meters.

  • ball_mass (float, default: 0.05 ) –

    Golf ball mass in kilograms.

  • tick_rate (int, default: 240 ) –

    Simulation steps per seconds.

  • total_time (int, default: 10 ) –

    Simulation runtime in seconds.

  • real_time (bool, default: True ) –

    Simulate at real time.

  • seed (int | None, default: None ) –

    Random seed.

  • terrain_width (int, default: 20 ) –

    Terrain width/length in meters.

  • terrain_height (int, default: 3 ) –

    Terrain max height in meters.

  • terrain_resolution (int, default: 10 ) –

    Terrain vertices per meter.

  • terrain_scale (float, default: 10.0 ) –

    Noise map scale (how far away map is viewed from).

  • terrain_octaves (int, default: 3 ) –

    Detail level in noise map.

  • terrain_persistence (float, default: 0.2 ) –

    Octave contributions (amplitude).

  • terrain_lacunarity (float, default: 2.0 ) –

    Detail added/removed at each octave (frequency).

  • terrain_filter_size (int, default: 2 ) –

    Terrain smoothing filter size.

get_app

get_app() -> App

Create an application instance from the config.

Source code in taps/apps/configs/physics.py
def get_app(self) -> App:
    """Create an application instance from the config."""
    from taps.apps.physics import PhysicsApp
    from taps.apps.physics import SimulationConfig
    from taps.apps.physics import TerrainConfig

    terrain = TerrainConfig(
        width=self.terrain_width,
        height=self.terrain_height,
        resolution=self.terrain_resolution,
        scale=self.terrain_scale,
        octaves=self.terrain_octaves,
        persistence=self.terrain_persistence,
        lacunarity=self.terrain_lacunarity,
        filter_size=self.terrain_filter_size,
    )

    simulation = SimulationConfig(
        ball_diameter=self.ball_diameter,
        ball_mass=self.ball_mass,
        tick_rate=self.tick_rate,
        total_time=self.total_time,
        real_time=self.real_time,
    )

    return PhysicsApp(
        num_simulations=self.simulations,
        terrain=terrain,
        simulation=simulation,
        seed=self.seed,
    )