potree

package
v0.32.2 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2025 License: MIT Imports: 12 Imported by: 0

README

Potree V2 Format

Resources

Test data pulled from the example found here: https://potree.org/potree/examples/vr_heidentor.html

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadNode

func LoadNode(on *OctreeNode, metadata *Metadata, buf []byte) modeling.Mesh

func LoadNodeColorDataIntoArray added in v0.14.0

func LoadNodeColorDataIntoArray(m *Metadata, buf []byte, colors []vector3.Float64)

func LoadNodePositionDataIntoArray added in v0.14.0

func LoadNodePositionDataIntoArray(m *Metadata, buf []byte, positions []vector3.Float64)

func ParseEntireHierarchy

func ParseEntireHierarchy(root *OctreeNode, buf []byte) error

func ParseHierarchy

func ParseHierarchy(node *OctreeNode, buf []byte) error

Types

type Attribute

type Attribute struct {
	Name        string        `json:"name"`
	Description string        `json:"description"`
	Size        int           `json:"size"`
	NumElements int           `json:"numElements"`
	ElementSize int           `json:"elementSize"`
	Type        AttributeType `json:"type"`
	Min         []float64     `json:"min"`
	Max         []float64     `json:"max"`
	Scale       []float64     `json:"scale,omitempty"`
	Offset      []float64     `json:"offset,omitempty"`
}

func (Attribute) IsColor

func (a Attribute) IsColor() bool

func (Attribute) IsPosition

func (a Attribute) IsPosition() bool

type AttributeType added in v0.14.0

type AttributeType string
const (
	Int8AttributeType      AttributeType = "int8"
	Int16AttributeType     AttributeType = "int16"
	Int32AttributeType     AttributeType = "int32"
	Int64AttributeType     AttributeType = "int64"
	UInt8AttributeType     AttributeType = "uint8"
	UInt16AttributeType    AttributeType = "uint16"
	UInt32AttributeType    AttributeType = "uint32"
	UInt64AttributeType    AttributeType = "uint64"
	FloatAttributeType     AttributeType = "float"
	DoubleAttributeType    AttributeType = "double"
	UndefinedAttributeType AttributeType = "undefined"
)

func (AttributeType) Size added in v0.17.0

func (at AttributeType) Size() int

type HierarchyNodeEntry added in v0.14.0

type HierarchyNodeEntry struct {
	Type       uint8
	ChildMask  uint8
	NumPoints  uint32
	ByteOffset uint64
	ByteSize   uint64
}

type Metadata

type Metadata struct {
	Version     string            `json:"version"`
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Points      int64             `json:"points"`
	Projection  string            `json:"projection"`
	Hierarchy   MetadataHierarchy `json:"hierarchy"`
	Offset      []float64         `json:"offset"`
	Scale       []float64         `json:"scale"`
	Spacing     float64           `json:"spacing"`
	BoundingBox MetadataBounds    `json:"boundingBox"`
	Encoding    string            `json:"encoding"`
	Attributes  []Attribute       `json:"attributes"`
}

func LoadMetadata

func LoadMetadata(filepath string) (*Metadata, error)

func ReadMetadata

func ReadMetadata(in io.Reader) (*Metadata, error)

func (Metadata) Attribute added in v0.17.0

func (m Metadata) Attribute(attribute string) (*Attribute, int)

func (Metadata) AttributeOffset added in v0.14.0

func (m Metadata) AttributeOffset(attribute string) int

func (Metadata) BytesPerPoint

func (m Metadata) BytesPerPoint() int

func (Metadata) ColorAttributeOffset added in v0.17.0

func (m Metadata) ColorAttributeOffset() int

func (Metadata) LoadHierarchy

func (m Metadata) LoadHierarchy(filepath string) (*OctreeNode, error)

func (Metadata) OffsetF added in v0.14.0

func (m Metadata) OffsetF() vector3.Float64

func (Metadata) PositionAttributeOffset added in v0.17.0

func (m Metadata) PositionAttributeOffset() int

func (Metadata) ReadHierarchy

func (m Metadata) ReadHierarchy(in io.Reader) (*OctreeNode, error)

type MetadataBounds

type MetadataBounds struct {
	Min []float64 `json:"min"`
	Max []float64 `json:"max"`
}

func (MetadataBounds) MaxF

func (mb MetadataBounds) MaxF() vector3.Float64

func (MetadataBounds) MinF

func (mb MetadataBounds) MinF() vector3.Float64

type MetadataHierarchy

type MetadataHierarchy struct {
	FirstChunkSize uint64 `json:"firstChunkSize"`
	StepSize       int    `json:"stepSize"`
	Depth          int    `json:"depth"`
}

type OctreeNode

type OctreeNode struct {
	Name        string
	Spacing     float64
	Level       int
	BoundingBox geometry.AABB
	Parent      *OctreeNode `json:"-"`
	Children    []*OctreeNode

	NodeType   uint8
	ChildMask  uint8
	NumPoints  uint32
	ByteOffset uint64
	ByteSize   uint64

	HierarchyByteOffset uint64
	HierarchyByteSize   uint64
}

func (OctreeNode) DescendentCount

func (on OctreeNode) DescendentCount() int

func (OctreeNode) Height

func (on OctreeNode) Height() int

func (OctreeNode) MaxPointCount added in v0.14.0

func (on OctreeNode) MaxPointCount() int

func (OctreeNode) PointCount

func (on OctreeNode) PointCount() uint64

func (OctreeNode) Read added in v0.14.0

func (on OctreeNode) Read(in io.ReadSeeker, buf []byte) (int, error)

func (*OctreeNode) Walk

func (on *OctreeNode) Walk(f func(o *OctreeNode) bool)

func (OctreeNode) Write added in v0.14.0

func (on OctreeNode) Write(out io.WriteSeeker, buf []byte) (int, error)

Jump to

Keyboard shortcuts

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