Documentation
¶
Overview ¶
Package resample has a couple functions for resampling line geometry into more or less evenly spaces points.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Resample ¶
func Resample(ls orb.LineString, df orb.DistanceFunc, totalPoints int) orb.LineString
Resample converts the line string into totalPoints-1 evenly spaced segments. This function will modify the linestring input.
Example ¶
package main import ( "fmt" "github.com/TucarApp/orb" "github.com/TucarApp/orb/planar" "github.com/TucarApp/orb/resample" ) func main() { ls := orb.LineString{ {0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {6, 0}, {7, 0}, {8, 0}, {9, 0}, {10, 0}, } // downsample in this case so there are 2.5 units between points ls = resample.ToInterval(ls, planar.Distance, 2.5) fmt.Println(ls) }
Output: [[0 0] [2.5 0] [5 0] [7.5 0] [10 0]]
func ToInterval ¶
func ToInterval(ls orb.LineString, df orb.DistanceFunc, dist float64) orb.LineString
ToInterval coverts the line string into evenly spaced points of about the given distance. This function will modify the linestring input.
Example ¶
package main import ( "fmt" "github.com/TucarApp/orb" "github.com/TucarApp/orb/planar" "github.com/TucarApp/orb/resample" ) func main() { ls := orb.LineString{{0, 0}, {10, 0}} // upsample so there are 6 total points ls = resample.Resample(ls, planar.Distance, 6) fmt.Println(ls) }
Output: [[0 0] [2 0] [4 0] [6 0] [8 0] [10 0]]
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.