vmesh

package
v0.0.0-...-ce97658 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	VertexOutOfBounds = -2
	VertexSink        = -1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge

type Edge struct {
	IdxA  int
	IdxB  int
	Left  *voronoi.Cell
	Right *voronoi.Cell
}

type Extent

type Extent struct {
	Width  float64
	Height float64
}

func (*Extent) BBox

func (e *Extent) BBox() voronoi.BBox

type Heightmap

type Heightmap struct {
	*Mesh
	Values []float64 // elevation data

}

func NewHeightmap

func NewHeightmap(m *Mesh) *Heightmap

func (*Heightmap) Add

func (h *Heightmap) Add(hms ...*Heightmap)

func (*Heightmap) Diff

func (h *Heightmap) Diff(hms *Heightmap) *Heightmap

func (*Heightmap) Downhill

func (h *Heightmap) Downhill() []int

func (*Heightmap) ExportOBJ

func (h *Heightmap) ExportOBJ(path string) error

ExportOBJ returns a Wavefront OBJ file representing the heightmap.

func (*Heightmap) Len

func (h *Heightmap) Len() int

func (*Heightmap) MapF

func (h *Heightmap) MapF(f func(float64) float64) *Heightmap

func (*Heightmap) MapFIdx

func (h *Heightmap) MapFIdx(f func(val float64) float64) *Heightmap

func (*Heightmap) MinMax

func (h *Heightmap) MinMax() (min, max float64)

func (*Heightmap) TriSlope

func (h *Heightmap) TriSlope(i int) [2]float64

type Mesh

type Mesh struct {
	Points      []voronoi.Vertex        // Points used to generate the voronoi diagram
	Voronoi     *voronoi.Diagram        // Voronoi diagram
	Vertices    []voronoi.Vertex        // Vertex points sourrounding a cell
	AdjacentVxs map[int][]int           // Vertex index to adjacent vertices
	VertexTris  map[int][]*voronoi.Cell // Vertex index to bordering cells (triangles)
	Edges       []Edge                  // Edges in voronoi diagram
	Extent      *Extent
}

func GenerateGoodMesh

func GenerateGoodMesh(n int, extent *Extent) *Mesh

func MakeMesh

func MakeMesh(pts []voronoi.Vertex, extent *Extent) *Mesh

func (*Mesh) ApplyGen

func (m *Mesh) ApplyGen(f genheightmap.GenFunc) *Heightmap

func (*Mesh) Distance

func (m *Mesh) Distance(i, j int) float64

func (*Mesh) IsEdge

func (m *Mesh) IsEdge(i int) bool

func (*Mesh) IsNearEdge

func (m *Mesh) IsNearEdge(i int) bool

func (*Mesh) MapF

func (m *Mesh) MapF(f func(v voronoi.Vertex) float64) *Heightmap

func (*Mesh) Neighbours

func (m *Mesh) Neighbours(vxIdx int) []int

func (*Mesh) Triangulate

func (m *Mesh) Triangulate() (*delaunay.Triangulation, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL