Documentation
¶
Index ¶
- Constants
- Variables
- func AdjacentFind(vi []Vertex, eq func(Vertex, Vertex) bool) (index int, found bool)
- func AverageNanArr(toAverage []float64) float64
- func CheckTriangleInTile(t Triangle, tileBounds BBox2d) bool
- func Circumcenter(a, b, c [2]float64) [2]float64
- func CompareLength2D(a1, a2, b1, b2 [2]float64) int
- func GenerateSampleTileBBox(zoom int) vec2d.Rect
- func GenerateTinMesh(raster *RasterDouble, maxError float64, config *GeoConfig) (*ZemlyaMesh, *Mesh)
- func InCircumcircle(a, b, c, d [2]float64) bool
- func InTriangle(a, b, c, p [2]float64) bool
- func IsCCW(a, b, c [2]float64) bool
- func IsFacingUpwards(t Triangle) bool
- func IsNaN(v interface{}) bool
- func Max(x, y float64) float64
- func Min(x, y float64) float64
- func MinInt(x, y int) int
- func Orientation(a, b, c [2]float64) float64
- func SafeGetPixel(src *RasterDouble, w, h, r, c int64) float64
- func SampleNearestValidAvg(src *RasterDouble, _row, _column int, minAveragingSamples int) float64
- func Splice(a, b *QuadEdge)
- func SubSampleRaster3x3(src *RasterDouble, noDataValue float64, w, h, r, c int64) float64
- func SwapTriangles(e *QuadEdge)
- func TriangleSemanticEqual(l, r Triangle) bool
- func VertexEqual(v, o Vertex) bool
- type BBox2d
- func (b *BBox2d) Add(p interface{})
- func (b BBox2d) Contains(point []float64, epsilon float64) bool
- func (b *BBox2d) Grow(delta float64)
- func (b BBox2d) Height() float64
- func (b BBox2d) Intersects(o BBox2d, epsilon float64) bool
- func (b BBox2d) IsOnBorder(point []float64, epsilon float64) bool
- func (b BBox2d) Width() float64
- type BBox3d
- func (b *BBox3d) Add(p interface{})
- func (b BBox3d) Contains(point []float64, epsilon float64) bool
- func (b BBox3d) Depth() float64
- func (b *BBox3d) Grow(delta float64)
- func (b BBox3d) Height() float64
- func (b *BBox3d) Max() [3]float64
- func (b *BBox3d) Min() [3]float64
- func (b *BBox3d) To2d() BBox2d
- func (b BBox3d) Width() float64
- type Candidate
- type CandidateList
- type Data
- type DefaultProgress
- type DelaunayMesh
- type DelaunayTriangle
- type DemProvider
- type Edge
- type Face
- type GeoConfig
- type Line
- type Mesh
- func (m *Mesh) AddTriangle(t Triangle, decompose bool)
- func (m *Mesh) CheckTin() bool
- func (m *Mesh) ClearDecomposed()
- func (m *Mesh) ClearTriangles()
- func (m *Mesh) ComposeTriangle(f Face) *Triangle
- func (m *Mesh) Count() int
- func (m *Mesh) Empty() bool
- func (m *Mesh) ExportOBJ(filename string, reproj bool) error
- func (m *Mesh) GenerateDecomposed()
- func (m *Mesh) GenerateTriangles()
- func (m *Mesh) GetBbox() BBox3d
- func (m *Mesh) GrabDecomposed(vertices []Vertex, faces []Face) ([]Vertex, []Face)
- func (m *Mesh) GrabTriangles(into []Triangle) []Triangle
- func (m *Mesh) InitFromTriangles(triangles []Triangle)
- type Normal
- type OBJTileExporter
- type PQ
- type Plane
- type Pool
- type Progress
- type QuadEdge
- func (e *QuadEdge) Dest() [2]float64
- func (e *QuadEdge) DestNext() *QuadEdge
- func (e *QuadEdge) DestPrev() *QuadEdge
- func (e *QuadEdge) Init()
- func (e *QuadEdge) Init2(ed *QuadEdge)
- func (e *QuadEdge) LeftFace() *DelaunayTriangle
- func (e *QuadEdge) LeftNext() *QuadEdge
- func (e *QuadEdge) LeftPrev() *QuadEdge
- func (e *QuadEdge) Next() *QuadEdge
- func (e *QuadEdge) Orig() [2]float64
- func (e *QuadEdge) OrigNext() *QuadEdge
- func (e *QuadEdge) OrigPrev() *QuadEdge
- func (e *QuadEdge) Pool() *Pool
- func (e *QuadEdge) RecycleNext()
- func (e *QuadEdge) RightNext() *QuadEdge
- func (e *QuadEdge) RightPrev() *QuadEdge
- func (e *QuadEdge) Rot() *QuadEdge
- func (e *QuadEdge) SetDest(d [2]float64)
- func (e *QuadEdge) SetEndPoints(org [2]float64, dest [2]float64)
- func (e *QuadEdge) SetLeftFace(f *DelaunayTriangle)
- func (e *QuadEdge) SetOrig(d [2]float64)
- func (e *QuadEdge) Sym() *QuadEdge
- func (e *QuadEdge) Tor() *QuadEdge
- type Raster
- func (r *Raster) CellSize() float64
- func (r *Raster) ColLeftToX(col int) float64
- func (r *Raster) ColToX(col int) float64
- func (r *Raster) Cols() int
- func (r *Raster) Count() int
- func (r *Raster) East() float64
- func (r *Raster) GetRow(row int) interface{}
- func (r *Raster) North() float64
- func (r *Raster) RowBottomToY(rowFromBottom int) float64
- func (r *Raster) RowToY(row int) float64
- func (r *Raster) Rows() int
- func (r *Raster) SetTransform(trans func(*Vertex) Vertex)
- func (r *Raster) SetValue(row, column int, data interface{})
- func (r *Raster) SetXYPos(x, y, res float64)
- func (r *Raster) South() float64
- func (r *Raster) ToVertices(receiverFn VertexReceiverFn)
- func (r *Raster) Value(row, column int) interface{}
- func (r *Raster) West() float64
- func (r *Raster) XToCol(x float64) int
- func (r *Raster) YToRow(y float64) int
- type RasterAdapter
- type RasterChar
- type RasterDouble
- type RasterInt
- type RasterMesh
- type RasterType
- type TileExporter
- type TileMaker
- type TinTiler
- type TinTilerConfig
- type Triangle
- type Vertex
- type VertexIndex
- type VertexReceiverFn
- type ZemlyaMesh
Constants ¶
View Source
const ( RASTER_DATA_TYPE_INT8 = 0 RASTER_DATA_TYPE_UINT8 = 1 RASTER_DATA_TYPE_INT16 = 2 RASTER_DATA_TYPE_UINT16 = 3 RASTER_DATA_TYPE_INT32 = 4 RASTER_DATA_TYPE_UINT32 = 5 RASTER_DATA_TYPE_INT64 = 6 RASTER_DATA_TYPE_UINT64 = 7 RASTER_DATA_TYPE_FLOAT32 = 8 RASTER_DATA_TYPE_FLOAT64 = 9 )
View Source
const (
EPS = float64(0.000000001)
)
View Source
const (
MAX_AVERAGING_SAMPLES = 64
)
View Source
const (
Nil = 0xFFFFFFFF
)
Variables ¶
View Source
var ( EPSG4326 = geo.NewProj(4326) EPSG3857 = geo.NewProj(3857) )
View Source
var (
NAN_DATA = Data{/* contains filtered or unexported fields */}
)
Functions ¶
func AdjacentFind ¶
优化 adjacentFind 函数
func AverageNanArr ¶
func CheckTriangleInTile ¶
func Circumcenter ¶
func CompareLength2D ¶
func GenerateTinMesh ¶
func GenerateTinMesh(raster *RasterDouble, maxError float64, config *GeoConfig) (*ZemlyaMesh, *Mesh)
func InCircumcircle ¶
func InTriangle ¶
func IsFacingUpwards ¶
func Orientation ¶
func SafeGetPixel ¶
func SafeGetPixel(src *RasterDouble, w, h, r, c int64) float64
func SampleNearestValidAvg ¶
func SampleNearestValidAvg(src *RasterDouble, _row, _column int, minAveragingSamples int) float64
func SubSampleRaster3x3 ¶
func SubSampleRaster3x3(src *RasterDouble, noDataValue float64, w, h, r, c int64) float64
func TriangleSemanticEqual ¶
func VertexEqual ¶
Types ¶
type BBox2d ¶
type BBox2d [4]float64
type Candidate ¶
type CandidateList ¶
type CandidateList struct {
Candidates PQ
}
func (*CandidateList) Empty ¶
func (cl *CandidateList) Empty() bool
func (*CandidateList) GrabGreatest ¶
func (cl *CandidateList) GrabGreatest() *Candidate
func (*CandidateList) Push ¶
func (cl *CandidateList) Push(candidate *Candidate)
func (*CandidateList) Size ¶
func (cl *CandidateList) Size() int
type DefaultProgress ¶
type DefaultProgress struct {
// contains filtered or unexported fields
}
DefaultProgress 默认进度跟踪器实现
func (*DefaultProgress) Complete ¶
func (p *DefaultProgress) Complete()
func (*DefaultProgress) Init ¶
func (p *DefaultProgress) Init(total int)
func (*DefaultProgress) Log ¶
func (p *DefaultProgress) Log(format string, args ...interface{})
func (*DefaultProgress) Update ¶
func (p *DefaultProgress) Update(current, total int)
func (*DefaultProgress) Warn ¶
func (p *DefaultProgress) Warn(format string, args ...interface{})
type DelaunayMesh ¶
type DelaunayMesh struct {
QuadEdges *Pool
Triangles *Pool
// contains filtered or unexported fields
}
func (*DelaunayMesh) InitMeshFromBBox ¶
func (m *DelaunayMesh) InitMeshFromBBox(bb BBox2d)
func (*DelaunayMesh) Insert ¶
func (m *DelaunayMesh) Insert(x [2]float64, tri *DelaunayTriangle)
type DelaunayTriangle ¶
type DelaunayTriangle struct {
Anchor *QuadEdge
Next *DelaunayTriangle
// contains filtered or unexported fields
}
func NewDelaunayTriangle ¶
func NewDelaunayTriangle(p *Pool) *DelaunayTriangle
func (*DelaunayTriangle) GetAnchor ¶
func (t *DelaunayTriangle) GetAnchor() *QuadEdge
func (*DelaunayTriangle) GetLink ¶
func (t *DelaunayTriangle) GetLink() *DelaunayTriangle
type DemProvider ¶
type DemProvider interface {
GetDEM(bbox vec2d.Rect, zoom int) (*RasterDouble, error)
Coverage() (geo.Coverage, error)
}
新增数据获取器接口
type Edge ¶
type Edge struct {
First VertexIndex
Second VertexIndex
}
func (*Edge) Assign ¶
func (e *Edge) Assign(a, b VertexIndex)
func (*Edge) SharesPoint ¶
type Face ¶
type Face [3]VertexIndex
type GeoConfig ¶
type GeoConfig struct {
SrcProj geo.Proj
Datum geoid.VerticalDatum
Offset float64
}
type Mesh ¶
type Mesh struct {
GeoRef *geo.GeoReference
Vertices []Vertex
Normals []Normal
Faces []Face
Triangles []Triangle
BBox [2][3]float64
}
func GenerateSampleMesh ¶
func (*Mesh) ClearDecomposed ¶
func (m *Mesh) ClearDecomposed()
func (*Mesh) ClearTriangles ¶
func (m *Mesh) ClearTriangles()
func (*Mesh) ComposeTriangle ¶
func (*Mesh) GenerateDecomposed ¶
func (m *Mesh) GenerateDecomposed()
func (*Mesh) GenerateTriangles ¶
func (m *Mesh) GenerateTriangles()
func (*Mesh) GrabDecomposed ¶
func (*Mesh) GrabTriangles ¶
func (*Mesh) InitFromTriangles ¶
type OBJTileExporter ¶
type OBJTileExporter struct{}
func (*OBJTileExporter) Extension ¶
func (s *OBJTileExporter) Extension() string
func (*OBJTileExporter) RelativeTilePath ¶
func (s *OBJTileExporter) RelativeTilePath(zoom, x, y int) string
type Progress ¶
type Progress interface {
Init(total int)
Update(current, total int) // 更新进度
Complete() // 标记任务完成
Log(format string, args ...interface{}) // 普通日志
Warn(format string, args ...interface{}) // 警告日志
}
Progress 接口定义进度跟踪行为
type QuadEdge ¶
type QuadEdge struct {
// contains filtered or unexported fields
}
func (*QuadEdge) LeftFace ¶
func (e *QuadEdge) LeftFace() *DelaunayTriangle
func (*QuadEdge) SetEndPoints ¶
func (*QuadEdge) SetLeftFace ¶
func (e *QuadEdge) SetLeftFace(f *DelaunayTriangle)
type Raster ¶
type Raster struct {
Size [2]int
Bounds [4]float64
NoData interface{}
Type int32
Data interface{}
Hemlines bool
// contains filtered or unexported fields
}
func NewRasterWithData ¶
func NewRasterWithNoData ¶
func (*Raster) ColLeftToX ¶
ColLeftToX converts column index to X coordinate
func (*Raster) RowBottomToY ¶
RowBottomToY converts row index from bottom to Y coordinate
func (*Raster) SetTransform ¶
func (*Raster) ToVertices ¶
func (r *Raster) ToVertices(receiverFn VertexReceiverFn)
type RasterAdapter ¶
type RasterAdapter struct {
// contains filtered or unexported fields
}
func NewRasterAdapter ¶
func NewRasterAdapter(tileGrid *geo.TileGrid, coverage geo.Coverage, origin *RasterDouble) *RasterAdapter
func (*RasterAdapter) GetDEM ¶
func (f *RasterAdapter) GetDEM(bbox vec2d.Rect, zoom int) (*RasterDouble, error)
type RasterChar ¶
type RasterChar struct {
Raster
}
func NewRasterChar ¶
func NewRasterChar(row, column int, noData int8) *RasterChar
func NewRasterCharWithData ¶
func NewRasterCharWithData(row, column int, data []int8) *RasterChar
func (*RasterChar) DataSlice ¶
func (r *RasterChar) DataSlice() []int8
func (*RasterChar) Fill ¶
func (r *RasterChar) Fill(data int8)
func (*RasterChar) GetRow ¶
func (r *RasterChar) GetRow(row int) []int8
func (*RasterChar) SetValue ¶
func (r *RasterChar) SetValue(row, column int, data int8)
func (*RasterChar) Value ¶
func (r *RasterChar) Value(row, column int) int8
type RasterDouble ¶
type RasterDouble struct {
Raster
}
func CreateSampleDEM ¶
func CreateSampleDEM(bbox vec2d.Rect, zoom int, maxElev float64) *RasterDouble
创建虚拟DEM
func NewRasterDouble ¶
func NewRasterDouble(row, column int, noData float64) *RasterDouble
func NewRasterDoubleWithData ¶
func NewRasterDoubleWithData(row, column int, data []float64) *RasterDouble
func (*RasterDouble) DataSlice ¶
func (r *RasterDouble) DataSlice() []float64
func (*RasterDouble) Fill ¶
func (r *RasterDouble) Fill(data float64)
func (*RasterDouble) GetRow ¶
func (r *RasterDouble) GetRow(row int) []float64
func (*RasterDouble) SetValue ¶
func (r *RasterDouble) SetValue(row, column int, data float64)
func (*RasterDouble) Value ¶
func (r *RasterDouble) Value(row, column int) float64
type RasterMesh ¶
type RasterMesh struct {
DelaunayMesh
Raster *RasterDouble
SrcProj geo.Proj // 原始坐标系
Datum geoid.VerticalDatum // 高程基准
Offset float64 // 高程偏移
}
func (*RasterMesh) ExportToPLY ¶
func (r *RasterMesh) ExportToPLY(w io.Writer) error
在RasterMesh结构体下方添加新方法
func (*RasterMesh) LoadRaster ¶
func (r *RasterMesh) LoadRaster(raster *RasterDouble)
type RasterType ¶
type RasterType int
type TileExporter ¶
type TileExporter interface {
SaveTile(mesh *Mesh, path string) error
Extension() string
RelativeTilePath(zoom, x, y int) string
}
var DefaultTileExporter TileExporter = &OBJTileExporter{}
type TileMaker ¶
type TileMaker struct {
// contains filtered or unexported fields
}
func NewTileMaker ¶
type TinTiler ¶
type TinTiler struct {
// contains filtered or unexported fields
}
func NewTinTiler ¶
func NewTinTiler(config *TinTilerConfig) *TinTiler
type TinTilerConfig ¶
type TinTilerConfig struct {
OutputDir string
TileGrid *geo.TileGrid
MinZoom int
MaxZoom int
SpecificZooms []int
Concurrency int
MaxError float64
Provider DemProvider // 替换原来的DEMLoader
Exporter TileExporter
Progress Progress
Coverage geo.Coverage
AutoZoom bool
Datum geoid.VerticalDatum
Offset float64
}
type Triangle ¶
type Triangle [3]Vertex
func Clip25DTriangleByLine ¶
lp - leftPoints
op - otherPoints
winding order counter-clockwise = inside
+
/|
/ |
/ |
/ |
/ |
/ |
/ |
/ |
/ |
/ |
l1 s0/ |s1 l0
x----*-----------*-------x
/ |
/ |
lp[0] + |
\ |
\ |
\ |
\ |
\ |
\ |
\ |
+ lp[1]
type VertexIndex ¶
type VertexIndex int
type VertexReceiverFn ¶
type VertexReceiverFn func(x, y float64, v interface{})
type ZemlyaMesh ¶
type ZemlyaMesh struct {
RasterMesh
Sample *RasterDouble
Insert *RasterDouble
Result *RasterDouble
Used *RasterChar
Token *RasterInt
Candidates CandidateList
MaxError float64
Counter int
CurrentLevel int
MaxLevel int
}
https://isprs-archives.copernicus.org/articles/XLI-B2/459/2016/isprs-archives-XLI-B2-459-2016.pdf
func NewZemlyaMesh ¶
func NewZemlyaMesh(config *GeoConfig) *ZemlyaMesh
func (*ZemlyaMesh) GreedyInsert ¶
func (z *ZemlyaMesh) GreedyInsert(maxError float64)
func (*ZemlyaMesh) LoadRaster ¶
func (z *ZemlyaMesh) LoadRaster(raster *RasterDouble) error
func (*ZemlyaMesh) ScanTriangle ¶
func (z *ZemlyaMesh) ScanTriangle(t *DelaunayTriangle)
func (*ZemlyaMesh) ToMesh ¶
func (z *ZemlyaMesh) ToMesh() *Mesh
Click to show internal directories.
Click to hide internal directories.