Unresolved Asteroid

template<IsSpectral TSpectral>
class UnresolvedAsteroid : public huira::UnresolvedObject<TSpectral>

Represents an unresolved asteroid with irradiance computed using the H-G magnitude system.

UnresolvedAsteroid models small solar system bodies (asteroids) whose apparent brightness is computed using the H-G photometric system, which accounts for the phase angle between the Sun, asteroid, and observer. The absolute magnitude (H) and slope parameter (G) characterize the asteroid’s intrinsic brightness and phase function.

The H-G system is defined against solar illumination, so a light instance (the sun) is required; other lights in the scene do not contribute.

Template Parameters:

TSpectral – The spectral representation type.

Public Functions

UnresolvedAsteroid(double H, double G, InstanceHandle<TSpectral> light_instance, TSpectral albedo = TSpectral{1.f})

Constructs an UnresolvedAsteroid with H-G magnitude parameters.

Initializes an asteroid object using the H-G photometric system. The constructor validates that the provided light instance actually contains a Light object.

Parameters:
  • H – Absolute magnitude (H) - the asteroid’s brightness at 1 AU from both the Sun and observer with zero phase angle.

  • G – Slope parameter (G) - controls the shape of the phase function, typically ranging from 0 to 1.

  • light_instanceHandle to the Instance containing the illuminating light source.

  • albedo – Spectral albedo of the asteroid (default: 1.0 for all wavelengths).

Throws:

std::runtime_error – if the light_instance does not contain a Light.

UnresolvedAsteroid(double H, double G, InstanceHandle<TSpectral> light_instance, float albedo)

Constructs an UnresolvedAsteroid with H-G magnitude parameters.

Initializes an asteroid object using the H-G photometric system. The constructor validates that the provided light instance actually contains a Light object.

Parameters:
  • H – Absolute magnitude (H) - the asteroid’s brightness at 1 AU from both the Sun and observer with zero phase angle.

  • G – Slope parameter (G) - controls the shape of the phase function, typically ranging from 0 to 1.

  • light_instanceHandle to the Instance containing the illuminating light source.

  • albedo – Constant spectral albedo of the asteroid.

Throws:

std::runtime_error – if the light_instance does not contain a Light.

virtual void resolve_irradiance(const std::vector<Transform<float>> &self_transforms, const std::vector<Time> &times, const SceneView<TSpectral> &scene_view, RandomSampler<float> &sampler) override

Resolves the spectral irradiance based on asteroid photometry.

Computes the asteroid’s apparent brightness using the H-G magnitude system, accounting for the distances to the Sun and observer, as well as the phase angle, at each temporal sample of the exposure. The irradiance is then set based on the computed apparent visual magnitude and the asteroid’s albedo.

Parameters:
  • self_transforms – Camera-relative transforms of the asteroid, one per temporal sample.

  • times – Absolute times of the temporal samples.

  • scene_view – The fully constructed scene view.

  • sampler – Random sampler (unused; the H-G model is analytic).

Throws:

std::runtime_error – if the asteroid’s light source is not found in the scene, or if geometry is invalid (zero distances).

inline virtual std::string type() const override

Get the object’s type string.

Returns:

std::string Type

void set_irradiance(const units::SpectralWattsPerMeterSquared<TSpectral> &spectral_irradiance)

Sets the spectral irradiance of the unresolved object.

Updates the object’s irradiance value as a single constant entry. All spectral components must be non-negative, as negative irradiance is physically meaningless.

Parameters:

spectral_irradiance – The new spectral irradiance value in \(W \cdot m^{-2}\).

Throws:

std::runtime_error – if any irradiance component is negative.

void set_irradiance(const units::WattsPerMeterSquared &irradiance)

Sets the total irradiance of the unresolved object.

Updates the object’s irradiance by converting a total irradiance value (in watts per square meter) to the spectral representation, stored as a single constant entry. The total irradiance must be non-negative, as negative values are physically meaningless.

Parameters:

irradiance – The new total irradiance value in \(W \cdot m^{-2}\).

Throws:

std::runtime_error – if the total irradiance is negative, NaN, or infinite.

virtual TSpectral get_irradiance(Time time) const

Returns the spectral irradiance at a given time.

If the object holds a single (constant) irradiance entry, it is returned directly. Otherwise, the per-temporal-sample entries are linearly interpolated over the time range cached by set_resolved_irradiance_(). Times outside the range are clamped to the endpoints.

Parameters:

time – The time at which to query irradiance.

Returns:

The spectral irradiance value at the requested time.

inline bool is_scene_owned() const

Check if the object is owned by the scene.

Returns:

bool True if owned

inline void set_scene_owned(bool owned)

Set scene ownership flag.

Parameters:

owned – True if owned

inline std::string name() const

Get the object’s name.

Returns:

std::string Name

inline virtual std::uint64_t id() const

Get the object’s unique ID.

Returns:

std::uint64_t ID

inline virtual std::string get_info() const

Get a descriptive info string for the object.

Returns:

std::string Info string

Protected Functions

void set_resolved_irradiance_(std::vector<TSpectral> irradiances, const std::vector<Time> &times)

Stores resolved per-temporal-sample irradiances and their time range.

Validates the irradiance values and caches the time range endpoints used by get_irradiance() for interpolation. irradiances must either contain a single (constant) entry, or exactly one entry per entry in times.

Parameters:
  • irradiances – Resolved spectral irradiances, one per temporal sample (or a single constant entry).

  • times – Absolute times of the temporal samples.

Throws:

std::runtime_error – if sizes are inconsistent or any value is invalid.

Protected Attributes

std::vector<TSpectral> irradiance_ = {TSpectral{0}}

Spectral irradiance per temporal sample (size 1 == constant).

double et_start_ = {0.0}

Ephemeris-time endpoints of the resolved sample range (used for interpolation).

double et_end_ = {0.0}