View Single Post
Old 12th August 2003, 11:14   #116
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
Bunch of dm's I wrote in spare time...I hope someone can make good use of it.
DM Collection:
1) Binaculors

Frame:
t=t+.05;t1=t1+ti*.1;ti=ti*.9;
ox1=sin(t1)*.5*sin(t);oy=cos(t1)*.5;
rx=0;ry=0;rz=rz+.01+sin(t1-sin(t))*.05;
oz=t*5+sin(t1)*.5+.5;
sx=sin(rx);sy=sin(ry);sz=sin(rz);
cx=cos(rx);cy=cos(ry);cz=cos(rz);
af=max(h,w)/min(h,w);


Beat: ti=1

Point:
y=if(above(h,w),y*af,y);x=if(above(w,h),x*af,x);
dx1=x*cz-y*sz;dy1=x*sz+y*cz;
dy2=dy1*cx-sx;dz2=dy1*sx+cx;
dx3=dx1*cy-dz2*sy;dz2=dx1*sy+dz2*cy;

ox=ox1+.5;
dx1=sqr(dx3);dy1=sqr(dy2);dz1=sqr(dz2);
mtx=dx3*ox;mty=dy2*oy;mtz=dz2*oz;

a=2*(dx1+dy1);
b=2*(mtx+mty);
c=sqr(ox)+sqr(oy)-1;
D=sqr(b)-2*a*c;
k1=(-b+sqrt(abs(D)))/a;

ox=ox1-.5;
mtx=dx3*ox;mty=dy2*oy;mtz=dz2*oz;

a=2*(dx1+dy1);
b=2*(mtx+mty);
c=sqr(ox)+sqr(oy)-1;
D=sqr(b)-2*a*c;
k2=(-b+sqrt(abs(D)))/a;

k=max(k1,k2);
ix=k*dx3+ox;
iy=k*dy2+oy;
iz=k*dz2+oz;

x=atan2(ix,iy);
y=asin(sin(iz));
d=sqr(ix-ox)+sqr(iy-oy)+sqr(iz-oz);
alpha=4/(d+1);



2) 8 sided shape
Frame:
t=t+.001+ti*.1;ti=ti*.9;
ox=cos(t)*.6*sin(t*.76+t);
oy=cos(t*.76+1)*.9;
oz=sin(t-1)*cos(t);
rx=0.1+atan2(ox,sqr(oy)+sqr(oz));
ry=atan2(ox,oz);
rz=-atan2(oz,sqr(ox)+sqr(oy));

sx=sin(rx);sy=sin(ry);sz=sin(rz);
cx=cos(rx);cy=cos(ry);cz=cos(rz);
af=max(h,w)/min(h,w);

cz1=cos(-pi/4);sz1=sin(-pi/4);

Beat:ti=.4

Point:
y=if(above(h,w),y*af,y);x=if(above(w,h),x*af,x);

dx1=x*cz-y*sz;
dy1=x*sz+y*cz;
dy2=dy1*cx-sx;
dz2=dy1*sx+cx;
dx3=dx1*cy-dz2*sy;
dz2=dx1*sy+dz2*cy;
dx1=dx3*cz1-dy2*sz1;
dy1=dx3*sz1+dy2*cz1;
dx3=dx1;dy2=dy1;

k1=(1-oy-ox)/(dy2+dx3);
k1=if(below(k1,0),(-1-oy-ox)/(dy2+dx3),k1);

k3=(1-oy)/dy2;
k3=if(below(k3,0),(-1-oy)/dy2,k3);

k4=(1-ox)/dx3;
k4=if(below(k4,0),(-1-ox)/dx3,k4);

k5=(2-oz)/dz2;
k5=if(below(k5,0),(-2-oz)/dz2,k5);

k=min(min(k1,k5),min(k4,k3));

x=k*dx3+ox;
y=k*dz2+oz;

x=if(equal(k,k4),k*dy2+oy,x);
y=if(equal(k,k5),k*dy2+oz,y);


3) 3 tunnel intersection:
Note: there is something special about this dm, what you need to do is use a 4X4 colour grid to the original texture so that the upper right part of the texture has a different colour tone than the lower left part. Now observe

