geo

package module
v0.0.0-...-9d4f211 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2018 License: Apache-2.0 Imports: 11 Imported by: 21

README

geo

Latlongs, distance, Class B, etc

Documentation

Index

Constants

View Source
const (
	KFeetPerKM         = float64(3280.8399)
	KNauticalMilePerKM = float64(0.539957)
)
View Source
const EPSILON float64 = 0.0000001
View Source
const KLineSnapKM = 0.3 // How far a trackpoint can be from a line, and still be on that line

Variables

This section is empty.

Functions

func AsFlaggedTimeline

func AsFlaggedTimeline(boxes []LatlongTimeBox, start time.Time, flagIndex int) string

func AsTimeline

func AsTimeline(boxes []LatlongTimeBox, start time.Time) string

func CompareBoxSlices

func CompareBoxSlices(b1, b2 *[]LatlongTimeBox) (overlaps bool, conf float64, str string)

func CompareBoxSlicesNew

func CompareBoxSlicesNew(b1, b2 *[]LatlongTimeBox) (overlaps bool, conf float64, str string)

overlaps: if we should consider them the same thing conf: how confident we are str: some debug text about it.

func CompareBoxSlicesOld

func CompareBoxSlicesOld(b1, b2 *[]LatlongTimeBox) (overlaps bool, conf float64, str string)

overlaps: if we should consider them the same thing conf: how confident we are str: some debug text about it.

func HeadingDelta

func HeadingDelta(from, to float64) float64

func InterpolateHeading

func InterpolateHeading(from, to, ratio float64) float64

func LoggedCompare

func LoggedCompare(nFlips int, tA, tB *[]LatlongTimeBox, iA, iB int, prefix string) (space bool, deb string)

func NM2KM

func NM2KM(nm float64) float64

func NMph2mps

func NMph2mps(f float64) float64

NM per hour to meters per second

Types

type BoxResult

type BoxResult struct {
	NumTimeOverlaps      int   // How many boxes, from the other track, overlapped in time
	NumTimeSpaceOverlaps int   // How many boxes, from the other track, overlapped in time and space
	NumIgnores           int   // How many comparisons we ignored, because of sketchy interpolation
	TimeOverlapIndices   []int // Which boxes from the other track we have Time-only overlaps
}

type BoxSliceResult

type BoxSliceResult struct {
	B                        []BoxResult
	NumBoxes                 int
	NumBoxesJustTimeOverlap  int
	NumBoxesTimeSpaceOverlap int
	NumBoxesIgnored          int
	BadBoxIndices            []int   // For debugging; which boxes had just time overlap
	BadBoxOtherIndices       [][]int // And for each such box, which boxes in other track it messed
}

func NewResults

func NewResults(b *[]LatlongTimeBox) BoxSliceResult

func (*BoxSliceResult) Finalize

func (r *BoxSliceResult) Finalize()

func (BoxSliceResult) String

func (r BoxSliceResult) String() string

type ClassBMap

type ClassBMap struct {
	Sectors []ClassBSector // Must be ordered by asc StartBearing, and support wraparound
	Center  Latlong
	Name    string
}

func (ClassBMap) ClassBPointAnalysis

func (m ClassBMap) ClassBPointAnalysis(pos Latlong, speed float64, alt, tol float64, o *TPClassBAnalysis)

func (ClassBMap) ClassBRange

func (m ClassBMap) ClassBRange(pos Latlong) (floor, ceil float64, inRange bool)

ClassBRange works out if a position is within range of the given map; and if so, what the altitude limits are at that position.

func (ClassBMap) Walk

func (m ClassBMap) Walk(distNM, bearing float64) (floor, ceil int, inRange bool)

Walk treads a circle around the map until we find the sector that matches our bearing, and then walks out from the middle until we find the zone of the sector we lie within.

type ClassBSector

type ClassBSector struct {
	StartBearing int // Magnetic bearing (-13.68 to get to magnetic @ SFO)
	EndBearing   int
	Steps        []Cylinder // Ordered by asc DistanceNM
}

Each sector is a pie wedge, with consistent floor/ceil cylinders

type Cylinder

