Documentation
¶
Index ¶
- Variables
- func Add2(a, b [2]float64) [2]float64
- func AddVecToLatLong(lat, lon float64, vec [2]float64) (float64, float64)
- func Angle2(a, b [2]float64) float64
- func CalcBearingRad(lat1, lon1, lat2, lon2 float64) float64
- func CalcHeightInTriangle(p1, p2, p3, p [2]float64, z1, z2, z3 float64) float64
- func CalcVecFromLatLong(lat1, lon1, lat2, lon2 float64) [2]float64
- func ConvToArray(in map[int]bool) []int
- func ConvToMap(in []int) map[int]bool
- func ConvToVec3(xyz []float64) vectors.Vec3
- func Cross2(a, b [2]float64) float64
- func CrossArc(lat1, lon1, lat2, lon2, lat3, lon3 float64) float64
- func DegToRad(deg float64) float64
- func Dist2(a, b [2]float64) float64
- func DistToSegment2(v, w, p [2]float64) float64
- func Dot2(a, b [2]float64) float64
- func GetCentroidOfTriangle(a, b, c []float64) vectors.Vec3
- func Haversine(lat1, lon1, lat2, lon2 float64) float64
- func HeronsTriArea(a, b, c float64) float64
- func InitFloatSlice(size int) []float64
- func InitRegionSlice(size int) []int
- func InitSlice[V utils.Number](size int) []V
- func InitTimeSlice(size int) []int64
- func IsInIntList(l []int, i int) bool
- func IsPointInTriangle(p1, p2, p3, p [2]float64) bool
- func KickOffChunkWorkers(totalItems int, fn func(start, end int))
- func LatLonFromVec3(position vectors.Vec3, sphereRadius float64) (float64, float64)
- func LatLonToCartesian(latDeg, lonDeg float64) []float64
- func Len2(a [2]float64) float64
- func MergeIndexSegments(segs [][2]int) [][]int
- func Normal2(v [2]float64) [2]float64
- func Normalize2(a [2]float64) [2]float64
- func RadToDeg(rad float64) float64
- func Read2FloatSlice(r io.Reader) ([][2]float64, error)
- func ReadFloatSlice(r io.Reader) ([]float64, error)
- func ReadIntSlice(r io.Reader) ([]int, error)
- func ReadMapIntBool(r io.Reader) (map[int]bool, error)
- func ReadMapIntFloat64(r io.Reader) (map[int]float64, error)
- func ReadMapIntInt(r io.Reader) (map[int]int, error)
- func Rotate2(v [2]float64, angle float64) [2]float64
- func RoundToDecimals(v, d float64) float64
- func Scale2(v [2]float64, s float64) [2]float64
- func SetMagnitude2(v [2]float64, mag float64) [2]float64
- func Sub2(a, b [2]float64) [2]float64
- func VectorToLatLong(vec [2]float64) (float64, float64)
- func Write2FloatSlice(w io.Writer, s [][2]float64) error
- func WriteFloatSlice(w io.Writer, s []float64) error
- func WriteIntSlice(w io.Writer, s []int) error
- func WriteMapIntBool(w io.Writer, m map[int]bool) error
- func WriteMapIntFloat64(w io.Writer, m map[int]float64) error
- func WriteMapIntInt(w io.Writer, m map[int]int) error
Constants ¶
This section is empty.
Variables ¶
var Zero2 = [2]float64{0, 0}
Functions ¶
func AddVecToLatLong ¶
Adds a vector to a latitude and longitude in degrees. The vector's x coordinate is modified by the cosine of the latitude to account for the fact that the distance between degrees of longitude decreases as the latitude increases.
func CalcBearingRad ¶
calcBearing calculates the bearing between two lat/long pairs.
func CalcHeightInTriangle ¶
CalcHeightInTriangle calculates the height of a point in a triangle.
func CalcVecFromLatLong ¶
CalcVecFromLatLong calculates the vector between two lat/long pairs.
func ConvToArray ¶
ConvToArray converts a map of ints to bools into a slice of ints.
func ConvToVec3 ¶
ConvToVec3 converts a float slice containing 3 values into a vectors.Vec3.
func CrossArc ¶
CrossArc calculates the shortest distance between an arc (defined by p1 and p2) and a third point, p3. The input is expected in degrees. See: https://stackoverflow.com/questions/32771458/distance-from-lat-lng-point-to-minor-arc-segment
func DistToSegment2 ¶
DistToSegment2 returns the distance between a point p and a line segment defined by the points v and w.
func GetCentroidOfTriangle ¶
GetCentroidOfTriangle returns the centroid of a triangle defined by the xyz coordinates a, b, c as a vectors.Vec3.
func HeronsTriArea ¶
HeronsTriArea returns the area of a triangle given the three sides. See: https://www.mathopenref.com/heronsformula.html
func InitFloatSlice ¶
InitFloatSlice returns a slice of floats of the given size, initialized to -1.
func InitRegionSlice ¶
InitRegionSlice returns a slice of ints of the given size, initialized to -1.
func InitTimeSlice ¶
InitTimeSlice returns a slice of int64s of the given size, initialized to -1.
func IsInIntList ¶
IsInIntList returns true if the given int is in the given slice.
func IsPointInTriangle ¶
IsPointInTriangle returns true if the point (xp, yp) is inside the triangle or on the edge of the triangle.
func KickOffChunkWorkers ¶
func LatLonFromVec3 ¶
LatLonFromVec3 converts a vectors.Vec3 to latitude and longitude. See: https://rbrundritt.wordpress.com/2008/10/14/conversion-between-spherical-and-cartesian-coordinates-systems/
func LatLonToCartesian ¶
LatLonToCartesian converts latitude and longitude to x, y, z coordinates. See: https://rbrundritt.wordpress.com/2008/10/14/conversion-between-spherical-and-cartesian-coordinates-systems/
func MergeIndexSegments ¶
MergeIndexSegments matches up the ends of the segments (region pairs) and returns a slice containing all continuous, connected segments as sequence of connected regions.
func Normalize2 ¶
Normalize2 returns the normalized vector of the given vector.
func RoundToDecimals ¶
RoundToDecimals rounds the given float to the given number of decimals.
func SetMagnitude2 ¶
func VectorToLatLong ¶
I'm not sure if this is correct, but it seems to work.
Types ¶
This section is empty.