![]() |
#81 |
Whacked Moderator
Join Date: Jun 2001
Posts: 2,104
|
AVS axer: actually no. The line below the one you 'corrected' uses atan to imitate atan2. Therefore it should still be "You can imagine atan2 to be the same as this...." ('this' refers to that line of code).
|
![]() |
![]() |
![]() |
#82 |
Member
Join Date: Feb 2003
Location: Ozshtrayleeuh
Posts: 98
|
Sorry, i should have checked with yu first... i thought 'this' was referring to the bit above, not the bit below..
|
![]() |
![]() |
![]() |
#83 |
Major Dude
Join Date: Feb 2002
Location: home
Posts: 1,318
|
percent value
ll : lower limit
hl : higher limit val : value (val-ll)/(hl-ll) gives a number between 0 and 1 for a number between the lower limit and the higher limit. Stoke me a clipper. I'll be back for Christmas. - Arnold Rimmer Red Dwarf |
![]() |
![]() |
![]() |
#84 |
Major Dude
Join Date: Nov 2002
Location: Arnhem, the Netherlands
Posts: 927
|
is that equal to:
(0.5*sin(val)+1) ? |
![]() |
![]() |
![]() |
#85 |
Major Dude
Join Date: May 2003
Location: Australia
Posts: 1,353
|
uh, no.. not at all
his method keeps the scale linear. (0.5*sin(val)+1) would return a soinsoid of val between 0 and 1. in other words it loops, and doesnt really produce a version of the variable 'val'. (val-ll)/(hl-ll) would return val exactly, only scaled between 1 and 0, instead of high limit and low limit. The variable remains linear |
![]() |
![]() |
![]() |
#86 |
Major Dude
Join Date: Nov 2002
Location: Arnhem, the Netherlands
Posts: 927
|
ok thank you
|
![]() |
![]() |
![]() |
#87 |
Major Dude
Join Date: May 2003
Location: Australia
Posts: 1,353
|
I came up with this a while back and have been usingit heaps, thought it might be useful to everyone out there.
This converts hue,sat,lum color mode to r,g,b. So you can have more control over your color coding in superscopes. all hue sat and lum values are between 0 and 1. Hue, follows red-> green-> blue in 1/3 sections. For all those who dont know, hue is the color, sat is the intensity of that color, and lum is the amount of black(0) or white(1) in that colour. As you can imagin, the code is VERY useful, but unfortunatly isnt as small as one would like, it takes up 11 variables!!, i might be able to make that 8 but its tricky. code: |
![]() |
![]() |
![]() |
#88 |
Major Dude
|
hsv to rgb, fast version
init: tpi=acos(-1)*2; pit=tpi/6; tpit=pit*2; pixel: sat2=sat*0.5; hue2=hue*tpi; red=abs(sin(hue2))*sat2+lum; green=abs(sin(hue2+pit))*sat2+lum; blue=abs(sin(hue2+tpit))*sat2+lum; batman |
![]() |
![]() |
![]() |
#89 |
Major Dude
Join Date: May 2003
Location: Australia
Posts: 1,353
|
nice work!! few problems with it obviously, cuz its simplifying a complicated process into only a few lines. luminuesence isnt scalar, nor is it dithered between colours correctly. Same deal with saturation. for example, 0 lum should make it black regarless.
all values should be between 0-1, or something else as long as it is finite. And the line 'hue2=hue*tpi' should be just hue*pi. Im gonna use your code when i just need a nice color fading code, but ill stick with the other way for accuracy. |
![]() |
![]() |
![]() |
#90 |
Major Dude
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
|
i already used some of such code in the flow contest to make the ssc
![]() http://home.iitb.ac*****~shreyaspotnis |
![]() |
![]() |
![]() |
#91 |
Forum King
|
actually, that "fast" version isn't nearly correct, but it's a comparatively good approximation, and you get more proverbial bang for your buck
![]() "guilt is the cause of more disauders than history's most obscene marorders" --E. E. Cummings |
![]() |
![]() |
![]() |
#92 |
Senior Member
Join Date: Nov 2002
Location: Australia
Posts: 190
|
Ozshtrayleeuh --- Repra - zent
|
![]() |
![]() |
![]() |
#93 |
Major Dude
Join Date: May 2003
Location: Australia
Posts: 1,353
|
a big w00t to that sir.
|
![]() |
![]() |
![]() |
#94 |
Forum King
|
a big 57f|_| to that sir.
visag, i'm going to tell you this one last time. STOP MAKING THOSE FUCKING RANDOM POSTS ![]() "guilt is the cause of more disauders than history's most obscene marorders" --E. E. Cummings |
![]() |
![]() |
![]() |
#95 |
Senior Member
Join Date: Nov 2002
Location: Australia
Posts: 190
|
Good to hear from you Atero. I've missed your highly inteligent attempts at abuse for things that have nothing to do with you
![]() Your attempt to inveigle me not to post "randomly" might be founded if they were actually "random". Odviously resorting to colourful language one may pick up from a seedy back alley where crack cocaine and "Hoes" may be obtained, is a fitting way of showing your dissapreciation for things you don't understand ![]() Not to worry I have found an old dusty copy of the "Big ol' fun book of psychiatric experts, ways to help individuals not make fools of themselves .. written by Dr. Phil" which i could post you. A great read which I admit changed my life when I was an abusive, sexually frustrated, introvertedly sadistic egotist myself. There is hope ! moving along.. N E Way .. I have finnished my work now and I am a free man again. Unleashed from my bindings of the working class. I am once again umonkst the frey of self indulgence to do what ever I please. A very interesting thread this one I have seen alot which is of good use to me. Repra - Zent Siddhartha_1 All the Adeladians in tha house [img]http://www.educo*****b_zahran/images/en_australie/prace/adelaide_small.jpg[/img] |
![]() |
![]() |
![]() |
#96 |
Forum King
|
no where did i put that "ban him" screenshot...
gd material belongs in gd, KEEP IT THERE. ![]() "guilt is the cause of more disauders than history's most obscene marorders" --E. E. Cummings |
![]() |
![]() |
![]() |
#97 |
Major Dude
Join Date: May 2003
Location: Australia
Posts: 1,353
|
an interlect which we will probably never uinderstand.
atero, the king off being pissed off at whatever is happening anywhere. The cunning smarts of posting a useless message to inform someone that they have posted a useless message. If that isnt the most intelegent thing you have ever seen, please post and tell me what is. But i wont chack on GD, so post it here! HAHA! sigh |
![]() |
![]() |
![]() |
#98 | |
Major Dude
Join Date: May 2003
Location: Australia
Posts: 1,353
|
i posted this on another thread, and thought it should go here:
Quote:
|
|
![]() |
![]() |
![]() |
#99 |
Forum King
|
which is, afaik, not true. put the top slidebar all the way to the left and you get rgb, put the second slidebar all the way to the left and you get low contrast, fast cycling pallettes. check out my post in the "Laser? WTF?" thread
"guilt is the cause of more disauders than history's most obscene marorders" --E. E. Cummings |
![]() |
![]() |
![]() |
#100 |
Forum King
Join Date: Dec 2002
Location: Manchester
Posts: 6,470
|
Lets try to keep this thread for tips and tricks about avs and not about how atero has pms and how visag posts random stuff. Really, who cares? And if they do, why? Is there something wrong with their brain that means they have to get pissed off at the slightest fault. Atero, it's not the end of the world if theres one random post. Sometimes random posting is funny. Theres no need to go all anal and be the hitler of the forum. Now... avs...
Oh yeah, nice to see you back visag, try not to provoke him too much. ![]() |
![]() |
![]() |
![]() |
#101 |
Major Dude
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
|
RGB - HSL
Convert the RBG values to the range 0-1 Example: from the video colors page, colorbar red has R=83%, B=7%, G=7%, or in this scale, R=.83, B=.07, G=.07 Find min and max values of R, B, G In the example, maxcolor = .83, mincolor=.07 If the max and min colors are the same (ie the color is some kind of grey), S is defined to be 0, and H is undefined but in programs usually written as 0 Otherwise, L = (maxcolor + mincolor)/2 For the example, L = (.83+.07)/2 = .45 Test L. If L < 0.5, S=(maxcolor-mincolor)/(maxcolor+mincolor) If L >=0.5, S=(maxcolor-mincolor)/(2.0-maxcolor-mincolor) For the example, L=0.45 so S=(.83-.07)/(.83+.07) = .84 If R=maxcolor, H = (G-B)/(maxcolor-mincolor) If G=maxcolor, H = 2.0 + (B-R)/(maxcolor-mincolor) If B=maxcolor, H = 4.0 + (R-G)/(maxcolor-mincolor) For the example, R=maxcolor so H = (.07-.07)/(.83-.07) = 0 To use the scaling shown in the video color page, convert L and S back to percentages, and H into an angle in degrees (ie scale it from 0-360) HSL - RGB If S=0, define R, G, and B all to L Otherwise, test L. If L < 0.5, temp2=L*(1.0+S) If L >= 0.5, temp2=L+S - L*S In the colorbar example for colorbar green, H=120, L=52, S=79, so converting to the range 0-1, L=.52, so temp2=(.52+.79) - (.52*.79) = .899 temp1 = 2.0*L - temp2 In the example, temp1 = 2.0*.52 - .899 = .141 Convert H to the range 0-1 In the example, H=120/360 = .33 For each of R, G, B, compute another temporary value, temp3, as follows: for R, temp3=H+1.0/3.0 for G, temp3=H for B, temp3=H-1.0/3.0 if temp3 < 0, temp3 = temp3 + 1.0 In the example, Rtemp3=.33+.33 = .66, Gtemp3=.33, Btemp3=.33-.33=0 For each of R, G, B, do the following test: If 6.0*temp3 < 1, color=temp1+(temp2-temp1)*6.0*temp3 Else if 2.0*temp3 < 1, color=temp2 Else if 3.0*temp3 < 2, color=temp1+(temp2-temp1)*((2.0/3.0)-temp3)*6.0 In the example, 3.0*Rtemp3 < 2 so R=.141+(.899-.141)*((2.0/3.0-.66)*6.0=.141 2.0*Gtemp3 < 1 so G=.899 6.0*Btemp3 < 1 so B=.141+(.899-.141)*6.0*0=.141 Scale back to the range 0-100 to use the scaling shown in the video color page For the example, R=14, G=90, B=14 Found on the net ![]() http://home.iitb.ac*****~shreyaspotnis |
![]() |
![]() |
![]() |
#102 |
Forum King
|
it'd be quite a bit more useful if you could link us to the page...
"guilt is the cause of more disauders than history's most obscene marorders" --E. E. Cummings |
![]() |
![]() |
![]() |
#103 |
Major Dude
Join Date: May 2003
Location: Australia
Posts: 1,353
|
hang on,
what use is RGB-HSL if the only time you ever get to specify colours in code form is in the superscope, where you can only use RGB for output. also, your HSL-RGB code is exactly the same as given above, only mine was already coded for avs. |
![]() |
![]() |
![]() |
#104 |
Forum King
|
well, axer, that's probably because they use the same algorithm
![]() "guilt is the cause of more disauders than history's most obscene marorders" --E. E. Cummings |
![]() |
![]() |
![]() |
#105 |
Major Dude
Join Date: May 2003
Location: Australia
Posts: 1,353
|
that was kinda the point atero... they both use the HSL-RGB algorithm... so why post it twice?
you follow? |
![]() |
![]() |
![]() |
#106 |
Forum King
|
whereas your algorithm was compiled (sorta), and shreyas's post explained it in detail.
and...afaik there is only one hsl/rgb algorithm. excepting sat={1,0} and lum={1,0}, it's a one-to-one function "guilt is the cause of more disauders than history's most obscene marorders" --E. E. Cummings |
![]() |
![]() |
![]() |
#107 |
Major Dude
Join Date: May 2003
Location: Australia
Posts: 1,353
|
well, thats not entirely true, there are many different ways of alligning the hue value to show as loop from 0-1.
It is not neccessarily correct to have red, green or blue in any order, (although it is normally R-G-B). Also, most methods use sine to 'shape' the scale. The one me and shreyas used doesnt, it just uses linear 1/3's. |
![]() |
![]() |
![]() |
#108 |
Major Dude
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
|
Conding the algo in AVS sort of makes it a bit more complicated, so I just posted the algo here. No need to post the link, as I have copied whatever was preset on the page
![]() http://home.iitb.ac*****~shreyaspotnis |
![]() |
![]() |
![]() |
#109 |
Major Dude
Join Date: May 2003
Location: Australia
Posts: 1,353
|
ok
|
![]() |
![]() |
![]() |
#110 |
Forum King
|
and...look at your hsl colorpicker some time. does it look like it has a sinusoidal interpolation? no, i'm afraid it doesn't. and what do you see when h=0? red. h=240? red. that's just the way it is, i'm sorry....
"guilt is the cause of more disauders than history's most obscene marorders" --E. E. Cummings |
![]() |
![]() |
![]() |
#111 |
Major Dude
Join Date: May 2003
Location: Australia
Posts: 1,353
|
rightyo.. enough on this please
|
![]() |
![]() |
![]() |
#112 |
Major Dude
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
|
Metaballs dm, I made it some time ago:
code: I am quite happy with the end results, dunno if its done before. http://home.iitb.ac*****~shreyaspotnis |
![]() |
![]() |
![]() |
#113 |
Bin King
Join Date: Mar 2001
Location: Finland
Posts: 2,179
|
shift per pixel
A simple trick for advanced avsers.
To shift a scope by pixel. X-axis xt=xt+(#/w)*2 Y-axis yt=yt+(#/h)*2 #=ammount of pixels skipped. 1=none , 0=no movement Example: per frame xt=xt+(2/w)*2 ; per pixel y=i*2-1 ; x=if(above(xt,1),-1,xt) This will shift your scope by skipping every other line. code: Notice that if you want to skip 2 pixels, you don't use 2 you use 3. A way of "remembering" it is to write it like this: xt=xt+(#/w)*2+2/w 2/w adds the extra pixel, so that what ever number you use in # it will skip that ammount of pixels. Of course it's better to use straight up higher number, but it's just for convenience. example: xt=xt+(3/w)*2+2/w Will move the scope like this: code: Notice also that shifting per pixel won't work with sin&cos, only when you apply it directly to the scope movement it will work, you can use the if functions to limit the movement of the scope or to make it warp to the otherside once it reaches the end. |
![]() |
![]() |
![]() |
#114 |
Major Dude
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
|
A very neat trick to darken the colours a little bit.
use an effect list with input replace and outpuit multiply. this will squrare the colours. as rgb are 0....1 then if RGB are not 0 or 1 their squares will be less than the original numbers! http://home.iitb.ac*****~shreyaspotnis |
![]() |
![]() |
![]() |
#116 |
Major Dude
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 |
![]() |
![]() |
![]() |
#117 |
Forum King
|
Those DMs could use some optimisation. Remember that putting things in if statements means that both results are calculated so for instance:
x=if(equal(k,k4)+equal(k,k5),abs(x)*col,-abs(x)*col); should be x=if(equal(k,k4)+equal(k,k5),1,-1)*abs(x)*col; one less abs and one less * than before. |
![]() |
![]() |
![]() |
#118 |
Junior Member
|
There are anywhere "TipsTricks in AVS" for german people!?^^
who know some... thx |
![]() |
![]() |
![]() |
#119 |
Forum King
|
nein, keine "Tips and tricks" für deutsche.
|
![]() |
![]() |
![]() |
#120 |
Junior Member
|
och warumn ni!?
da müsste sich mal einer ransetzen...^^ und... nein ich werd das nicht sein! löl |
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|