type Cylinder struct {
	EndDistanceNM int // Nautical Miles. Start distance is end of inner cylinder (or origin)
	Floor         int // In hundreds of feet
	Ceil          int // In hundreds of feet
}

type DebugLog

type DebugLog string

func (*DebugLog) Debugf

func (dl *DebugLog) Debugf(format string, args ...interface{})

func (*DebugLog) GetDebug

func (dl *DebugLog) GetDebug() string

type Debugger

type Debugger interface {
	Debugf(format string, args ...interface{})
	GetDebug() string // Will delete it.
}

Debugger lets things build debug logs

type Float64Range

type Float64Range struct {
	U, V float64
}

func (Float64Range) End

func (r Float64Range) End() float64

func (Float64Range) Start

func (r Float64Range) Start() float64

type Int64Range

type Int64Range struct {
	U, V int64
}

func (Int64Range) End

func (r Int64Range) End() float64

func (Int64Range) Start

func (r Int64Range) Start() float64

type Intersector

type Intersector interface {
	MapRenderer
	Debugger

	BoundingBox() LatlongBox // 2D bounding box for intersection
	CanContain() bool        // Will be false for window intersections
	Contains(Latlong) bool
	OverlapsLine(LatlongLine) OverlapOutcome
	OverlapsAltitude(int64) OverlapOutcome // DisjointR2ComesAfter == val was above the GR
}

type Latlong

type Latlong struct {
	Lat  float64
	Long float64
}

func FormValueLatlong

func FormValueLatlong(r *http.Request, stem string) Latlong

If fields absent or blank, returns {0.0, 0.0}

func LatlongFromPt

func LatlongFromPt(p *pmgeo.Point) Latlong

func NewLatlong

func NewLatlong(in string) Latlong

Recognizes some common formats:

