Class: Astronoby::MeanOfDate

Inherits:
ReferenceFrame show all
Defined in:
lib/astronoby/reference_frames/mean_of_date.rb

Overview

Mean-of-date reference frame. Represents a body’s geocentric position corrected for precession only (no nutation or aberration).

Instance Attribute Summary

Attributes inherited from ReferenceFrame

#center, #instant, #position, #target_body, #velocity

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ReferenceFrame

#distance, #equatorial, #initialize, #separation_from

Constructor Details

This class inherits a constructor from Astronoby::ReferenceFrame

Class Method Details

.build_from_geometric(instant:, target_geometric:, earth_geometric:, target_body:) ⇒ Astronoby::MeanOfDate

Builds a mean-of-date frame from geometric frames by applying precession.

Parameters:

Returns:



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/astronoby/reference_frames/mean_of_date.rb', line 15

def self.build_from_geometric(
  instant:,
  target_geometric:,
  earth_geometric:,
  target_body:
)
  position = target_geometric.position - earth_geometric.position
  velocity = target_geometric.velocity - earth_geometric.velocity
  precession_matrix = Precession.matrix_for(instant)
  corrected_position = Distance.vector_from_m(
    precession_matrix * position.map(&:m)
  )
  corrected_velocity = Velocity.vector_from_mps(
    precession_matrix * velocity.map(&:mps)
  )

  new(
    position: corrected_position,
    velocity: corrected_velocity,
    instant: instant,
    center: Center.geocentric,
    target_body: target_body
  )
end

Instance Method Details

#eclipticAstronoby::Coordinates::Ecliptic

Returns ecliptic coordinates at the current instant (mean equinox of date).

Returns:



42
43
44
45
46
47
48
# File 'lib/astronoby/reference_frames/mean_of_date.rb', line 42

def ecliptic
  @ecliptic ||= begin
    return Coordinates::Ecliptic.zero if distance.zero?

    equatorial.to_ecliptic(instant: @instant)
  end
end