Source: git.darknebu.la/GalaxySimulator/Source/structs Index | Files

package structs

import "git.darknebu.la/GalaxySimulator/Source/structs"

Index

Package Files

boundingBox.go quadtree.go star.go vector2D.go

type BoundingBox Uses

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

BoundingBox is a struct defining the spatial outreach of a box

func NewBoundingBox Uses

func NewBoundingBox(center Vec2, halfDim float64) *BoundingBox

func (*BoundingBox) Center Uses

func (b *BoundingBox) Center() Vec2

func (*BoundingBox) SetCenter Uses

func (b *BoundingBox) SetCenter(center Vec2)

func (*BoundingBox) SetWidth Uses

func (b *BoundingBox) SetWidth(width float64)

func (*BoundingBox) Width Uses

func (b *BoundingBox) Width() float64

type Star2D Uses

type Star2D struct {
    C   Vec2    // coordinates of the star
    V   Vec2    // velocity    of the star
    M   float64 // mass        of the star
}

Define a struct storing essential star information such as it's coordinate, velocity and mass

func (*Star2D) Accelerate Uses

func (s *Star2D) Accelerate(a Vec2, t float64)

Accelerate and move the star with it's velocity and the acceleration a for the time t This changes the position and the velocity of the star.

func (*Star2D) AccelerateVelocity Uses

func (s *Star2D) AccelerateVelocity(a Vec2, t float64)

Accelerate the star with the acceleration a for the time t. This changes the velocity of the star.

func (*Star2D) Copy Uses

func (s *Star2D) Copy() Star2D

Return a copy of the star by returning a star struct with the same values.

func (Star2D) InsideOf Uses

func (s Star2D) InsideOf(boundary BoundingBox) bool

InsideOf is a method that tests if the star it is applied on is in or outside of the given BoundingBox. It returns true if the star is inside of the BoundingBox and false if it isn't.

func (*Star2D) Move Uses

func (s *Star2D) Move(t float64)

Move the star with it's velocity for the time t. This changes the Position of the star.

func (Star2D) Quadrant Uses

func (s Star2D) Quadrant(starsQuadtree *Quadtree) string

Quadrant returns a string indicating in which quadrant of the given quadtree the point the method is applied on is. This methods presumes that the point is inside of the boundingBox

type Vec2 Uses

type Vec2 struct {
    X, Y float64
}

func (*Vec2) Add Uses

func (v1 *Vec2) Add(v2 Vec2) Vec2

returns the sum of this vector and the vector v2

func (*Vec2) Copy Uses

func (v *Vec2) Copy() Vec2

creates a copy of the vector

func (*Vec2) Divide Uses

func (v *Vec2) Divide(s float64) Vec2

returns the quotient of the vector and a scalar s

func (*Vec2) GetDirVector Uses

func (v *Vec2) GetDirVector() Vec2

returns the direction Vector of this vector. This means a copy of this vector with a length of 1

func (*Vec2) GetLength Uses

func (v *Vec2) GetLength() float64

returns the length of the vector

func (*Vec2) Multiply Uses

func (v *Vec2) Multiply(s float64) Vec2

returns the product of the vector and a scalar s

func (*Vec2) SetLength Uses

func (v *Vec2) SetLength(l float64)

changes the length of the vector to the length l

func (*Vec2) SetLengthOne Uses

func (v *Vec2) SetLengthOne()

changes the length of the vector to the length 1

func (*Vec2) Split Uses

func (v *Vec2) Split() (x float64, y float64)

func (*Vec2) Subtract Uses

func (v1 *Vec2) Subtract(v2 Vec2) Vec2

returns the difference of this vector minus the vector v2

Package structs imports 1 packages (graph) and is imported by 5 packages. Updated 2019-04-08. Refresh now. Tools for package owners.

The go get command cannot install this package because of the following issues: