Skip to content

Create GPL altitude equation coefficients based on 4 point sets.

Notifications You must be signed in to change notification settings

rodneyramsay/4p

Folders and files

NameName
Last commit message
Last commit date
Mar 11, 2024
Feb 14, 2024
Feb 24, 2024
Feb 26, 2024
Feb 24, 2024
Mar 3, 2024
Feb 25, 2024
Feb 24, 2024
Feb 25, 2024
Feb 25, 2024
Feb 26, 2024
Feb 27, 2024
Feb 25, 2024
Feb 26, 2024
Feb 27, 2024
Feb 24, 2024

Repository files navigation

4p (Work in Progress!)

Create GPL track editing altitude trace equation coefficients. Each equation is defned by 4 point sets that make up the previous, current and next sections start and end points.

Import altitude data one column for each trace.

Input Format:

Section Name, Section Length, Trace 1 Altitude, Trace 2 Altitude, ...

Where Trace Altitude is the elevation (Y value) at the start of the section for each trace.

The 4p program also creates stitched gnuplot derived formulas for each trace and section of the track for visualizing equation curves.

Equations for solving functions.

f ( x ) = A x 3 + B x 2 + C x + D ; Equation for altitude or Y at any X location

f ( x ) = 3 A x 2 + 2 B x + C ; Equation derivitave for slope of altitudes

f ( 0 ) = Y 0 = D ; Altitude at the start of a section

f ( L ) = Y L = A L 3 + B L 2 + C L ; Altitude at the end of a section

f ( 0 ) = S 0 = C ; Slope at the start of a section

f ( L ) = S L = 3 A L 2 + 2 B L + S 0 ; Slope at the end of a section

Subtract 2 f ( L ) L f ( L ) to get A

A = 1 / L 3 [ L ( S 0 + S L ) + 2 ( Y 0 Y L ) ]

Solve for B in f ( x )

B = 1 / L 2 [ ( 2 S 0 S L ) 3 ( Y 0 Y L ) ]

Convert range from [0:L] to [0:1]

A [ 0 : 1 ] = L 3 A [ 0 : L ]

B [ 0 : 1 ] = L 2 B [ 0 : L ]

C [ 0 : 1 ] = L C [ 0 : L ]

D [ 0 : 1 ] = D [ 0 : L ]

============================================================================

A = L ( S 0 + S L ) + 2 ( Y 0 Y L )

B = ( 2 S 0 S L ) 3 ( Y 0 Y L )

C = L S 0

D = Y 0

About

Create GPL altitude equation coefficients based on 4 point sets.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published