Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultMinLoops = 100 DefaultMaxLoops = 4000 DefaultThresholdEpsilon = 0.0005 DefaultResampleInterval = 5.0 // meters )
Optimization Parameter defaults
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct { CorrectedGeometry []*geo.Path IntermediateGeometry [][]*geo.Path LoopsCompleted int LastLoopError float64 LastLoopScore float64 Runtime time.Duration }
Result is the structure containing the results of the sliding process. Geometries will be paths in lat/lng (EPSG:4326).
type Slide ¶
type Slide struct { Geometry []*geo.Path Surfacer Surfacer GeoReducer geo.GeoReducer MinLoops int // will run at least this many refinement steps MaxLoops int // limit on refinement steps Goroutines int // concurrency during refinement // ThresholdEpsilon is the stop condition used for improvement. // See the internal "score" function for more details. ThresholdEpsilon float64 // meters to resample the geometries into before sliding, // can impact performance. ResampleInterval float64 // weights for the different components of the cost function. GradientScale float64 DistanceScale float64 AngleScale float64 MomentumScale float64 // set to the default internal values of gradientContribution, distanceContribution and angleContribution // but if you want to get fancy, you can override them. GradientContributionFunc func(surfacer Surfacer, point *geo.Point, scale float64) *geo.Point DistanceContributionFunc func(path *geo.Path, index int, scale float64) *geo.Point AngleContributionFunc func(path *geo.Path, index int, scale float64) *geo.Point // Reduce the correction for paths that are in the valley of the surface. // The reduction is based on the original surface value. // This option can be helpful when sliding to good data, such as rasterized vector geometry. DepthBasedReduction bool // NumberIntermediateGeometries is the steps of the refinement processes to save. // This is for debugging or animation. NumberIntermediateGeometries int // contains filtered or unexported fields }
Slide is the struct that holds all the information to perform a slide.
type SuggestedOptions ¶
type SuggestedOptions struct { // weights for the different components of the cost function GradientScale float64 DistanceScale float64 AngleScale float64 MomentumScale float64 // reduce the correction based on surface depth DepthBasedReduction bool }
SuggestedOptions is returned by surfacers to allows them to tell the slide algorithm what the default options should be.
type Surfacer ¶
type Surfacer interface { // GradientAt and ValueAt should accept points in the EPSG:3857 (mercator) space. GradientAt(point *geo.Point) *geo.Point // typically derived from a smoothed surface ValueAt(point *geo.Point) float64 // typically the original surface value (pre smooth) // SuggestedOptions allows the surfacer to tell slide what the defaults should be. SuggestedOptions() *SuggestedOptions }
A Surfacer defines what a surface needs to do to be used for sliding. It should define a surface in the mercator projected space (EPSG:3857). Better values should be positive with a maximum of 1 meter, scaled up to be consistent with the EPSG:3857 scaling factor for that latitude.
Click to show internal directories.
Click to hide internal directories.