AsteroidShapeModels.jl
AsteroidShapeModels.AsteroidShapeModels
— ModuleAsteroidShapeModels
A Julia package for geometric processing and analysis of asteroid shape models.
This package provides comprehensive tools for working with polyhedral shape models of asteroids, including loading from OBJ files, computing geometric properties, ray-shape intersection, visibility analysis, and surface roughness modeling.
Main Types
ShapeModel
: Core data structure for polyhedral shapesRay
: Ray for ray casting operationsFaceVisibilityGraph
: CSR-style data structure for face-to-face visibility
Key Functions
- Shape I/O:
load_shape_obj
,load_obj
,load_shape_grid
- Geometric properties:
face_center
,face_normal
,face_area
,polyhedron_volume
- Ray intersection:
intersect_ray_triangle
,intersect_ray_shape
- Visibility:
build_face_visibility_graph!
,isilluminated
,view_factor
- Shape analysis:
equivalent_radius
,maximum_radius
,minimum_radius
Example
using AsteroidShapeModels
# Load an asteroid shape model with face-face visibility
shape = load_shape_obj("path/to/shape.obj", scale=1000, with_face_visibility=true) # Convert km to m
# Access to face properties
shape.face_centers # Center position of each face
shape.face_normals # Normal vector of each face
shape.face_areas # Area of of each face
See the documentation for detailed usage examples and API reference.
Overview
AsteroidShapeModels.jl
provides comprehensive tools for working with polyhedral shape models of asteroids. The package supports:
- Loading shape models from OBJ files
- Computing geometric properties (area, volume, normals)
- Ray-shape intersection testing with optional BVH acceleration
- Face-to-face visibility analysis with BVH support
- Surface roughness modeling
- Illumination calculations
Installation
using Pkg
Pkg.add("AsteroidShapeModels")
Quick Start
using AsteroidShapeModels
using StaticArrays
# Load an asteroid shape model
# - `path/to/shape.obj` is the path to your OBJ file (mandatory)
# - `scale` : scale factor for the shape model (e.g., 1000 for km to m conversion)
# - `with_face_visibility` : whether to build face-to-face visibility graph for illumination checking and thermophysical modeling
# - `with_bvh` : whether to build BVH for ray tracing
shape = load_shape_obj("path/to/shape.obj"; scale=1000, with_face_visibility=true, with_bvh=true)
# Or you can build face-face visibility graph and/or BVH for an existing shape
# build_face_visibility_graph!(shape)
# build_bvh!(shape)
# NEW in v0.4.0: Unified illumination API
sun_position = SA[149597870700, 0.0, 0.0] # Sun 1 au away
illuminated = Vector{Bool}(undef, length(shape.faces))
update_illumination!(illuminated, shape, sun_position; with_self_shadowing=false)
# Access to face properties
shape.face_centers # Center position of each face
shape.face_normals # Normal vector of each face
shape.face_areas # Area of of each face
Features
Shape Model Management
- Load polyhedral models from OBJ files
- Automatic computation of face centers, normals, and areas
- Support for scaling and coordinate transformations
Geometric Analysis
- Face properties: center, normal, area
- Shape properties: volume, equivalent radius
- Bounding box computation
Ray Intersection
- Fast ray-triangle intersection using Möller–Trumbore algorithm
- Ray-shape intersection with optional BVH acceleration (~50x speedup)
- Bounding box culling for efficiency
Visibility Analysis
- Face-to-face visibility computation with optimized non-BVH algorithm
- View factor calculations for thermal modeling
- Illumination determination with configurable self-shadowing
- Batch illumination updates for all faces
- Binary asteroid mutual shadowing and eclipse detection
Surface Roughness
- Crater modeling
- Surface curvature analysis
Package Structure
types.jl
- Core data structures and type definitionsobj_io.jl
- OBJ file loading and parsingface_properties.jl
- Face geometric computations (center, normal, area)shape_operations.jl
- Shape-level operations (volume, radius calculations)ray_intersection.jl
- Ray casting and intersection algorithmsface_visibility_graph.jl
- Face-to-face visibility graph and view factor calculationsillumination.jl
- Illumination analysis and shadow testingeclipse_shadowing.jl
- Eclipse shadowing for binary asteroid systemsgeometry_utils.jl
- Geometric helper functions and angle calculationsroughness.jl
- Surface roughness and crater modeling
Index
AsteroidShapeModels.AsteroidShapeModels
AsteroidShapeModels.EclipseStatus
AsteroidShapeModels.FaceVisibilityGraph
AsteroidShapeModels.Ray
AsteroidShapeModels.RayShapeIntersectionResult
AsteroidShapeModels.RaySphereIntersectionResult
AsteroidShapeModels.RayTriangleIntersectionResult
AsteroidShapeModels.ShapeModel
AsteroidShapeModels.Sphere
AsteroidShapeModels.angle_deg
AsteroidShapeModels.angle_rad
AsteroidShapeModels.apply_eclipse_shadowing!
AsteroidShapeModels.build_bvh!
AsteroidShapeModels.build_face_visibility_graph!
AsteroidShapeModels.compute_face_max_elevations!
AsteroidShapeModels.concave_spherical_segment
AsteroidShapeModels.crater_curvature_radius
AsteroidShapeModels.equivalent_radius
AsteroidShapeModels.face_area
AsteroidShapeModels.face_center
AsteroidShapeModels.face_normal
AsteroidShapeModels.get_face_nodes
AsteroidShapeModels.get_view_factors
AsteroidShapeModels.get_visible_face_data
AsteroidShapeModels.get_visible_face_directions
AsteroidShapeModels.get_visible_face_distances
AsteroidShapeModels.get_visible_face_indices
AsteroidShapeModels.grid_to_faces
AsteroidShapeModels.intersect_ray_shape
AsteroidShapeModels.intersect_ray_sphere
AsteroidShapeModels.intersect_ray_triangle
AsteroidShapeModels.isilluminated
AsteroidShapeModels.isobj
AsteroidShapeModels.load_obj
AsteroidShapeModels.load_shape_grid
AsteroidShapeModels.load_shape_obj
AsteroidShapeModels.maximum_radius
AsteroidShapeModels.minimum_radius
AsteroidShapeModels.num_visible_faces
AsteroidShapeModels.polyhedron_volume
AsteroidShapeModels.solar_elongation_angle
AsteroidShapeModels.solar_phase_angle
AsteroidShapeModels.update_illumination!
AsteroidShapeModels.view_factor