Skip to content

Commit

Permalink
Faster filter by simplifying cos(ang), and sin(ang)
Browse files Browse the repository at this point in the history
  • Loading branch information
Reptorian1125 committed Sep 1, 2020
1 parent 7caca4a commit 551965f
Showing 1 changed file with 31 additions and 17 deletions.
48 changes: 31 additions & 17 deletions include/reptorian.gmic
Expand Up @@ -64,11 +64,11 @@ rep_pfrac: rep_popcorn_fractal $*
rep_popcorn_fractal:
skip ${1=50},${2=1},${3=.05},${4=3},${5=1},${6=0},${7=0},${8=0},${9=0},${10=},${11=},${12=},${13=},${14=},${15=}
if ($6-360*floor($6/360))?1
fvx="((rot_x(xnew,ynew)-origin_x*sx)*cx/zoom+cx*sx)/sx"
fvy="((rot_y(xnew,ynew)-origin_y*sy)*cy/zoom+cy*sy)/sy"
fvx="((rot_x(xnew,ynew)-osx)*cx_zoom+cxsx)/sx"
fvy="((rot_y(xnew,ynew)-osy)*cy_zoom+cysy)/sy"
else
fvx="((xnew-origin_x*sx)*cx/zoom+cx*sx)/sx"
fvy="((ynew-origin_y*sy)*cy/zoom+cy*sy)/sy"
fvx="((xnew-osx)*cx_zoom+cxsx)/sx"
fvy="((ynew-osy)*cy_zoom+cysy)/sy"
fi
channels. 0 f. 0
l.
Expand All @@ -86,12 +86,18 @@ l.
const sy=w>h?1:sd;
const cx=w/2;
const cy=h/2;
const ocx=origin_x*cx;
const ocy=origin_y*cy;
const osx=origin_x*sx;
const osy=origin_y*sy;
const cx_zoom=cx/zoom;
const cy_zoom=cy/zoom;
const cxsx=cx*sx;
const cysy=cy*sy;
const cos_ang=cos(ang);
const sin_ang=sin(ang);
const angcondition=($6-360*floor($6/360))?1;
const total_pts=wh*pts;
rot_x(a,b)=a*cos(ang)-b*sin(ang);
rot_y(a,b)=a*sin(ang)+b*cos(ang);
rot_x(a,b)=a*cos_ang-b*sin_ang;
rot_y(a,b)=a*sin_ang+b*cos_ang;
fvx()="$fvx";
fvy()="$fvy";
count=0;
Expand Down Expand Up @@ -3591,8 +3597,10 @@ f "begin(
const offy=-.5+($16*-1/2);
const nw=abs(w*sin(ang))+abs(h*cos(ang));
const nh=abs(w*cos(ang))+abs(h*sin(ang));
rot_x(a,b)=a*cos(ang)-b*sin(ang);
rot_y(a,b)=a*sin(ang)+b*cos(ang);
const cos_ang=cos(ang);
const sin_ang=sin(ang);
rot_x(a,b)=a*cos_ang-b*sin_ang;
rot_y(a,b)=a*sin_ang+b*cos_ang;
const interpolation=abs($18)>2?2:abs($18);
const boundary=abs($17);
);
Expand Down Expand Up @@ -3823,10 +3831,14 @@ repeat $! l[$>]
const ang=pi*($8/180);
const dang=pi*($12/180);
const distrad=1*10^($2/10);
rot_x(a,b)=a*cos(ang)-b*sin(ang);
rot_y(a,b)=a*sin(ang)+b*cos(ang);
dist_rot_x(a,b)=a*cos(dang)-b*sin(dang);
dist_rot_y(a,b)=a*sin(dang)+b*cos(dang);
const cos_ang=cos(ang);
const sin_ang=sin(ang);
const cos_dang=cos(dang);
const sin_dang=sin(dang);
rot_x(a,b)=a*cos_ang-b*sin_ang;
rot_y(a,b)=a*sin_ang+b*cos_ang;
dist_rot_x(a,b)=a*cos_dang-b*sin_dang;
dist_rot_y(a,b)=a*sin_dang+b*cos_dang;
sq2(a,b)=sqrt(a^2+b^2);
const sd=max(w,h)/min(w,h);
const sx=w>h?sd:1;
Expand Down Expand Up @@ -4085,8 +4097,10 @@ skip ${2=0},${3=0},${4=0}
f "
begin(
ang=pi*($4/180);
rot_x(a,b)=a*cos(ang)-b*sin(ang);
rot_y(a,b)=a*sin(ang)+b*cos(ang);
const cos_ang=cos(ang);
const sin_ang=sin(ang);
rot_x(a,b)=a*cos_ang-b*sin_ang;
rot_y(a,b)=a*sin_ang+b*cos_ang;
const blur=(round(abs($2)+1)-1)*2+3;
const qblur=sqr(blur);
const eblur=floor(blur/2);
Expand Down Expand Up @@ -8424,7 +8438,7 @@ gui_split_preview "gui_rep_acb $*",${-3--1}
#@gui :_=separator()
#@gui :_=note("<b>Fractal Calculation Constraints</b>")
#@gui :_=note("<small>Information at bottom of filter. Some predefined formulas requires you to use low values. You may need to type in values from 5-1024 manually.</small>")
#@gui :Escape Value=int(10000,5,1000000)
#@gui :Escape Value=int(10000,5,3000000)
#@gui :Loop Limitation=int(255,1,1024)
#@gui :Subsampling Level=float(3,1,10)
#@gui :_=separator(), _=note("<b>Distortion Factors</b>")
Expand Down

0 comments on commit 551965f

Please sign in to comment.