about summary refs log tree commit diff
diff options
context:
space:
mode:
authoremile <hanemile@protonmail.com>2018-10-13 22:30:54 +0200
committeremile <hanemile@protonmail.com>2018-10-13 22:30:54 +0200
commit6e137fe268d9933bfafa5b064fbfaf8e4e682275 (patch)
treec8775df6e864092520c88bce017e3518d16d0155
parent71b4d2ecf24bac70f0eefd6ec1107f441c3ca420 (diff)
Importing the z value of the precalculated star-positions and using it.
-rw-r--r--csv/csv.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/csv/csv.go b/csv/csv.go
index 6f1b652..dc4cdf1 100644
--- a/csv/csv.go
+++ b/csv/csv.go
@@ -43,19 +43,23 @@ func Import(path string, start int, end int, slice []structs.Star) []structs.Sta
 	for linenr, line := range lines[start:end] {
 		x, errx := strconv.ParseFloat(line[0], 64)
 		y, erry := strconv.ParseFloat(line[1], 64)
+		z, errz := strconv.ParseFloat(line[2], 64)
 
 		// Handle errors
 		if errx != nil {
 			log.Printf("error reading value from csv in line nr. %d (%s)", linenr, errx)
 		}
-		if errx != nil {
+		if erry != nil {
 			log.Printf("error reading value from csv in line nr. %d (%s)", linenr, erry)
 		}
+		if errz != nil {
+			log.Printf("error reading value from csv in line nr. %d (%s)", linenr, errz)
+		}
 
 		// Create a temporary star for assembling the star
 		tempStar := structs.Star{
-			structs.Coord{x, y},
-			structs.Force{0, 0},
+			structs.Coord{X: x, Y: y, Z: z},
+			structs.Force{X: 0, Y: 0, Z: 0},
 			50000,
 		}