Frame:
t=t+.05;

rad=1.4;
rx=(rx+rx1*.1)/1.1;
ry=(ry+ry1*.1)/1.1;
rz=(rz+rz1*.1)/1.1;

sx=sin(rx);sy=sin(ry);sz=sin(rz);
cx=cos(rx);cy=cos(ry);cz=cos(rz);

ox=(sx+cy+cz)*.33;
oy=(sy+cx+cz)*.33;
oz=(sz+cx+cy)*.33;

af=max(h,w)/min(h,w);

Beat:
cb=cb+1;
rx1=if(cb%5,rx1,if(below(abs(rx-rx1),.3),rx1+pi/2*sign(getosc(0,0,0)),rx1));
ry1=if(cb%3,ry1,if(below(abs(ry-ry1),.3),ry1+pi/2*sign(getosc(0.1,0,0)),ry1));
rz1=if(cb%2,rz1,if(below(abs(rz-rz1),.3),rz1+pi/2*sign(getosc(0.2,0,0)),rz1));
col=-col;

Point:
y=if(above(h,w),y*af,y);x=if(above(w,h),x*af,x);
dx1=x*cz-y*sz;dy1=x*sz+y*cz;
dy2=dy1*cx-sx;dz2=dy1*sx+cx;
dx3=dx1*cy-dz2*sy;dz2=dx1*sy+dz2*cy;

dx1=sqr(dx3);dy1=sqr(dy2);dz1=sqr(dz2);
mtx=dx3*ox;mty=dy2*oy;mtz=dz2*oz;

¤ center sphere;

a=dx1+dy1+dz1;
b=2*(dx3*ox+dy2*oy+dz2*oz);
c=sqr(oz)+sqr(oy)+sqr(oz)-4;
D=sqr(b)-4*a*c;
k4=(-b+sqrt(abs(d)))/(2*a);
k4=if(below(D,0),1000,k4);

c=sqr(oz)+sqr(oy)+sqr(oz)-16;
D=sqr(b)-4*a*c;
k5=(-b+sqrt(abs(d)))/(2*a);
k5=if(below(D,0),1000,k5);

¤cylinder on z-axis;
a=2*(dx1+dy1);
b=2*(mtx+mty);
c=sqr(ox)+sqr(oy)-sqr(rad);
D=sqr(b)-2*a*c;
k1=(-b+sqrt(abs(D)))/a;

k1=if(below(D,0),1000,k1);

¤cyliner along y-axis;
a=2*(dx1+dz1);
b=2*(mtx+mtz);
c=sqr(ox)+sqr(oz)-sqr(rad);
D=sqr(b)-2*a*c;
k2=(-b+sqrt(abs(D)))/a;
k2=if(below(D,0),1000,k2);

¤cyliner along x-axis;
a=2*(dy1+dz1);
b=2*(mty+mtz);
c=sqr(oy)+sqr(oz)-sqr(rad);
D=sqr(b)-2*a*c;
k3=(-b+sqrt(abs(D)))/a;

k3=if(below(D,0),1000,k3);

k=min(max(max(max(k1,k2),k3),k4),k5);

ix=k*dx3+ox;iy=k*dy2+oy;iz=k*dz2+oz;

x=if(equal(k,k1),ix,if(equal(k,k2),ix,iy));
y=if(equal(k,k1),iz,if(equal(k,k2),iy,ix));

r=if(equal(k,k4),2,4);
x=if(equal(k,k4)+equal(k,k5),atan2(ix,iz)/2,x);
y=if(equal(k,k4)+equal(k,k5),asin(iy/r)*2,y);

x=asin(sin(x*pi*.5))*2/pi;
y=asin(sin(y*pi*.5))*2/pi;

x=if(equal(k,k4)+equal(k,k5),abs(x)*col,-abs(x)*col);
y=if(equal(k,k4)+equal(k,k5),abs(y)*col,-abs(y)*col);
d=sqr(ix-ox)+sqr(iy-oy)+sqr(iz-oz);
alpha=7/(d+1)*bnot(equal(k,1000));