[36.7415306, -121.8942333] - google maps style full decimals
[36°57'02.96"N, 121°57'09.62"W] - traditional degrees / minutes / seconds
[365702.96N / 1215709.62W] - FAA style concatenated ("DEG"+"MIN"+"SEC.00")
[37-10-35.680N / 122-00-29.950W] - from fltplan.com

returns a nil latlong upon parse failure

func (Latlong) BearingTowards

func (from Latlong) BearingTowards(to Latlong) float64

func (Latlong) Box

func (ll Latlong) Box(widthKm, heightKm float64) LatlongBox

Returns a box, centred on ll, that is of size (width,height)

func (Latlong) BoxTo

func (from Latlong) BoxTo(to Latlong) LatlongBox

func (Latlong) BuildLine

func (from Latlong) BuildLine(to Latlong) LatlongLine

func (Latlong) Circle

func (pos Latlong) Circle(radius float64) LatlongCircle

func (Latlong) Dist

func (from Latlong) Dist(to Latlong) float64

Dist is the great-circle distance, in KM

func (Latlong) Dist3

func (from Latlong) Dist3(to Latlong, altitude float64) float64

We have the two right angle sides of the triangle !

func (Latlong) DistKM

func (from Latlong) DistKM(to Latlong) float64

func (Latlong) DistNM

func (from Latlong) DistNM(to Latlong) float64

func (Latlong) Equal

func (from Latlong) Equal(to Latlong) bool

func (Latlong) ExactlyEqual

func (from Latlong) ExactlyEqual(to Latlong) bool

This probably isn't what you want

func (Latlong) InterpolateTo

func (from Latlong) InterpolateTo(to Latlong, ratio float64) Latlong

func (Latlong) IsNil

func (ll Latlong) IsNil() bool

Maybe it's safe to compare a nil-float64 directly to 0.0, and this is just a paranoid bodge.

func (Latlong) LatlongDist

func (from Latlong) LatlongDist(to Latlong) float64

ApproxDist treats the latlongs as y,x coords, and returns the 'latlong dist'

func (Latlong) LatlongDistSq

func (from Latlong) LatlongDistSq(to Latlong) float64

The square of the distance; useful for deciding closest approach

func (Latlong) LiesOn

func (pos Latlong) LiesOn(line LatlongLine) bool

func (Latlong) LineTo

func (from Latlong) LineTo(to Latlong) LatlongLine

func (Latlong) MapsUrl

func (at Latlong) MapsUrl() string

func (Latlong) MoveKM

func (from Latlong) MoveKM(heading, distanceKM float64) Latlong

func (Latlong) MoveNM

func (from Latlong) MoveNM(heading, distanceNM float64) Latlong

func (Latlong) Pt

func (ll Latlong) Pt() *pmgeo.Point

func (Latlong) String

func (ll Latlong) String() string

func (Latlong) ToCGIArgs

func (pos Latlong) ToCGIArgs(stem string) string

func (Latlong) Values

func (pos Latlong) Values() url.Values

type LatlongBox

type LatlongBox struct {
	SW, NE      Latlong
	Floor, Ceil int64 // altitude, feet; zero means "don't care". Nonzero means >= or <=, depending
}

func FormValueLatlongBox

func FormValueLatlongBox(r *http.Request, stem string) LatlongBox

If fields absent or blank, returns {0.0, 0.0} -> {0.0, 0.0}

func LatlongBoxFromBound

func LatlongBoxFromBound(b *pmgeo.Bound) LatlongBox

func (LatlongBox) BottomSide

func (box LatlongBox) BottomSide() LatlongLine

Derive bounded lines for the sides

func (LatlongBox) Center

func (box LatlongBox) Center() Latlong

func (LatlongBox) Contains

func (box LatlongBox) Contains(pos Latlong) bool

func (LatlongBox) ContainsPoint

func (box LatlongBox) ContainsPoint(pos Latlong) bool

Implement Region interface (defunct ?)

func (*LatlongBox) Enclose

func (box *LatlongBox) Enclose(pos Latlong)

Enclose increases the sixe of the box to include the point, if it doesn't fit

func (LatlongBox) IntersectsAltitude

func (box LatlongBox) IntersectsAltitude(alt int64) bool

func (LatlongBox) IntersectsBox

func (b1 LatlongBox) IntersectsBox(b2 LatlongBox) bool

func (LatlongBox) IntersectsLine

func (box LatlongBox) IntersectsLine(l LatlongLine) bool
func (box LatlongBox)IntersectsLine(l LatlongLine) bool {
	// Trivial bounding box test; discard if the line (as a box) has no overlap
	if !box.IntersectsBox(l.Box()) { return false }

	// If the box contains either point, we're good.
	if box.Contains(l.From) || box.Contains(l.To) { return true }

	// Else: we know the boxes overlap, but both line points are outside of it; so ensure
	// that the line has a (bounded) intersection with the box.
	if _,isect := box.BottomSide().Intersects(l); isect { return true }
	if _,isect := box.LeftSide().Intersects(l); isect { return true }
	if _,isect := box.RightSide().Intersects(l); isect { return true }
	if _,isect := box.TopSide().Intersects(l); isect { return true }

	return false
}

func (LatlongBox) IntersectsLineDeb

func (box LatlongBox) IntersectsLineDeb(l LatlongLine) (bool, string)

func (LatlongBox) IsNil

func (box LatlongBox) IsNil() bool

func (LatlongBox) LatHeight

func (box LatlongBox) LatHeight() float64

func (LatlongBox) LatRange

func (box LatlongBox) LatRange() Float64Range

func (LatlongBox) LeftSide

func (box LatlongBox) LeftSide() LatlongLine

func (LatlongBox) LongRange

func (box LatlongBox) LongRange() Float64Range

func (LatlongBox) LongWidth

func (box LatlongBox) LongWidth() float64

func (LatlongBox) LookForExit

func (box LatlongBox) LookForExit() bool

Implement the Restrictor interface

func (LatlongBox) NW

func (box LatlongBox) NW() Latlong

func (LatlongBox) OverlapsLine

func (box LatlongBox) OverlapsLine(l LatlongLine) OverlapOutcome

func (LatlongBox) OverlapsWith

func (b1 LatlongBox) OverlapsWith(b2 LatlongBox) (OverlapOutcome, float64)

Returned float *should* be the fraction of b1 that overlaps with b2

func (LatlongBox) RightSide

func (box LatlongBox) RightSide() LatlongLine

func (LatlongBox) SE

func (box LatlongBox) SE() Latlong

Derive the other two corners on demand

func (LatlongBox) String

func (box LatlongBox) String() string

func (LatlongBox) ToCGIArgs

func (box LatlongBox) ToCGIArgs(stem string) string

func (LatlongBox) ToCircles

func (c LatlongBox) ToCircles() []LatlongCircle

func (LatlongBox) ToLines

func (b LatlongBox) ToLines() []LatlongLine

Implement MapRenderer interface

func (LatlongBox) TopSide

func (box LatlongBox) TopSide() LatlongLine

type LatlongCircle

type LatlongCircle struct {
	Latlong
	RadiusKM float64 // In kilometers
}

func (LatlongCircle) ContainsPoint

func (c LatlongCircle) ContainsPoint(pos Latlong) bool

Implement Region interface (defunct ?)

func (LatlongCircle) IntersectsAltitude

func (c LatlongCircle) IntersectsAltitude(alt int64) bool

func (LatlongCircle) IntersectsBox

func (c LatlongCircle) IntersectsBox(b2 LatlongBox) bool

func (LatlongCircle) IntersectsLine

func (c LatlongCircle) IntersectsLine(l LatlongLine) bool

func (LatlongCircle) IntersectsLineDeb

func (c LatlongCircle) IntersectsLineDeb(l LatlongLine) (bool, string)

func (LatlongCircle) LookForExit

func (c LatlongCircle) LookForExit() bool

Implement GeoRestricter interface

func (LatlongCircle) String

func (c LatlongCircle) String() string

func (LatlongCircle) ToCircles

func (c LatlongCircle) ToCircles() []LatlongCircle

func (LatlongCircle) ToLines

func (c LatlongCircle) ToLines() []LatlongLine

Implement MapRenderer interface

type LatlongLine

type LatlongLine struct {
	From, To Latlong

	I, J int // index values for the two points used to build this line
	// contains filtered or unexported fields
}

Always using two anchor points, and then derive the equation of the line: y = m.x + b

func FormValueLatlongLine

func FormValueLatlongLine(r *http.Request, stem string) LatlongLine

If fields absent or blank, returns {0.0, 0.0} -> {0.0, 0.0}

func LatlongLineFromLn

func LatlongLineFromLn(ln pmgeo.Line) LatlongLine

func (LatlongLine) Bound

func (l LatlongLine) Bound() *pmgeo.Bound

func (LatlongLine) Box

func (l LatlongLine) Box() LatlongBox

func (LatlongLine) ClosestDistance

func (line LatlongLine) ClosestDistance(pos Latlong) float64

func (LatlongLine) ClosestTo

func (line LatlongLine) ClosestTo(pos Latlong) Latlong

Presumes infinite line

func (LatlongLine) DistAlongLine

func (line LatlongLine) DistAlongLine(pos Latlong) float64

If one unit is the dist between .From and .To, and .From is zero; how far along the line is pos?

func (LatlongLine) Intersects

func (l1 LatlongLine) Intersects(l2 LatlongLine) (Latlong, bool)

Returns point of intersection (may be invalid), and bool stating if intersection occurred

func (LatlongLine) IntersectsUnbounded

func (l1 LatlongLine) IntersectsUnbounded(l2 LatlongLine) (Latlong, bool)

Treats the lines as infinite. Returns whether there was an intersection.

func (LatlongLine) IsDegenerate

func (l LatlongLine) IsDegenerate() bool

func (LatlongLine) IsVertical

func (l LatlongLine) IsVertical() bool

func (LatlongLine) Ln

func (l LatlongLine) Ln() *pmgeo.Line

func (LatlongLine) PerpendicularTo

func (orig LatlongLine) PerpendicularTo(pos Latlong) LatlongLine

func (LatlongLine) String

func (line LatlongLine) String() string

func (LatlongLine) ToCGIArgs

func (ln LatlongLine) ToCGIArgs(stem string) string

func (LatlongLine) Values

func (ln LatlongLine) Values() url.Values

func (LatlongLine) WhichSide

func (l LatlongLine) WhichSide(p Latlong) int

-ve == left, +ve == right, 0 == lies-on-line

type LatlongSlice

type LatlongSlice []Latlong

type LatlongTimeBox

type LatlongTimeBox struct {
	LatlongBox   // embedded
	Start, End   time.Time
	HeadingDelta float64 // How much the heading altered during this box
	I, J         int     // range of indices of trackpoints that generated the box

	// These values are used to decide if a box is too approximate to be safe to compare
	Source               string  // too hard to backtrack when debugging, just say so here
	Interpolated         bool    // The box was interpolated, so might be pretty bogus
	RunLength            int     // how many boxes were in this run of interpolation
	CentroidHeadingDelta float64 // This is fiddly; see below
	Debug                string
}

It is a latlong box, with times; used to decide if tracks overlap

func (LatlongTimeBox) AltitudeSpeedHeadingSimilar

func (tb1 LatlongTimeBox) AltitudeSpeedHeadingSimilar(tb2 LatlongTimeBox) bool

func (*LatlongTimeBox) Enclose

func (tb *LatlongTimeBox) Enclose(p Latlong, t time.Time)

func (*LatlongTimeBox) EnsureMinSide

func (tbox *LatlongTimeBox) EnsureMinSide(min float64)

If the box is too narrow or too tall, fatten it out

func (LatlongTimeBox) SpaceCompare

func (tb1 LatlongTimeBox) SpaceCompare(tb2 LatlongTimeBox) bool

Do the boxes overlap in latlong space ?

func (LatlongTimeBox) String

func (tbox LatlongTimeBox) String() string

func (LatlongTimeBox) TooApproximateForComparison

func (b LatlongTimeBox) TooApproximateForComparison() bool

type MapRenderer

type MapRenderer interface {
	String() string
	ToLines() []LatlongLine
	ToCircles() []LatlongCircle
}

MapRenderer lets things output themselves as primitive shapes, to be rendered on a map

type NamedLatlong

type NamedLatlong struct {
	Name    string
	Latlong // embedded
}

NamedLatlong is a Latlong, that happens to have a name (typically a waypoint)

func FormValueNamedLatlong

func FormValueNamedLatlong(r *http.Request, names map[string]Latlong, stem string) NamedLatlong

func (NamedLatlong) IsNil

func (nl NamedLatlong) IsNil() bool

func (NamedLatlong) ShortString

func (nl NamedLatlong) ShortString() string

func (NamedLatlong) String

func (nl NamedLatlong) String() string

func (NamedLatlong) ToCGIArgs

func (nl NamedLatlong) ToCGIArgs(stem string) string

func (NamedLatlong) Values

func (nl NamedLatlong) Values() url.Values

you'll want widget.AddPrefixedValues(v, nl.Values(), "mystem")

type OverlapOutcome

type OverlapOutcome int
const (
	Undefined OverlapOutcome = iota
	// These two apply to linear (range) overlaps (including altitude), where we have an ordering
	DisjointR2ComesAfter
	DisjointR2ComesBefore
	OverlapR2StraddlesStart
	OverlapR2StraddlesEnd

	// These two apply to all kinds of overlaps
	OverlapR2IsContained
	OverlapR2Contains

	// This two apply to area overlaps, which don't have an ordering
	Disjoint
	OverlapStraddles
)

func RangeOverlap

func RangeOverlap(r1, r2 RangeInterface) OverlapOutcome

When they're identical, prefer r1 to contain r2

func (OverlapOutcome) IsContained

func (o OverlapOutcome) IsContained() bool

func (OverlapOutcome) IsDisjoint

func (o OverlapOutcome) IsDisjoint() bool

func (OverlapOutcome) String

func (o OverlapOutcome) String() string

type Polygon

type Polygon struct {
	*pmgeo.Path
	// contains filtered or unexported fields
}

func NewPolygon

func NewPolygon() *Polygon

func (*Polygon) AddPoint

func (poly *Polygon) AddPoint(ll Latlong)

Order matters.

func (*Polygon) ApproxRadiusKM

func (poly *Polygon) ApproxRadiusKM() float64

Average distance from centroid, in KM.

func (*Polygon) Centroid

func (poly *Polygon) Centroid() Latlong

func (*Polygon) Contains

func (p *Polygon) Contains(ll Latlong) bool

func (*Polygon) GetPoints

func (poly *Polygon) GetPoints() []Latlong

func (*Polygon) GetSides

func (poly *Polygon) GetSides() [][]Latlong

A slice of sides, in clockwise order, where each side is represented as a slice of two points {Start, End}

func (*Polygon) IntersectsLine

func (poly *Polygon) IntersectsLine(l LatlongLine) ([]Latlong, bool)

Note; when a line intersects a vertex, it may be found to intersect lines on both sides, and so may contribute that vertex point more than once. So we dedupe.

func (*Polygon) OverlapsLine

func (poly *Polygon) OverlapsLine(l LatlongLine) OverlapOutcome

This is *so* similar to LatlongBox.OverlapsLine ...

func (*Polygon) String

func (poly *Polygon) String() string

func (*Polygon) ToCircles

func (poly *Polygon) ToCircles() []LatlongCircle

Implement MapRenderer

func (*Polygon) ToLines

func (poly *Polygon) ToLines() []LatlongLine

type PolygonRestriction

type PolygonRestriction struct {
	*Polygon
	SideKM                   float64
	AltitudeMin, AltitudeMax int64
	IsExcluding              bool
	Debugger                 // embed; populate with ptr rcvr e.g. pr.Debugger = new(geo.DebugLog)
}

PolygonRestricton fully implements geo.Restrictor

func (PolygonRestriction) BoundingBox

func (pr PolygonRestriction) BoundingBox() LatlongBox

func (PolygonRestriction) CanContain

func (pr PolygonRestriction) CanContain() bool

func (PolygonRestriction) IsExclusion

func (pr PolygonRestriction) IsExclusion() bool

func (PolygonRestriction) IsNil

func (pr PolygonRestriction) IsNil() bool

func (PolygonRestriction) OverlapsAltitude

func (pr PolygonRestriction) OverlapsAltitude(a int64) OverlapOutcome

func (pr PolygonRestriction)Contains(pos Latlong) bool { return pr.Polygon.Contains(pos) }

func (pr PolygonRestriction)OverlapsLine(ln LatlongLine) OverlapOutcome {
	return pr.Box(pr.SideKM,pr.SideKM).OverlapsLine(ln)
}

func (PolygonRestriction) String

func (pr PolygonRestriction) String() string

func (PolygonRestriction) ToCircles

func (pr PolygonRestriction) ToCircles() []LatlongCircle

func (PolygonRestriction) ToLines

func (pr PolygonRestriction) ToLines() []LatlongLine

type Procedure

type Procedure struct {
	Name      string
	Departure bool   // If false, is arrival
	Airport   string // Where we are arriving or departing from
	Waypoints []Waypoint
}

A Procedure is a set of waypoints, with altitude / speed guidance, for arrival/departure

func (Procedure) ComparisonLines

func (p Procedure) ComparisonLines() []LatlongLine

ComparisonLines returns the segments of the procedure that a track's boxes need to intersect and align with.

func (*Procedure) Populate

func (p *Procedure) Populate(fixes map[string]Latlong)

func (Procedure) String

func (p Procedure) String() string

type RangeInterface

type RangeInterface interface {
	Start() float64
	End() float64
}

type Restrictor

type Restrictor interface {
	Intersector
	IsExclusion() bool // I.e. the restriction means "do not intersect this thing"
	IsNil() bool
}

type SquareBoxRestriction

type SquareBoxRestriction struct {
	NamedLatlong             // embed
	SideKM                   float64
	AltitudeMin, AltitudeMax int64
	IsExcluding              bool
	Debugger                 // embed; populate with ptr rcvr e.g. sb.Debugger = new(geo.DebugLog)
}

SquareBoxRestricton fully implements geo.Restrictor

func (SquareBoxRestriction) BoundingBox

func (sb SquareBoxRestriction) BoundingBox() LatlongBox

func (SquareBoxRestriction) CanContain

func (sb SquareBoxRestriction) CanContain() bool

func (SquareBoxRestriction) Contains

func (sb SquareBoxRestriction) Contains(pos Latlong) bool

func (SquareBoxRestriction) IsExclusion

func (sb SquareBoxRestriction) IsExclusion() bool

func (SquareBoxRestriction) IsNil

func (sb SquareBoxRestriction) IsNil() bool

func (SquareBoxRestriction) OverlapsAltitude

func (sb SquareBoxRestriction) OverlapsAltitude(a int64) OverlapOutcome

func (SquareBoxRestriction) OverlapsLine

func (sb SquareBoxRestriction) OverlapsLine(ln LatlongLine) OverlapOutcome

func (SquareBoxRestriction) String

func (sb SquareBoxRestriction) String() string

func (SquareBoxRestriction) ToCircles

func (sb SquareBoxRestriction) ToCircles() []LatlongCircle

func (SquareBoxRestriction) ToLines

func (sb SquareBoxRestriction) ToLines() []LatlongLine

type TPClassBAnalysis

type TPClassBAnalysis struct {
	// The verdict
	WithinRange         bool    // If we're not within range, the rest has no meaning.
	VerticalDisposition int     // <0 below; =0 within; >0 above
	BelowBy             float64 // If below, by how many feet
	Reasoning           string  // Explanation of stuff

	// Handy data to have around later
	I                 int     // Index into the track for the point we've analyzed
	InchesHg          float64 // The pressure correction applied
	IndicatedAltitude float64 // The pressure corrected altitude
	Floor, Ceil       float64 // The Class B space the point was in (0 if not in space)
	DistNM            float64 // Seeing as we've calculated it :)

	AllowThisPoint bool // If true, this point is not a violation, regardless of data
}

The output after ClassB analysis of a single position+altitude

func (TPClassBAnalysis) IsViolation

func (a TPClassBAnalysis) IsViolation() bool

type TimeRange

type TimeRange struct {
	U, V time.Time
}

func (TimeRange) End

func (r TimeRange) End() float64

func (TimeRange) Start

func (r TimeRange) Start() float64

type VerticalPlaneRestriction

type VerticalPlaneRestriction struct {
	Start, End               NamedLatlong
	AltitudeMin, AltitudeMax int64
	IsExcluding              bool
	Debugger                 // embed; populate with ptr rcvr e.g. vp.Debugger = new(geo.DebugLog)
}

VerticalPlane fully implements geo.Restrictor

func (VerticalPlaneRestriction) BoundingBox

func (vp VerticalPlaneRestriction) BoundingBox() LatlongBox

func (VerticalPlaneRestriction) CanContain

func (vp VerticalPlaneRestriction) CanContain() bool

func (VerticalPlaneRestriction) Contains

func (vp VerticalPlaneRestriction) Contains(pos Latlong) bool

func (VerticalPlaneRestriction) IsExclusion

func (vp VerticalPlaneRestriction) IsExclusion() bool

func (VerticalPlaneRestriction) IsNil

func (vp VerticalPlaneRestriction) IsNil() bool

func (VerticalPlaneRestriction) OverlapsAltitude

func (vp VerticalPlaneRestriction) OverlapsAltitude(a int64) OverlapOutcome

func (VerticalPlaneRestriction) OverlapsLine

func (VerticalPlaneRestriction) String

func (vp VerticalPlaneRestriction) String() string

func (VerticalPlaneRestriction) ToCircles

func (vp VerticalPlaneRestriction) ToCircles() []LatlongCircle

func (VerticalPlaneRestriction) ToLines

func (vp VerticalPlaneRestriction) ToLines() []LatlongLine

type Waypoint

type Waypoint struct {
	FixName     string
	Latlong     // embed - this needs to be populated via a fix table !
	MinAltitude float64
	MaxAltitude float64
	MaxAirspeed float64

	ConsistentlyFlown bool // Can we assume that aircraft on this procedure will fly through here ?
}

type Window

type Window struct {
	LatlongLine // embedded
	MinAltitude float64
	MaxAltitude float64
}

Window is a finite line across the land, with altitude restrictions It implements GeoRestricter and MapRenderer.

func (Window) IntersectsAltitude

func (w Window) IntersectsAltitude(alt int64) bool

func (Window) IntersectsLine

func (w Window) IntersectsLine(l LatlongLine) bool

func (Window) IntersectsLineDeb

func (w Window) IntersectsLineDeb(l LatlongLine) (bool, string)

func (Window) LookForExit

func (w Window) LookForExit() bool

Implement GeoRestricter interface

func (Window) String

func (w Window) String() string

func (Window) ToCircles

func (w Window) ToCircles() []LatlongCircle

Implement MapRenderer interface

func (Window) ToLines

func (w Window) ToLines() []LatlongLine

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL