Logo by jwm-art - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Check out the originating "3d Mandelbulb" thread here
 
*
Welcome, Guest. Please login or register. April 27, 2024, 03:09:10 AM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Trying to Make an Apophysis Mandelbulb Script  (Read 1846 times)
Description: Ah, scripting.
0 Members and 1 Guest are viewing this topic.
crotafang
Guest
« on: May 04, 2010, 12:43:54 AM »

Hello all,

I'm new to Apo scripting, and I've started practicing scripting in Apophysis 7X.

I remember seeing the formulas for the Mandelbulb.  And I know it sounds crazy, but I have been trying to see if I can make a Mandelbulb script in Apophysis.  It's been difficult so far, and what I've done so far only freezes Apo.  embarrass  Here's what I've got so far:

with Transform do
begin
A := 0 ;
Weight := 0.5 ;
Color := 1 ;
end;       

x := 0;
y := 0;
z := 0;
r := sqrt(x*x + y*y + z*z);
alpha := arctan2(sqrt(x*x + y*y), z);
beta := arctan2(y, x);       
mand := [x, y, z];
while (x*x + y*y + z*z < 2.0) do
begin
  newx := (r*r) * sin( alpha*2 + 0.5*PI) * cos(beta*2 +PI);     
  newy := (r*r) * sin( alpha*2 + 0.5*PI) * sin(beta*2 +PI);
  newz := (r*r) * cos( alpha*2 + 0.5*PI);
  mand := [(x*(x+y+z) + newx), (y*(x+y+z) + newy), (z*(x+y+z) + newz)];
end;                                                         

I think I divided by zero somewhere and I don't know how to correct for that in Apophysis.  I know that basically, you have to have some sort of coordinate for when one of the valuables is zero, but I don't know how to properly do if, else statements in Apo scripting.  Maybe I should try this in Apo 2.08 3D first.  (shrug) I don't know, what do you guys think?

Sincerely,
crotafang
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #1 on: May 05, 2010, 12:56:06 AM »

as a starter, you could try out the far more simple mandelbox method as transformation wink
Logged

---

divide and conquer - iterate and rule - chaos is No random!
crotafang
Guest
« Reply #2 on: May 06, 2010, 04:01:07 AM »

Alright then.  I'll do that.  And if and when I succeed, I'll post the result.
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #3 on: May 06, 2010, 09:56:49 AM »

do that, i am excited cheesy
Logged

---

divide and conquer - iterate and rule - chaos is No random!
Dinkydau
Fractal Senior
******
Posts: 1616



WWW
« Reply #4 on: July 01, 2010, 10:36:18 PM »

Have you got something already? It would be awesome to use such a fractal in Apophysis.
Logged

crotafang
Guest
« Reply #5 on: July 08, 2010, 08:46:55 PM »

Well I tried to do a Mandelbox, and this is what I have so far.  It doesn't have "errors", but it doesn't yield a Mandelbox at all.  I got the formulas down, but I don't know how to properly apply them to the transforms.  I'm using the Apophysis scripting which used Scripter Studio, which is based on Pascal.
program mandelbox;

var r, m, x, y, z;
with transform do
begin
linear3d := 0.75;
for k := 1 to 100 do
r := 0.5;            
x := random;
y := random;  
z := random;  


v := [x,y,z];
v[0] := x;
v[1] := y;
v[2] := z;
m := x*x + y*y + z*z;                                      
for i := 0 to 2 do                        
  begin
  addtransform;
  with transform do
  begin
  for x := -100 to 100 do
  begin
  for y := -100 to 100 do
  begin
  for z := -100 to 100 do
  begin
    if (v[ i ] > 1) then                      
      begin                                
        v[ i ] := 2 - v[ i ];
        if m < r then m := m /(r*r);
        else if m < 1 then m := 1 /(m*m);
        for j := 0 to 2 do
        begin        
          v[j] := 2*v[j];
        end;
        AddTransform;
        with transform do
        begin
          linear3D := 0.75;
          Translate(v[0],v[1]);
          ztranslate := v[2];
        end;
      end;                            
    else if (v[ i ] < -1) then
      begin
        v[ i ] := -2 - v[ i ];
        if m < r then m := m /(r*r);
        else if m < 1 then m := 1 /(m*m);
        v := 2*m;
        for j := 0 to 2 do
        begin
          v[j] := 2*v[j];
        end;
        AddTransform;
        with Transform do
        begin
          linear3D := 0.75;
          Translate(v[0],v[1]);
          ztranslate := v[2];
        end;
      end;
  end;        
  end;
  end;
  end;
  end;
end;

How do I apply a mathematical formula to a transform?
« Last Edit: July 08, 2010, 10:11:49 PM by crotafang, Reason: Italics where italics shouldn\'t be » Logged
Xazo-Tak
Navigator
*****
Posts: 77



« Reply #6 on: September 05, 2011, 11:39:11 PM »

Can you put it into electricsheep? If so, I WANTS IT.
Logged

I lost the game!
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #7 on: January 05, 2012, 08:32:52 PM »

Well Mandelbox looks awesome when it's solid, not faded away like in Apo flames. wink Also Apo's folds are probabilistic and you should do deterministic ones instead to make the shapes more clear
Logged

No sweat, guardian of wisdom!
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Used Mandelbulb 3D to make this vid. Movies Showcase (Rate My Movie) crotafang 0 1115 Last post July 21, 2010, 12:06:00 AM
by crotafang
YES! A Mandelbulb in Apophysis!!! Images Showcase (Rate My Fractal) « 1 2 » crotafang 28 9626 Last post September 22, 2013, 05:51:49 AM
by vaheed pall
Apophymator: Apophysis script Apophysis Programs Apophyster 3 10749 Last post February 20, 2013, 10:21:04 AM
by Apophyster
Mandelbulb help! How to make it look like chrome? Help & Support Dunning Kruger 2 298 Last post June 24, 2013, 03:32:54 PM
by Sitting Duck
Apophysis Script Syntax Programming pswanson 0 3432 Last post June 29, 2017, 11:28:31 PM
by pswanson

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.4 seconds with 24 queries. (Pretty URLs adds 0.011s, 2q)