diff options
author | hanemile <hanemile@protonmail.com> | 2019-01-21 22:11:25 +0100 |
---|---|---|
committer | hanemile <hanemile@protonmail.com> | 2019-01-21 22:11:25 +0100 |
commit | 6ae19dcc07980f4daaa337edd624d6f68ae3578b (patch) | |
tree | b5c4e2f057e1abaff521d8b6d541cdc80eb728d9 /update.go | |
parent | 9c3837c139dc73f7193768cc5c55bb2835e84a85 (diff) |
grouped the functions in individual files and created a detailed README.md
Diffstat (limited to 'update.go')
-rw-r--r-- | update.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/update.go b/update.go new file mode 100644 index 0000000..402a64c --- /dev/null +++ b/update.go @@ -0,0 +1,27 @@ +package main + +import ( + "log" + "net/http" + "strconv" + + "github.com/gorilla/mux" +) + +// updateCenterOfMassHandler updates the center of mass in each node in tree with the given index +func updateCenterOfMassHandler(w http.ResponseWriter, r *http.Request) { + log.Println("Updating the center of mass") + vars := mux.Vars(r) + treeindex, _ := strconv.ParseInt(vars["treeindex"], 10, 0) + + treeArray[treeindex].CalcCenterOfMass() +} + +// updateTotalMassHandler updates the total mass in each node in the tree with the given index +func updateTotalMassHandler(w http.ResponseWriter, r *http.Request) { + log.Println("Updating the total mass") + vars := mux.Vars(r) + treeindex, _ := strconv.ParseInt(vars["treeindex"], 10, 0) + + treeArray[treeindex].CalcTotalMass() +} |