getCdata and getBits: prod -> hybri

This commit is contained in:
Zeno Rogue 2020-05-15 18:31:32 +02:00
parent 58a4583bb7
commit 3f20ba9d29
4 changed files with 29 additions and 10 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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;
}

View File

@ -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"