From 6ae19dcc07980f4daaa337edd624d6f68ae3578b Mon Sep 17 00:00:00 2001 From: hanemile Date: Mon, 21 Jan 2019 22:11:25 +0100 Subject: grouped the functions in individual files and created a detailed README.md --- update.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 update.go (limited to 'update.go') 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() +} -- cgit 1.4.1