diff --git a/3d-models.cpp b/3d-models.cpp index 46853169..bfb829e7 100644 --- a/3d-models.cpp +++ b/3d-models.cpp @@ -699,6 +699,62 @@ void make_ball(hpcshape& sh, ld rad, int lev) { add_texture(sh); } +hyperpoint psmin(hyperpoint H) { + hyperpoint res; + res[2] = asin_auto(H[2]); + ld cs = pow(cos_auto(res[2]), 2); + ld r = sqrt(cs+H[0]*H[0]+H[1]*H[1]); + res[0] = H[0] / r; + res[1] = H[1] / r; + return res; + } + +void adjust_eye(hpcshape& eye, hpcshape head, ld shift_eye, ld shift_head, int q, ld zoom=1) { + using namespace hyperpoint_vec; + hyperpoint center = Hypc; + for(int i=eye.s; i 0) center += hpc[i]; + center = normalize(center); + // center /= (eye.e - eye.s); + ld rad = 0; + for(int i=eye.s; i 0) rad += hdist(center, hpc[i]); + rad /= (eye.e - eye.s); + + hyperpoint pscenter = psmin(center); + + ld pos = 0; + int qty = 0, qtyall = 0; + + vector pss; + + for(int i=head.s; i