4) 3 tunnel intersection in a cube: same as above except insead of the intersection sphere, there is a cube
Init:
pi=acos(-1);col=1
fRAME:
t=t+.05;

rx=(rx+rx1*.1)/1.1;
ry=(ry+ry1*.1)/1.1;
rz=(rz+rz1*.1)/1.1;

sx=sin(rx);sy=sin(ry);sz=sin(rz);
cx=cos(rx);cy=cos(ry);cz=cos(rz);

ox=(sx+cy+cz)*.33;
oy=(sy+cx+cz)*.33;
oz=(sz+cx+cy)*.33;

af=max(h,w)/min(h,w);

Beat:
cb=cb+1;
rx1=if(cb%5,rx1,if(below(abs(rx-rx1),.3),rx1+pi/2*sign(getosc(0,0,0)),rx1));
ry1=if(cb%3,ry1,if(below(abs(ry-ry1),.3),ry1+pi/2*sign(getosc(0.1,0,0)),ry1));
rz1=if(cb%2,rz1,if(below(abs(rz-rz1),.3),rz1+pi/2*sign(getosc(0.2,0,0)),rz1));
col=-col;

Point:
y=if(above(h,w),y*af,y);x=if(above(w,h),x*af,x);
dx1=x*cz-y*sz;dy1=x*sz+y*cz;
dy2=dy1*cx-sx;dz2=dy1*sx+cx;
dx3=dx1*cy-dz2*sy;dz2=dx1*sy+dz2*cy;

dx1=sqr(dx3);dy1=sqr(dy2);dz1=sqr(dz2);
mtx=dx3*ox;mty=dy2*oy;mtz=dz2*oz;

¤cylinder on z-axis;
a=2*(dx1+dy1);
b=2*(mtx+mty);
c=sqr(ox)+sqr(oy)-sqr(rad);
D=sqr(b)-2*a*c;
k1=(-b+sqrt(abs(D)))/a;

k1=if(below(D,0),1000,k1);

¤cyliner along y-axis;
a=2*(dx1+dz1);
b=2*(mtx+mtz);
c=sqr(ox)+sqr(oz)-sqr(rad);
D=sqr(b)-2*a*c;
k2=(-b+sqrt(abs(D)))/a;
k2=if(below(D,0),1000,k2);

¤cyliner along x-axis;
a=2*(dy1+dz1);
b=2*(mty+mtz);
c=sqr(oy)+sqr(oz)-sqr(rad);
D=sqr(b)-2*a*c;
k3=(-b+sqrt(abs(D)))/a;

k3=if(below(D,0),1000,k3);

k4=(2-ox)/dx3;
k5=(2-oy)/dy2;
k6=(2-oz)/dz2;

k4=if(below(k4,0),(-ox-2)/dx3,k4);
k5=if(below(k5,0),(-oy-2)/dy2,k5);
k6=if(below(k6,0),(-oz-2)/dz2,k6);

k=min(min(k4,k5),k6);
k=max(k,max(max(k1,k2),k3));

ix=k*dx3+ox;iy=k*dy2+oy;iz=k*dz2+oz;

x=if(equal(k,k1),ix,if(equal(k,k2),ix,iy));
y=if(equal(k,k1),iz,if(equal(k,k2),iy,ix));
y=if(equal(k,k4),iy,y);
y=if(bor(equal(k,k5),equal(k,k6)),iz,y);
y=if(equal(k,k6),iy,y);
x=if(equal(k,k4),iz,x);
x=if(bor(equal(k,k5),equal(k,k6)),ix,x);
dx1=if(equal(k,k1)+equal(k,k2)+equal(k,k3),1,-1);

x=abs(asin(sin(x*pi*.5))*2/pi)*col*dx1;
y=abs(asin(sin(y*pi*.5))*2/pi)*col*dx1;
d=sqr(ix-ox)+sqr(iy-oy)+sqr(iz-oz);
alpha=4/(d+1)*bnot(equal(k,1000));

http://home.iitb.ac*****~shreyaspotnis
shreyas_potnis is offline   Reply With Quote