vector

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: LGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package vector provides simple operations on 3d vector required for 3DF trajectory calculation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Vector

type Vector struct {
	X float64 //X-coordinate
	Y float64 //Y-coordinate
	Z float64 //Z-coordinate
}

Vector struct keeps data about a 3D vector

func Create

func Create(x, y, z float64) Vector

Create create a vector from its coordinates

func (Vector) Add

func (v Vector) Add(b Vector) Vector

Add adds two vectors

func (Vector) Copy

func (v Vector) Copy() Vector

Copy creates a copy of the vector

func (Vector) Magnitude

func (v Vector) Magnitude() float64

Magnitude retruns a magnitude of the vector

The magnitude of the vector is the length of a line that starts in point (0,0,0) and ends in the point set by the vector coordinates

func (Vector) MultiplyByConst

func (v Vector) MultiplyByConst(a float64) Vector

MultiplyByConst multiplies the vector by the constant

func (Vector) MultiplyByVector

func (v Vector) MultiplyByVector(b Vector) float64

MultiplyByVector returns a product of two vectors

The product of two vectors is a sum of products of each coordinate

func (Vector) Negate

func (v Vector) Negate() Vector

Negate returns a vector which is simmetrical to this vector vs (0,0,0) point

func (Vector) Normalize

func (v Vector) Normalize() Vector

Normalize returns a vector of magnitude one which is collinear to this vector

func (Vector) String

func (v Vector) String() string

Converts a vector into a string

func (Vector) Subtract

func (v Vector) Subtract(b Vector) Vector

Subtract subtracts one vector from another

Jump to

Keyboard shortcuts

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