Logo by Fiery - 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. March 28, 2024, 02:33:18 PM


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: New shapes in primitives.cpp  (Read 1328 times)
0 Members and 1 Guest are viewing this topic.
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« on: March 05, 2015, 11:33:21 AM »

I haven't tested those routines.
 embarrass
Torus (customized); cheesy

Code:
double PrimitiveTorus(CVector3 point, CVector3 center, double radius1, double radius2, boolean Squarry1, boolean Squarry2)
{
        CVector3 ptc = point - center;
        double cyl = 0;
        if (Squarry1==true) { cyl = max(ptc.x,ptc.y);} else { cyl = hypot(ptc.x,ptc.y);}
        double distance = -radius2;
        if (Squarry2==true) { distance += max(radius1-cyl ,ptc.z);} else { distance += hypot(radius1-cyl ,ptc.z);}
        return distance;
}

Cylinder (customized); cheesy

Code:
double PrimitiveCylinder(CVector3 point, CVector3 center, double barrel, double cone, double radius, double height)
{
        CVector3 ptc = point - center;
        double cyl = hypot(ptc.x,ptc.y);
        cyl += (barrel*ptc.z + cone)*ptc.z/(1.+fabs(barrel)+fabs(cone));
        double distance = max(cyl - radius  , fabs(ptc.z) - height);
        return distance;
}
« Last Edit: March 05, 2015, 02:47:02 PM by DarkBeam » Logged

No sweat, guardian of wisdom!
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #1 on: March 05, 2015, 12:20:54 PM »

Cylindrical wave cheesy

Code:
double PrimitiveSimpleWater(CVector3 point, double height, double amplitude1, double amplitude2, double rotation, int nangwave, double animSpeed, int frame)
{
        CVector3 plane(0,0,-1);
        CVector3 centre(0,0,height);
        plane.Normalize();
        CVector3 ptc = point - center;
        double planeDistance = plane.Dot( ptc );
        if(planeDistance < max(amplitude1,amplitude2) * 10.0)
        {
                CRotationMatrix rotMatrix;
                rotMatrix.RotateZ(rotation/180*M_PI);
                point = rotMatrix.RotateVector(point);

                double phase = animSpeed * frame;
                double dorig = hypot(ptc.x,ptc.y);
                double waveX = sin(phase  +  dorig ); // interesting to add another phase and try to multiply dorig by something
                double waveY = sin(phase  + nangwave*atan2(ptc.y,ptc.x)); // interesting to add another phase
                waveY = waveY*(1.-1./(1.+dorig)); // less perturbed in the center
                planeDistance += amplitude1*waveX + amplitude2*waveY;
                // interesting to add another wave (interference effect) ... etc
        }

        return planeDistance;
}
« Last Edit: March 05, 2015, 12:30:15 PM by DarkBeam » Logged

No sweat, guardian of wisdom!
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #2 on: March 05, 2015, 12:48:13 PM »

Supershape (to be converted!)

http://www.fractalforums.com/general-discussion-b77/supershape-as-an-isosurface/msg80070/#msg80070

Knot (to be converted!) - only Knighty's routine, more general


http://www.fractalforums.com/index.php?topic=10072.msg40636#msg40636
« Last Edit: March 05, 2015, 02:49:34 PM by DarkBeam » Logged

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

Related Topics
Subject Started by Replies Views Last post
IFS from graphic primitives Fragmentarium Alef 0 1435 Last post January 28, 2013, 04:43:07 PM
by Alef
Playing with Primitives Mandelbulber Gallery mclarekin 0 706 Last post December 28, 2014, 05:02:08 AM
by mclarekin
Fractal Flotsam - Pseudo Primitives Mandelbulber Gallery mclarekin 0 866 Last post January 15, 2015, 08:22:32 AM
by mclarekin
Aexion in a Bowl: Primitives Example 1 Hacked Mandelbulber Gallery paigan0 0 713 Last post April 24, 2017, 10:25:25 PM
by paigan0
Primitives : Align plane / water to view Feature Requests Kyzia 2 1406 Last post July 16, 2017, 09:39:22 PM
by Kyzia

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.513 seconds with 29 queries. (Pretty URLs adds 0.062s, 2q)