From 02d65c3c9baa0e76744ce001c55ec699ab3b956f Mon Sep 17 00:00:00 2001
From: Miha Fošnarič <miha.fosnaric@fe.uni-lj.si>
Date: Mon, 11 Jul 2016 13:09:15 +0000
Subject: [PATCH] A fix in energy.c. Normals are summed now.

---
 src/snapshot.c |    2 +-
 src/energy.c   |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/energy.c b/src/energy.c
index 7c29c0b..b4add2a 100644
--- a/src/energy.c
+++ b/src/energy.c
@@ -216,11 +216,11 @@
 	ts_double norml,ddp=0.0;
 	ts_uint i;
 	ts_double xnorm=0.0,ynorm=0.0,znorm=0.0;
-	/*find normal of the vertex as average normal of all the triangles surrounding it. */
+	/*find normal of the vertex as sum of all the normals of the triangles surrounding it. */
 	for(i=0;i<vtx->tristar_no;i++){
-			xnorm=vtx->tristar[i]->xnorm;
-			ynorm=vtx->tristar[i]->ynorm;
-			znorm=vtx->tristar[i]->znorm;
+			xnorm+=vtx->tristar[i]->xnorm;
+			ynorm+=vtx->tristar[i]->ynorm;
+			znorm+=vtx->tristar[i]->znorm;
 	}
 	/*normalize*/
 	norml=sqrt(xnorm*xnorm+ynorm*ynorm+znorm*znorm);
diff --git a/src/snapshot.c b/src/snapshot.c
index fbb6d4b..da21498 100644
--- a/src/snapshot.c
+++ b/src/snapshot.c
@@ -24,7 +24,7 @@
 ts_bool xml_trisurf_data(FILE *fh, ts_vesicle *vesicle){
 
 	ts_string *data=(ts_string *)malloc(sizeof(ts_sprintf));
-	data->string=(char *)malloc(512000*sizeof(char)); /*TODO: warning, can break if the string is to long */
+	data->string=(char *)malloc(5120000*sizeof(char)); /*TODO: warning, can break if the string is to long */
 	data->beg=0;
 	
 	xml_trisurf_header(fh, vesicle);

--
Gitblit v1.9.3