GradeSegment

public struct GradeSegment : Sendable
extension GradeSegment: Equatable
extension GradeSegment: Hashable

A value describing a grade of a track. A TrackGraph has an array of GradeSegment from start to its distance each with a given length and the grade at this distance.

  • The start in meters of the segment.

    Declaration

    Swift

    public var start: Double
  • end

    The end in meters of the grade segment.

    Declaration

    Swift

    public var end: Double
  • The elevation in meters at the start of the segment. Defaults to zero.

    Declaration

    Swift

    public var elevationAtStart: Double
  • Declaration

    Swift

    public var elevationAtEnd: Double
  • Declaration

    Swift

    public init?(start: Double, end: Double, elevationAtStart: Double = 0, elevationAtEnd: Double = 0)
  • Declaration

    Swift

    public static func == (lhs: GradeSegment, rhs: GradeSegment) -> Bool
  • Declaration

    Swift

    struct InvalidGradeError : Error
  • Declaration

    Swift

    init?(start: Double, end: Double, grade: Double, elevationAtStart: Double = 0)
  • The normalized grade in percent in the range -1…1.

    Declaration

    Swift

    var grade: Double { get }
  • The length in meters of the segment.

    Declaration

    Swift

    var length: Double { get }
  • The elevation gain in meters of the segment.

    Declaration

    Swift

    var elevationGain: Double { get }
  • Declaration

    Swift

    mutating func adjust(grade: Double) throws
  • Declaration

    Swift

    func adjusted(grade: Double) -> `Self`?
  • Declaration

    Swift

    mutating func merge(_ other: `Self`)