wouldn't adding z on all 3 planes make all 3 planes slope downwards?
Two raytracing problems
38 posts
A tetrahedron is a four sided 3D object with all faces being triangles. You people are talking about a triangular prism.
😁
A tetrahedron is a four sided 3D object with all faces being triangles. You people are talking about a triangular prism.Zevensoft, we've been talking about taking four planes, cutting them into triangles, and fitting the triangles together. At least that's what I've been talking about ever since skupers said "tetrahedron". We made a triangular tunnel/prism a good while back. WTF do you mean we've been talking about a triangular prism?
Originally posted by 13373571No, there's a plane z1=-1 to cut the tunnel. At z1=1, using x1+y1=1-z1 gives you x1+y1=0. And if there was something wrong with these formulas, wouldn't we have noticed earlier? Viewing from the outside gives you a tetrahedron.
wouldn't adding z on all 3 planes make all 3 planes slope downwards?
Viewing from the outside gives you a tetrahedron.No it doesn't, that's the problem, remember? It gives us a triangular prism that stretches infinitely in one diagonal direction and is cut by the plane z=-sqrt(2).
Edit:
Here, i just fixed it.
I changed the plane z+y=-sqrt(2) into the plane y=-sqrt(2). That's what was wrong, you had the wrong plane. Blargh.
Pixel:
x1=x;y1=y;
x1d=x1*cz-y1*sz;y1d=x1*sz+y1*cz;
y2d=y1d*cx-sx;z2d=y1d*sx+cx;
x3d=x1d*cy-z2d*sy;z3d=x1d*sy+z2d*cy;
k1=(2+ox-oy-oz)/(y2d-x3d+z3d);
ix=k1*x3d+ox;iy=k1*y2d+oy;iz=k1*z3d+oz;
k1=if(above(k1,0)*below(ix+iy+iz,2)*above(iy,-sqrt(2))*above(iz,-sqrt(2)),k1,1337);
k2=(2-ox-oy-oz)/(y2d+x3d+z3d);
ix=k2*x3d+ox;iy=k2*y2d+oy;iz=k2*z3d+oz;
k2=if(above(k2,0)*below(-ix+iy+iz,2)*above(iy,-sqrt(2))*above(iz,-sqrt(2)),k2,1337);
k3=(-sqrt(2)-oz)/z3d;
ix=k3*x3d+ox;iy=k3*y2d+oy;iz=k3*z3d+oz;
k3=if(above(k3,0)*below(-ix+iy+iz,2)*below(ix+iy+iz,2)*above(iy,-sqrt(2)),k3,1337);
k4=(-sqrt(2)-oy)/(y2d);
ix=k4*x3d+ox;iy=k4*y2d+oy;iz=k4*z3d+oz;
k4=if(above(k4,0)*below(-ix+iy+iz,2)*above(iz,-sqrt(2))*below(ix+iy+iz,2),k4,1337);
k=min(k1,min(k2,min(k3,k4)));
ix=k*x3d+ox;iy=k*y2d+oy;iz=k*z3d+oz;
x=(1-equal(k,k3))*ix+equal(k,k3)*ix;
y=(1-equal(k,k3))*iz+equal(k,k3)*iy;
alpha=1-equal(k,1337);
Then, it should be y-z=-sqrt(2), not y=-sqrt(2). Sorry for my stupid mistake. 🙁
This should work.
x1=x;y1=y;
x1d=x1*cz-y1*sz;y1d=x1*sz+y1*cz;
y2d=y1d*cx-sx;z2d=y1d*sx+cx;
x3d=x1d*cy-z2d*sy;z3d=x1d*sy+z2d*cy;
k1=(2+ox-oy-oz)/(y2d-x3d+z3d);
ix=k1*x3d+ox;iy=k1*y2d+oy;iz=k1*z3d+oz;
k1=if(above(k1,0)*below(ix+iy+iz,2)*above(iy-iz,-sqrt(2))*above(iz,-sqrt(2)),k1,1337);
k2=(2-ox-oy-oz)/(y2d+x3d+z3d);
ix=k2*x3d+ox;iy=k2*y2d+oy;iz=k2*z3d+oz;
k2=if(above(k2,0)*below(-ix+iy+iz,2)*above(iy-iz,-sqrt(2))*above(iz,-sqrt(2)),k2,1337);
k3=(-sqrt(2)-oz)/z3d;
ix=k3*x3d+ox;iy=k3*y2d+oy;iz=k3*z3d+oz;
k3=if(above(k3,0)*below(-ix+iy+iz,2)*below(ix+iy+iz,2)*above(iy-iz,-sqrt(2)),k3,1337);
k4=(-sqrt(2)-oy+oz)/(y2d-z3d);
ix=k4*x3d+ox;iy=k4*y2d+oy;iz=k4*z3d+oz;
k4=if(above(k4,0)*below(-ix+iy+iz,2)*above(iz,-sqrt(2))*below(ix+iy+iz,2),k4,1337);
k=min(k1,min(k2,min(k3,k4)));
ix=k*x3d+ox;iy=k*y2d+oy;iz=k*z3d+oz;
x=(1-equal(k,k3))*ix+equal(k,k3)*ix;
y=(1-equal(k,k3))*iz+equal(k,k3)*iy;
alpha=1-equal(k,1337);
Sorry for my stupid mistake. 🙁No problem, everybody screws stuff like that up occasionally.
I was just getting irritated because I couldn't get something to work even though it seemed so clear that it should've been working.