From 6ad6895b347691dd8178ebd0a6b818f763e45f57 Mon Sep 17 00:00:00 2001 From: epoch Date: Thu, 10 Mar 2022 14:59:40 +0000 Subject: some naive matrix functions added to math.c, circles are handled a bit differently now. --- src/math.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 65 insertions(+), 10 deletions(-) diff --git a/src/math.c b/src/math.c index 948ded8..ab4fa44 100644 --- a/src/math.c +++ b/src/math.c @@ -190,22 +190,24 @@ c3_s_t apply_group_relative(c3_s_t s,c3_group_rel_t *group_rel) { //printf("# wtf?\n"); return s; } - if(s.len == 1) {//we're a circle. we /really/ have two points stored though. - real dist=distance3(s.p[0],s.p[1]); - s2.p[0]=s.p[0]; - s2.p[1]=c3_add(s.p[0],(c3_t){dist,0,0}); - } - if(s.len > 1) {//we're a polygon. + //if(s.len == 1) {//we're a circle. we /really/ have two points stored though. + // //I'm a dummy. this was just breaking my assumptions. + // //real dist=distance3(s.p[0],s.p[1]); + // s2.p[0]=s.p[0]; + // s2.p[1]=c3_add(s.p[0],(c3_t){dist,0,0}); + //} + //if(s.len > 1) {//we're a polygon. + if(s.len > 0) {//we're a polygon. for(i=0;ip,rotate_c3_yr(s.p[i],(c3_t){0,0,0},d2r((degrees){0-(gr->r.y.d)}))); - } else { + //if(!strcmp(s.id,global.user)) {//we need to rotate camera objects (an avatar maybe) only along the y axis, and in the opposite direction than everything else rotates + // s2.p[i]=c3_add(gr->p,rotate_c3_yr(s.p[i],(c3_t){0,0,0},d2r((degrees){0-(gr->r.y.d)}))); + //} else { if(gr) { s2.p[i]=point_apply_group_relative(s.p[i],gr); } else { s2.p[i]=s.p[i]; } - } + //} } } return s2; @@ -325,3 +327,56 @@ int epoch_PnPoly( c2_t P, c2_t *V, int n ) { } return (P.x <= max.x && P.x >= min.x && P.y >= min.y && P.y <= max.y); } + +/* the matrix stuff isn't actually used */ +typedef struct { + int h; + int w; + real d[16];//tee hee. don't make "large" matrices +} m; + +void m_print(matrix m) { + int i,j; + printf("width: %d height: %d\n",m.w,m.h); + for(i=0;i