Documentation
¶
Overview ¶
Package raster converts geometric shapes and map images into grid cost data.
Index ¶
- Variables
- func ApplyBorderPenalty(r domain.GridData, penaltyRadius int, floorThreshold Cost)
- func RasterLine(p0, p1 Vec2, width float64, cost Cost, scale float64, r domain.GridData)
- func RasterPNG(path string, pixelsPerCell float64, r domain.GridData) error
- func RasterPNG2(path string, pixelsPerCell float64, r domain.GridData, penaltyRadius int, ...) error
- func RasterPNG3(path string, pixelsPerCell float64, r domain.GridData, traversableCost Cost) error
- func RasterPNG3WithAura(path string, pixelsPerCell float64, r domain.GridData, traversableCost Cost, ...) error
- func RasterPNG3_v2(path string, pixelsPerCell float64, r domain.GridData, traversableCost Cost) error
- func RasterPNG3_v2WithAura(path string, pixelsPerCell float64, r domain.GridData, traversableCost Cost, ...) error
- func RasterPNG4(path string, pixelsPerCell float64, r domain.GridData, traversableCost Cost) error
- func RasterPNG4WithAura(path string, pixelsPerCell float64, r domain.GridData, traversableCost Cost, ...) error
- func RasterRectangle(pv0, pv1, pv2, pv3 Vec2, cost Cost, canvasScale float64, r domain.GridData)
- func RasterTriangle(t *Triangle, cost Cost, r domain.GridData)
- func ValidTriangle(polygon *orb.Polygon) bool
- type Cost
- type Triangle
- type Vec2
Constants ¶
This section is empty.
Variables ¶
var FromPoint = domain.FromPoint
FromPoint converts orb points to the raster vector type.
Functions ¶
func ApplyBorderPenalty ¶
ApplyBorderPenalty increases traversable cell costs near wall cells.
func RasterLine ¶
RasterLine draws a thick line by expanding it to a rectangle before rasterizing.
func RasterPNG ¶
RasterPNG rasterizes a PNG image onto a RegionGrid.
pixelsPerCell is the number of source-image pixels that correspond to one grid cell side. The function box-samples every pixel whose centre falls inside each cell's footprint and writes the normalised redness [0,255] into the matching cell.
Pixel (px, py) belongs to cell (cx, cy) when:
cx = floor(px / pixelsPerCell) cy = floor(py / pixelsPerCell)
Only cells that fall within both the image bounds and the grid bounds are written; out-of-range areas are silently skipped.
func RasterPNG2 ¶
func RasterPNG2(path string, pixelsPerCell float64, r domain.GridData, penaltyRadius int, floorThreshold Cost) error
RasterPNG2 rasterizes a PNG and applies a distance-based border penalty.
func RasterPNG3 ¶
RasterPNG3 rasterizes a generic image without wall aura.
func RasterPNG3WithAura ¶
func RasterPNG3WithAura(path string, pixelsPerCell float64, r domain.GridData, traversableCost Cost, auraRadius int) error
RasterPNG3WithAura is the generic-image version of the map rasterizer.
func RasterPNG3_v2 ¶
func RasterPNG3_v2(path string, pixelsPerCell float64, r domain.GridData, traversableCost Cost) error
RasterPNG3_v2 rasterizes a simple paletted image without wall aura.
func RasterPNG3_v2WithAura ¶
func RasterPNG3_v2WithAura(path string, pixelsPerCell float64, r domain.GridData, traversableCost Cost, auraRadius int) error
RasterPNG3_v2WithAura rasterizes a simple paletted image and applies wall aura.
func RasterPNG4 ¶
RasterPNG4 rasterizes a PNG using the production selector without wall aura.
func RasterPNG4WithAura ¶
func RasterPNG4WithAura(path string, pixelsPerCell float64, r domain.GridData, traversableCost Cost, auraRadius int) error
RasterPNG4WithAura is the production map-image rasterizer used by grid.FromImg. It selects the paletted fast path when possible and falls back to generic PNG handling.
func RasterRectangle ¶
RasterRectangle maps world-space rectangle corners to grid cells and draws them as two triangles.
func RasterTriangle ¶
RasterTriangle adds cost to every grid cell covered by the triangle using cell-center sampling and clipping to the target region bounds.
func ValidTriangle ¶
ValidTriangle accepts one closed ring with three non-collinear points.
Types ¶
type Triangle ¶
type Triangle struct {
A, B, C Vec2
}
Triangle is the raster primitive used after polygons or rectangles are split into three-point shapes.
func NewTriangle ¶
NewTriangle converts a valid three-point polygon into a raster triangle.