diff options
-rw-r--r-- | .idea/vcs.xml | 6 | ||||
-rw-r--r-- | config.json | 2 | ||||
-rw-r--r-- | draw/draw.go | 10 | ||||
-rw-r--r-- | main.go | 36 |
4 files changed, 48 insertions, 6 deletions
diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$PROJECT_DIR$" vcs="Git" /> + </component> +</project> \ No newline at end of file diff --git a/config.json b/config.json index 467639e..0fd8122 100644 --- a/config.json +++ b/config.json @@ -2,7 +2,7 @@ "Frames": 1, "Threads": 8, "RangeStart": 0, - "RangeEnd": 10000, + "RangeEnd": 5000, "LoadPath": "data/U_ALL.csv", "OutPath": "out_%d.csv" } diff --git a/draw/draw.go b/draw/draw.go index c5d1474..8b66c90 100644 --- a/draw/draw.go +++ b/draw/draw.go @@ -1,6 +1,7 @@ package draw import ( + "fmt" "git.darknebu.la/GalaxySimulator/Source/structs" "github.com/fogleman/gg" "math" @@ -9,8 +10,8 @@ import ( // initializePlot generates a new plot and returns the plot context func initializePlot() *gg.Context { // Define the image size - const imageWidth = 8192 * 2 - const imageHeight = 8192 * 2 + const imageWidth = 8192 + const imageHeight = 8192 // Initialize the new context dc := gg.NewContext(imageWidth, imageHeight) @@ -57,7 +58,7 @@ func drawStar(dc *gg.Context, star structs.Star2D) { func drawVelocity(dc *gg.Context, star structs.Star2D) { // scaling factor for a better view of the velocity difference // Use this value to control how long the vectors are drawn - var scalingFactor float64 = 25 + var scalingFactor float64 = 50 // Move the "cursor" to the start position of the vector dc.MoveTo(star.C.X/50, star.C.Y/50) @@ -67,7 +68,8 @@ func drawVelocity(dc *gg.Context, star structs.Star2D) { // Use a sigmoid function to generate useful values for coloring the vectors according to their // strength - var val = 1.0 / (1.0 + math.Exp(-vecLength*scalingFactor/2)) + var val = 1.0 / (1.0 + math.Exp(-vecLength*scalingFactor/2 * 1e8)) + fmt.Println(val) // Set the color to a blue / red dc.SetRGB(val, 0, 1-val) diff --git a/main.go b/main.go index bd243a0..4a3dcad 100644 --- a/main.go +++ b/main.go @@ -32,7 +32,41 @@ func main() { fmt.Printf("and writing the results to %s.\n", config.OutPath) // the slice starsSlice stores the star structures - starsSlice := []structs.Star2D{} + starsSlice := []structs.Star2D{ + structs.Star2D{ + C: structs.Vec2{ + X: -1e5, + Y: 0, + }, + V: structs.Vec2{ + X: 0, + Y: 0, + }, + M: 1e10, + }, + structs.Star2D{ + C: structs.Vec2{ + X: 1e5, + Y: 0, + }, + V: structs.Vec2{ + X: 0, + Y: 0, + }, + M: 1e10, + }, + structs.Star2D{ + C: structs.Vec2{ + X: 0, + Y: 4e4, + }, + V: structs.Vec2{ + X: 0, + Y: 0, + }, + M: 1e10, + }, + } starsSlice = csv.Import(config.LoadPath, config.RangeStart, config.RangeEnd, starsSlice) fmt.Println("Done loading the data") |