From bb17403496d39d467b6737880c928e020a50aaec Mon Sep 17 00:00:00 2001 From: epoch Date: Tue, 2 Jan 2018 06:05:43 -0600 Subject: added different method of calculating distance of a shape to where farthest point is what is used. --- src/graphics_c3.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src') diff --git a/src/graphics_c3.c b/src/graphics_c3.c index 41fbfcf..b4b9eb9 100644 --- a/src/graphics_c3.c +++ b/src/graphics_c3.c @@ -265,6 +265,21 @@ real shitdist2(c3_t p1,c3_t p2) { real shitdist(struct c3_shape *s,c3_t p) {//this function is a killer. :/ int i; + real curdist=0; + real maxdist=0; + c3_group_rot_t *gr=get_group_rotation(s->id); + for(i=0;i< s->len+(s->len==1);i++) { + if(gr) { + curdist=shitdist2(global.camera.p,rotate_c3_yr(c3_add(gr->p,s->p[i]),gr->p,d2r(gr->r.y))); + } else { + curdist=shitdist2(global.camera.p,s->p[i]);//if there's no gr we're basically just this point. no rotation, not offests. + } + if(curdist > maxdist) maxdist=curdist; + } + return maxdist; + //averaging it works ok, but I've decided to now use the farthest to say the distance something is. + //why the fuck did we get group rotations each... nevermind. this code just sucks. + /* real total=0; for(i=0;i< s->len+(s->len==1);i++) { c3_group_rot_t *gr=get_group_rotation(s->id); @@ -277,6 +292,7 @@ real shitdist(struct c3_shape *s,c3_t p) {//this function is a killer. :/ ,global.camera.p); }//why the fuck are we rotating this around the camera? that shouldn't make any difference to the distance from the camera... return (total) / (real)(s->len+(s->len==1)); + */ } -- cgit v1.2.3