Visibility Analysis
Main Functions
AsteroidShapeModels.build_face_visibility_graph!
— Functionbuild_face_visibility_graph!(shape::ShapeModel)
Build face-to-face visibility graph for the shape model.
This function computes which faces are visible from each face and stores the results in a FaceVisibilityGraph
structure using CSR (Compressed Sparse Row) format.
Arguments
shape
: Shape model of an asteroid
Notes
- The visibility graph is stored in
shape.face_visibility_graph
- This is a computationally intensive operation, especially for large models
- The resulting graph contains view factors, distances, and direction vectors
AsteroidShapeModels.isilluminated
— Functionisilluminated(shape::ShapeModel, r☉::StaticVector{3}, i::Integer) -> Bool
Return if the i
-th face of the shape
model is illuminated by the direct sunlight or not
Arguments
shape
: Shape model of an asteroidr☉
: Sun's position in the asteroid-fixed frame, which doesn't have to be normalized.i
: Index of the face to be checked
AsteroidShapeModels.view_factor
— Functionview_factor(cᵢ, cⱼ, n̂ᵢ, n̂ⱼ, aⱼ) -> fᵢⱼ, dᵢⱼ, d̂ᵢⱼ
Calculate the view factor from face i to face j, assuming Lambertian emission.
Arguments
cᵢ::StaticVector{3}
: Center position of face icⱼ::StaticVector{3}
: Center position of face jn̂ᵢ::StaticVector{3}
: Unit normal vector of face in̂ⱼ::StaticVector{3}
: Unit normal vector of face jaⱼ::Real
: Area of face j
Returns
fᵢⱼ::Real
: View factor from face i to face jdᵢⱼ::Real
: Distance between face centersd̂ᵢⱼ::StaticVector{3}
: Unit direction vector from face i to face j
Notes
The view factor is calculated using the formula:
fᵢⱼ = (cosθᵢ * cosθⱼ) / (π * dᵢⱼ²) * aⱼ
where θᵢ and θⱼ are the angles between the line connecting the faces and the respective normal vectors.
The view factor is automatically zero when:
- Face i is facing away from face j (cosθᵢ ≤ 0)
- Face j is facing away from face i (cosθⱼ ≤ 0)
- Both conditions ensure that only mutually visible faces have non-zero view factors
Visual representation
(i) fᵢⱼ (j)
△ --> △
FaceVisibilityGraph Functions
AsteroidShapeModels.get_visible_face_indices
— Functionget_visible_face_indices(graph::FaceVisibilityGraph, face_id::Int) -> SubArray
Get indices of faces visible from the specified face.
AsteroidShapeModels.get_view_factors
— Functionget_view_factors(graph::FaceVisibilityGraph, face_id::Int) -> SubArray
Get view factors for the specified face.
AsteroidShapeModels.get_visible_face_distances
— Functionget_visible_face_distances(graph::FaceVisibilityGraph, face_id::Int) -> SubArray
Get distances to visible faces from the specified face.
AsteroidShapeModels.get_visible_face_directions
— Functionget_visible_face_directions(graph::FaceVisibilityGraph, face_id::Int) -> SubArray
Get direction vectors to visible faces from the specified face.
AsteroidShapeModels.get_visible_face_data
— Functionget_visible_face_data(graph::FaceVisibilityGraph, face_id::Int, idx::Int)
Get the idx-th visible face data for the specified face.
AsteroidShapeModels.num_visible_faces
— Functionnum_visible_faces(graph::FaceVisibilityGraph, face_id::Int) -> Int
Get the number of visible faces for the specified face.