geom

package
v0.0.0-...-c38c944 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LineSetType = iota
	TextType
	PointCloudType
	MeshType
	ImageType
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Geometry

type Geometry interface {
	Name() string
	SetName(name string)
	Valid() bool
	Type() GeometryType
	Dimension() int
}

Geometry is the base interface for any geometry object

type Geometry2D

type Geometry2D interface {
	Geometry
	Width() int
	Height() int
	MinBound() mgl32.Vec2
	MaxBound() mgl32.Vec2
}

type Geometry3D

type Geometry3D interface {
	Geometry

	// MinBound returns min bounds for geometry coordinates
	MinBound() mgl32.Vec3

	// MaxBound returns max bounds for geometry coordinates
	MaxBound() mgl32.Vec3

	// Center returns the center of the geometry coordinates
	Center() mgl32.Vec3

	// Translate translates the geometry by the given 3D vector
	Translate(t mgl32.Vec3)

	// Scale scales the geometry by the given 3D sx, sy, sz values
	Scale(s mgl32.Vec3)

	// Rotate rotates the geometry by the given quaternion
	Rotate(q mgl32.Quat)

	// SetVertices replaces all vertices
	SetVertices(vertices []mgl32.Vec3)

	// Vertices returns the raw vertices of the geometry (coordinates)
	Vertices() []mgl32.Vec3

	// Returns a specific vertex of the vertex list
	Vertex(idx int) mgl32.Vec3
}

type GeometryType

type GeometryType int

type Image

type Image interface {
	Geometry2D

	// RGBA converts the image to an RGBA image, return nil if image cannot be converted
	RGBA() *image.RGBA
}

func NewImage

func NewImage(name string, r io.Reader) Image

NewImage creates a new image based on the reader. Supported formats are JPG and PNG

type PointCloud

type PointCloud interface {
	Geometry3D
}

type Triangle

type Triangle [3]int

type TriangleMesh

type TriangleMesh interface {
	Geometry3D

	// Triangles returns the topology information
	Triangles() []Triangle

	// SetTriangles replaces all triangles
	SetTriangles(triangles []Triangle)
}

func NewTriangleMesh

func NewTriangleMesh(name string, vertices []mgl32.Vec3, triangles []Triangle) TriangleMesh

Jump to

Keyboard shortcuts

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