Surface Roughness
Crater Modeling
AsteroidShapeModels.crater_curvature_radius
— Functioncrater_curvature_radius(r, h) -> R
Calculate the curvature radius of a concave spherical segment.
Arguments
r::Real
: Crater radius (same units as h)h::Real
: Crater depth (same units as r)
Returns
R::Real
: Curvature radius of the spherical segment
Notes
The curvature radius is calculated using the formula: R = (r² + h²) / 2h
This represents the radius of the sphere from which the crater segment is cut.
Example
# Small bowl-shaped crater: 100m radius, 10m deep
R = crater_curvature_radius(100.0, 10.0) # Returns 505.0 m
# Deeper crater (smaller curvature radius): 100m radius, 50m deep
R = crater_curvature_radius(100.0, 50.0) # Returns 125.0 m
See also: concave_spherical_segment
AsteroidShapeModels.concave_spherical_segment
— Functionconcave_spherical_segment(r, h, xc, yc, x, y) -> z
Calculate the z-coordinate (depth) of a concave spherical segment at a given (x,y) position.
Arguments
r::Real
: Crater radiush::Real
: Crater depth (maximum depth at center)xc::Real
: x-coordinate of crater centeryc::Real
: y-coordinate of crater centerx::Real
: x-coordinate where to calculate zy::Real
: y-coordinate where to calculate z
Returns
z::Real
: Depth below the surface (negative value inside, 0 outside crater)
Notes
- Returns 0 for points outside the crater radius
- The crater profile follows a spherical cap geometry
- All spatial parameters should use consistent units
Example
# Crater at origin with 10m radius and 2m depth
z_center = concave_spherical_segment(10.0, 2.0, 0.0, 0.0, 0.0, 0.0) # Returns -2.0
z_edge = concave_spherical_segment(10.0, 2.0, 0.0, 0.0, 10.0, 0.0) # Returns 0.0
z_mid = concave_spherical_segment(10.0, 2.0, 0.0, 0.0, 5.0, 0.0) # Returns ~-0.6
See also: crater_curvature_radius
concave_spherical_segment(r, h; Nx=2^5, Ny=2^5, xc=0.5, yc=0.5) -> xs, ys, zs
Generate a grid representation of a concave spherical segment (crater).
Arguments
r::Real
: Crater radius (in normalized units, typically 0-1)h::Real
: Crater depth (in same units as radius)
Keyword Arguments
Nx::Integer=32
: Number of grid points in x-direction (default: 2^5)Ny::Integer=32
: Number of grid points in y-direction (default: 2^5)xc::Real=0.5
: x-coordinate of crater center (normalized, 0-1)yc::Real=0.5
: y-coordinate of crater center (normalized, 0-1)
Returns
xs::LinRange
: x-coordinates of grid points (0 to 1)ys::LinRange
: y-coordinates of grid points (0 to 1)zs::Matrix
: z-coordinates (depths) at each grid point
Notes
- The grid spans a unit square [0,1] × [0,1]
- z-values are negative inside the crater, 0 outside
- Suitable for use with
load_shape_grid
to create crater shape models
Example
# Generate a crater covering 40% of the domain, 0.1 units deep
xs, ys, zs = concave_spherical_segment(0.4, 0.1; Nx=64, Ny=64)
# Convert to shape model
shape = load_shape_grid(xs, ys, zs)
# Off-center crater
xs, ys, zs = concave_spherical_segment(0.3, 0.05; xc=0.3, yc=0.7)
See also: load_shape_grid
, grid_to_faces