From d27c077296c88b4a78288bed7454c3a60279c26e Mon Sep 17 00:00:00 2001 From: Samo Penic <samo.penic@gmail.com> Date: Fri, 13 Jun 2014 13:58:50 +0000 Subject: [PATCH] seems to work. --- src/cross-section.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cross-section.c b/src/cross-section.c index beb00aa..1b0930e 100644 --- a/src/cross-section.c +++ b/src/cross-section.c @@ -9,17 +9,17 @@ * if a distance of point to plane (given by equation $D=\frac{ax_0+by_0+cz_0+d}{\sqrt{a^2+b^2+c^2}}$, where $x_0$, $y_0$ and $z_0$ are coordinates of a given vertex) is less than maximal allowed distance between vertices {\tt sqrt(vesicle->dmax)} than vertex is a candidate for crossection calculation. * */ -ts_coord_list get_crossection_with_plane(ts_vesicle vesicle,ts_double a,ts_double b,ts_double c, ts_double d){ +ts_coord_list *get_crossection_with_plane(ts_vesicle *vesicle,ts_double a,ts_double b,ts_double c, ts_double d){ - ts_uint i, j, k; + ts_uint i, j; ts_double pp,Dsq; // distance from the plane squared - ts_double ppn,Dsqn; // distance from the plane squared of a neighbor + ts_double ppn; // distance from the plane squared of a neighbor ts_double u; //factor to scale vector from first vector to the second to get intersection ts_vertex *vtx; ts_coord_list *pts=init_coord_list(); - for(i=0;i<vesicle->vlist->N;i++){ + for(i=0;i<vesicle->vlist->n;i++){ vtx=vesicle->vlist->vtx[i]; pp=vtx->x*a+vtx->y*b+vtx->z*c+d; @@ -28,10 +28,10 @@ for(j=0;j<vtx->neigh_no;j++){ ppn=vtx->neigh[j]->x*a+vtx->neigh[j]->y*b+vtx->neigh[j]->z*c+d; if(pp*ppn<0){ //the combination of vertices are good candidates for a crossection - u=pp/(a*(vtx->x-vtx->neigh[j]->x)+b*(vtx->y-vtx->neigh[j]->y)+c(vtx->z-vtx->neigh[j]->z)); - add_coord(pts, vtx->x+u(vtx->neigh[j]->x - vtx->x), - vtx->y+u(vtx->neigh[j]->y - vtx->y), - vtx->z+u(vtx->neigh[j]->z - vtx->z), + u=pp/(a*(vtx->x-vtx->neigh[j]->x)+b*(vtx->y-vtx->neigh[j]->y)+c*(vtx->z-vtx->neigh[j]->z)); + add_coord(pts, vtx->x+u*(vtx->neigh[j]->x - vtx->x), + vtx->y+u*(vtx->neigh[j]->y - vtx->y), + vtx->z+u*(vtx->neigh[j]->z - vtx->z), TS_COORD_CARTESIAN); } } -- Gitblit v1.9.3