force

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CentralGravityR2

type CentralGravityR2 struct {

	// Centre represents the centre of this gravitational force.
	Centre r2.Vec

	// GravitationalConstant represents the strength of gravity.
	GravitationalConstant float64
}

func NewCentralGravityR2

func NewCentralGravityR2(
	centre r2.Vec,
	gravitationalConstant float64) *CentralGravityR2

func (*CentralGravityR2) Calculate

func (c *CentralGravityR2) Calculate(g graph.Graph, layoutR2 layout.LayoutR2) map[int64]r2.Vec

type Force

type Force interface {
	Calculate(g graph.Graph, layoutR2 gn_layout.LayoutR2) map[int64]r2.Vec
}

type ForceStack

type ForceStack struct {

	// RandomizerSeed for random node location generation.
	// This enables reproducible results.
	RandomizerSeed uint64

	// Updates represents the number of iterations that should be run.
	Updates uint

	// StepSize represents the distance each node may travel for every update.
	StepSize float64

	// CoolingRate represents the decrease of the step size per update.
	CoolingRate float64

	// StopThreshold represents the stopping criteria for the simulation.
	// Once the movements are small enough, the simulation stops.
	StopThreshold float64
	// contains filtered or unexported fields
}

func NewForceStack

func NewForceStack(randomizerSeed uint64, updates uint, stepSize float64, coolingRate float64, stopThreshold float64) ForceStack

func (*ForceStack) AddForce

func (s *ForceStack) AddForce(force Force)

func (*ForceStack) Update

func (s *ForceStack) Update(g graph.Graph, layoutR2 gn_layout.LayoutR2) bool

type SimpleMassNode

type SimpleMassNode struct {
	simple.Node
	Mass float64
}

type SpringElectricalR2

type SpringElectricalR2 struct {

	// OptimalDistance represents parameter K in the paper.
	OptimalDistance float64

	// RepulsionStrength represents the regularization parameter C in the paper.
	RepulsionStrength float64

	// RepulsionExponent represents parameter p (p > 0) for the repulsive force to reduce distortion effects.
	// Default should be 1. This exponent is part of the denominator. Increasing it reduces the applied force.
	RepulsionExponent uint

	// AttractionExponent is an added parameter for the attractive spring force to regulate its effect.
	// Default should be 1.0. This exponent is part of the numerator. Increasing it increases the applied force.
	AttractionExponent float64
}

func NewSpringElectricalR2

func NewSpringElectricalR2(
	optimalDistance float64,
	repulsionStrength float64,
	repulsionExponent uint,
	attractionExponent float64) *SpringElectricalR2

func (*SpringElectricalR2) Calculate

func (s *SpringElectricalR2) Calculate(g graph.Graph, layoutR2 layout.LayoutR2) map[int64]r2.Vec

Jump to

Keyboard shortcuts

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