diff --git a/cell.cpp b/cell.cpp index 71cb8ed6..b531b6a6 100644 --- a/cell.cpp +++ b/cell.cpp @@ -917,7 +917,7 @@ EX cdata *arcmCdata(cell *c) { } EX int getCdata(cell *c, int j) { - if(prod) { c = hybrid::get_where(c).first; return PIU(getBits(c)); } + if(hybri) { c = hybrid::get_where(c).first; return PIU(getBits(c)); } else if(euc::in()) return getEuclidCdata(euc2_coordinates(c))->val[j]; else if(arcm::in() && euclid) return getEuclidCdata(pseudocoords(c))->val[j]; @@ -935,7 +935,7 @@ EX int getCdata(cell *c, int j) { } EX int getBits(cell *c) { - if(prod) { c = hybrid::get_where(c).first; return PIU(getBits(c)); } + if(hybri) { c = hybrid::get_where(c).first; return PIU(getBits(c)); } else if(euc::in()) return getEuclidCdata(euc2_coordinates(c))->bits; else if(arcm::in() && euclid) return getEuclidCdata(pseudocoords(c))->bits; diff --git a/hyperpoint.cpp b/hyperpoint.cpp index c9ec5e2c..1847f4f9 100644 --- a/hyperpoint.cpp +++ b/hyperpoint.cpp @@ -384,6 +384,30 @@ EX ld hypot_d(int d, const hyperpoint& h) { return sqrt(sqhypot_d(d, h)); } +/** @brief h1 and h2 define a line; to_other_side(h1,h2)*x is x moved orthogonally to this line, by double the distance from C0 + * (I suppose it could be done better) + */ +EX transmatrix to_other_side(hyperpoint h1, hyperpoint h2) { + + ld d = hdist(h1, h2); + + hyperpoint v; + if(euclid) + v = (h2 - h1) / d; + else + v = (h1 * cos_auto(d) - h2) / sin_auto(d); + + ld d1; + if(euclid) + d1 = -(v|h1) / (v|v); + else + d1 = atan_auto(-v[LDIM] / h1[LDIM]); + + hyperpoint hm = h1 * cos_auto(d1) + v * sin_auto(d1); + + return rspintox(hm) * xpush(-hdist0(hm) * 2) * spintox(hm); + } + /** @brief positive for a material vertex, 0 for ideal vertex, negative for ultra-ideal vertex */ EX ld material(const hyperpoint& h) { if(sphere) return intval(h, Hypc); diff --git a/nonisotropic.cpp b/nonisotropic.cpp index d0b00c93..9b4570e0 100644 --- a/nonisotropic.cpp +++ b/nonisotropic.cpp @@ -1072,12 +1072,7 @@ EX namespace hybrid { transmatrix T; cell *cw = hybrid::get_where(c).first; hybrid::in_underlying_geometry([&] { - hyperpoint h0 = get_corner_position(cw, i); - hyperpoint h1 = get_corner_position(cw, (i+1)); - hyperpoint hm = mid(h0, h1); - ld d = hdist0(hm); - d *= 2; - T = xpush(-d) * spintox(hm); + T = to_other_side(get_corner_position(cw, i), get_corner_position(cw, (i+1))); }); return T; } diff --git a/raycaster.cpp b/raycaster.cpp index a37af553..9a2f8428 100644 --- a/raycaster.cpp +++ b/raycaster.cpp @@ -74,7 +74,7 @@ EX bool available() { return true; if(euclid && pmodel == mdPerspective && !bt::in()) return true; - if(prod && (PURE || BITRUNCATED)) + if(prod) return true; if(pmodel == mdPerspective && stretch::in()) return true; @@ -199,7 +199,7 @@ void enable_raycaster() { bool asonov = hr::asonov::in(); bool use_reflect = reflect_val && !nil && !levellines; - bool bi = BITRUNCATED; + bool bi = arcm::in() || kite::in() || arb::in() || !PURE; string vsh = "attribute mediump vec4 aPosition;\n"