Created
November 11, 2019 15:28
-
-
Save rbnpercy/2ba5b6902a77371ac78d834bcde93002 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
let jobj = parseFile("1.json") | |
let coordinates = jobj["coordinates"].elems | |
let len = float(coordinates.len) | |
var x = 0.0 | |
var y = 0.0 | |
var z = 0.0 | |
for coord in coordinates: | |
x += coord["x"].fnum | |
y += coord["y"].fnum | |
z += coord["z"].fnum | |
echo x / len | |
echo y / len | |
echo z / len |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment