geometry

package module
v0.0.0-...-cdc907c Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddScalar

func AddScalar(a *mat64.Vector, scalar float64)

func Distance

func Distance(a, b *mat64.Vector) float64

Distance returns the Distance between two vectors

func DistanceSquared

func DistanceSquared(a, b *mat64.Vector) float64

DistanceSquared returns the squared distance of two given points

func Dot

func Dot(a, b *mat64.Vector) float64

Dot berechnet das Dot-Produkt aus a und b.

func Length

func Length(a *mat64.Vector) float64

Length berechnet die Länge eines Vectors

func MaxVec

func MaxVec(a, b *mat64.Vector) *mat64.Vector

MinVec returns a Vector with the minimal components of two vectors

func MinVec

func MinVec(a, b *mat64.Vector) *mat64.Vector

MinVec returns a Vector with the minimal components of two vectors

func MultiplyScalar

func MultiplyScalar(a *mat64.Vector, scalar float64)

func NewVector3

func NewVector3(x, y, z float64) *mat64.Vector

NewVector3 Creates a new mat64 Vector in 3d

func Normalize

func Normalize(a *mat64.Vector)

Normalize normiert einen Vektor auf die Länge 1

func VecToXYs

func VecToXYs(vectors []*mat64.Vector, xIndex, yIndex int) plotter.XYs

VecToXYs converts an array of mat64.Vector to plotter.XY, by giving x and y.

Types

type Box3

type Box3 struct {
	Min *mat64.Vector
	Max *mat64.Vector
}

Box3 describes a box in 3d by min and max vector

func NewBox3

func NewBox3(min, max *mat64.Vector) Box3

func (*Box3) ContainsPoint

func (b3 *Box3) ContainsPoint(point *mat64.Vector) bool

func (*Box3) Empty

func (b3 *Box3) Empty()

func (*Box3) ExpandByPoint

func (b3 *Box3) ExpandByPoint(vector *mat64.Vector)

func (*Box3) ExpandByScalar

func (b3 *Box3) ExpandByScalar(scalar float64)

func (*Box3) GetCenter

func (b3 *Box3) GetCenter() *mat64.Vector

func (*Box3) GetSize

func (b3 *Box3) GetSize() *mat64.Vector

func (*Box3) SetFromCenterAndSize

func (b3 *Box3) SetFromCenterAndSize(center, size *mat64.Vector)

func (*Box3) SetFromPoints

func (b3 *Box3) SetFromPoints(points []*mat64.Vector)

func (*Box3) Volume

func (b3 *Box3) Volume() float64

type CatmullRome3

type CatmullRome3 struct {
	// contains filtered or unexported fields
}

func NewCatmullRome3

func NewCatmullRome3(pc PointCloud) *CatmullRome3

func (*CatmullRome3) GetPoint

func (cr *CatmullRome3) GetPoint(t float64) *mat64.Vector

func (*CatmullRome3) IntersectPlane

func (cr *CatmullRome3) IntersectPlane(plane *Plane3) (*mat64.Vector, bool)

type CubicPoly

type CubicPoly struct {
	// contains filtered or unexported fields
}

func NewCubicPoly

func NewCubicPoly() *CubicPoly

type PassThroughFilter

type PassThroughFilter struct {
	LimitLow  float64
	LimitHigh float64
	Normal    *mat64.Vector
}

PassThroughFilter filters Pointclouds by upper and lower limit

func (*PassThroughFilter) Filter

func (ptf *PassThroughFilter) Filter(pc PointCloud) PointCloud

Filter returns a filtered PointCloud of a Input PoinCloud

func (*PassThroughFilter) SetCenterLimit

func (ptf *PassThroughFilter) SetCenterLimit(center, limit float64)

SetCenterLimit sets the lower and upper limits by center and +/- limit

func (*PassThroughFilter) SetFilterFieldName

func (ptf *PassThroughFilter) SetFilterFieldName(field string)

SetFilterFieldName sets the Normal Vector by axis-name

type Plane3

type Plane3 struct {
	Normal   *mat64.Vector
	Constant float64
}

Plane3 Struct

func NewPlane3

