clusters

package
v0.0.0-...-76f73ec Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2025 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package clusters implements the cluster generation algorithm. It returns a list of systems containing their coordinates and the number of stars in each system. The location of the 3- and 4-star systems are fixed; the rest are randomly located.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateClusterHTML

func GenerateClusterHTML(input []System) (*bytes.Buffer, error)

Types

type Point

type Point struct {
	X, Y, Z int
}

func (Point) DistanceBetween

func (a Point) DistanceBetween(b Point) float64

DistanceBetween calculates the Euclidean distance between two points in 3D space.

func (Point) Scale

func (a Point) Scale(scale float64) Point

Scale scales the point by a factor of scale, which should be the radius of the cluster.

func (Point) String

func (a Point) String() string

String implements the fmt.Stringer interface.

func (Point) TooClose

func (a Point) TooClose(points []Point) bool

TooClose returns true if the distance between a point and any point in the slice of points is less than 5 units.

type System

type System struct {
	Coordinates   Point
	NumberOfStars int
}

func GenerateCluster

func GenerateCluster() (systems []System)

GenerateCluster generates a slice containing 100 systems.

Jump to

Keyboard shortcuts

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