X-Git-Url: https://hackdaworld.org/gitweb/?a=blobdiff_plain;f=math%2Fmath.c;h=6f4345e0124460ebbcb63a0482df9e367e592629;hb=e6f456c0fa807b86e1b25996e70efcdcfe390ea5;hp=9217c88aeda8398b58c42ed4e47266090e0c497b;hpb=85abe46fecc79a3d7885ff6124186b2be2ca96ac;p=physik%2Fposic.git diff --git a/math/math.c b/math/math.c index 9217c88..6f4345e 100644 --- a/math/math.c +++ b/math/math.c @@ -76,7 +76,7 @@ double v3_norm(t_3dvec *a) { return(sqrt(v3_absolute_square(a))); } -int v3_per_bounds(t_3dvec *a,t_3dvec *dim) { +int v3_per_bound(t_3dvec *a,t_3dvec *dim) { double x,y,z; @@ -84,11 +84,11 @@ int v3_per_bounds(t_3dvec *a,t_3dvec *dim) { y=0.5*dim->y; z=0.5*dim->z; - if(a->x>x) a->x-=dim->x; + if(a->x>=x) a->x-=dim->x; else if(-a->x>x) a->x+=dim->x; - if(a->y>y) a->y-=dim->y; + if(a->y>=y) a->y-=dim->y; else if(-a->y>y) a->y+=dim->y; - if(a->z>z) a->z-=dim->z; + if(a->z>=z) a->z-=dim->z; else if(-a->z>z) a->z+=dim->z; return 0;