Class: Ephem::Segments::PositionGroup

Inherits:
SegmentGroup show all
Defined in:
lib/ephem/segments/position_group.rb

Overview

The position segments for one SPK center/target pair. Routes each query to the segment covering the requested time. Returned by SPK#[].

See Also:

Instance Attribute Summary

Attributes inherited from SegmentGroup

#segments

Instance Method Summary collapse

Methods inherited from SegmentGroup

#clear_data, #initialize, #to_s, wrap

Constructor Details

This class inherits a constructor from Ephem::Segments::SegmentGroup

Instance Method Details

#centerInteger

Returns the center body ID.

Returns:

  • (Integer)

    the center body ID



11
12
13
# File 'lib/ephem/segments/position_group.rb', line 11

def center
  @segments.first.center
end

#compute(tdb, tdb2 = 0.0) ⇒ Core::Vector+ Also known as: position_at

Position at the given time. See Segment#compute.

Parameters:

  • tdb (Numeric, Array<Numeric>)

    Time(s) in TDB Julian Date

  • tdb2 (Numeric) (defaults to: 0.0)

    Optional fractional part of TDB date

Returns:



25
26
27
28
29
# File 'lib/ephem/segments/position_group.rb', line 25

def compute(tdb, tdb2 = 0.0)
  query(tdb, tdb2) do |segment, time, fraction|
    segment.compute(time, fraction)
  end
end

#compute_and_differentiate(tdb, tdb2 = 0.0) ⇒ Core::State+ Also known as: state_at

Position and velocity at the given time. See Segment#compute_and_differentiate.

Parameters:

  • tdb (Numeric, Array<Numeric>)

    Time(s) in TDB Julian Date

  • tdb2 (Numeric) (defaults to: 0.0)

    Optional fractional part of TDB date

Returns:



38
39
40
41
42
# File 'lib/ephem/segments/position_group.rb', line 38

def compute_and_differentiate(tdb, tdb2 = 0.0)
  query(tdb, tdb2) do |segment, time, fraction|
    segment.compute_and_differentiate(time, fraction)
  end
end

#targetInteger

Returns the target body ID.

Returns:

  • (Integer)

    the target body ID



16
17
18
# File 'lib/ephem/segments/position_group.rb', line 16

def target
  @segments.first.target
end