func NewPlane3(normal *mat64.Vector, constant float64) *Plane3

NewPlane3 creates a new Plane

func (*Plane3) DistanceToPoint

func (p *Plane3) DistanceToPoint(point *mat64.Vector) float64

DistanceToPoint calculates the Distance from the Plane to a given Point

func (*Plane3) ProjectPoint

func (p *Plane3) ProjectPoint(point *mat64.Vector) *mat64.Vector

ProjectPoint projects a point on the plane

func (*Plane3) Set

func (p *Plane3) Set(normal *mat64.Vector, constant float64)

Set Plane from Normal and Constant

func (*Plane3) SetComponents

func (p *Plane3) SetComponents(x, y, z, w float64)

SetComponents sets the Planes components

func (*Plane3) SetFromNormalAndCoplanarPoint

func (p *Plane3) SetFromNormalAndCoplanarPoint(normal *mat64.Vector, point *mat64.Vector)

SetFromNormalAndCoplanarPoint sets the Plane from normal vector and onepoint containted by the plane

type PointCloud

type PointCloud struct {
	Vectors []*mat64.Vector
	// contains filtered or unexported fields
}

PointCloud Represents an array of vectors

func (*PointCloud) Add

func (pC *PointCloud) Add(vec ...*mat64.Vector)

Add adds a Vector to Pointcloud

func (*PointCloud) FillRandom

func (pC *PointCloud) FillRandom(count int)

FillRandom fills pointcloud with random vectors

func (*PointCloud) FindNearestNeighbors

func (pC *PointCloud) FindNearestNeighbors(point *mat64.Vector, k int) PointCloud

FindNearestNeighbors finds the closest k-Points to a given point

func (*PointCloud) Length

func (pC *PointCloud) Length() int

Length returns the amount of vertices in PoinCloud

func (*PointCloud) ReadPCD

func (pC *PointCloud) ReadPCD(path string) error

ReadPCD reads in PCD data from Point Cloud Library

func (*PointCloud) SavePLY

func (pC *PointCloud) SavePLY(path string) error

SavePLY saves a Pointcloud to PLY file

func (*PointCloud) ShowInMeshlab

func (pC *PointCloud) ShowInMeshlab() error

ShowInMeshlab shows the Pointcloudobject in meshlab

func (*PointCloud) Transform

func (pC *PointCloud) Transform(transMat *TransMat)

Transform transforms pointcloud with transformation matrix

type Ray

type Ray struct {
	Origin    *mat64.Vector
	Direction *mat64.Vector
}

Ray represents the Ray object

func NewRayFromPoints

func NewRayFromPoints(a, b *mat64.Vector) Ray

NewRayFromPoints creates a Ray from two points

func (*Ray) DistanceToPoint

func (ray *Ray) DistanceToPoint(point *mat64.Vector) float64

DistanceToPoint calculates the shortest Distance from Ray to point

type Sphere3

type Sphere3 struct {
	Center *mat64.Vector
	Radius float64
}

Sphere3 describes a 3D sphere by center and radius

func (*Sphere3) SetFromPoints

func (sp *Sphere3) SetFromPoints(points []*mat64.Vector)

SetFromPoints sets Center and Radius from Points

type TransMat

type TransMat struct {
	mat64.Dense
}

TransMat is the Transformation Matrix representation.

func NewTransMat

func NewTransMat() *TransMat

NewTransMat creates a new Transformation Matrix which an 4x4 Idendity.

func (*TransMat) Transform

func (tmat *TransMat) Transform(vec *mat64.Vector) *mat64.Vector

Transform applys Transformation to a Vector

func (*TransMat) Translation

func (tmat *TransMat) Translation(dX, dY, dZ float64)

Translation applies a Translation.

func (*TransMat) XRotation

func (tmat *TransMat) XRotation(angle float64)

XRotation applies a X-Axis rotation.

func (*TransMat) YRotation

func (tmat *TransMat) YRotation(angle float64)

YRotation applies a Y-Axis rotation.

func (*TransMat) ZRotation

func (tmat *TransMat) ZRotation(angle float64)

ZRotation applies a Z-Axis rotation.

Jump to

Keyboard shortcuts

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