D. Edward Mitchell 16:00, 14 April 2020 (UTC) Hello World!    groupKOS Developer Share —usually UNDER CONSTRUCTION

File:Ring amp 3-phase orthogonal 13-8 torus knots 1024x768.png

From groupKOS Developer Share
Jump to navigation Jump to search
Original file(1,024 × 768 pixels, file size: 457 KB, MIME type: image/png)

Summary

Three sets of 13:8 (p:q) torus knots on a white surface.

An abstract POV-Ray rendering ©Don aght groupKOS doght cφm.


// Persistence of Vision Ray Tracer Scene Description File
// File: Groupkos.dev.ring_amp_phase-A_orthogonal_13-8_torus_knots_1024x768.png
// POV-Ray Vers: 3.7 RC7 win64

// Desc: 13:8 torus knots as copper tubing.
// Date: May 1, 2013
// Auth: DonEMitchell (C) 
// Revisited and reorganized for posting at groupkos.com/dev/category:povray March 9, 2020.
// Edited: March 19, 2020
// Place these characters (without comment slashes) into the command line edit box to activate clocked frames.
// +SF1 +EF3 +KFI1 +KFF3  +W1024 +H768      

#version 3.7;

#include "colors.inc"
#include "golds.inc"
#include "metals.inc"
#include "transforms.inc"
#include "glass.inc"
//#include "push-pull_suspension.inc.pov"

global_settings {
    max_trace_level 10 // Reflection levels before blackness.   
    assumed_gamma 1.2
    charset utf8
    // used in global_settings, sets an overall brightness/ambient light level in the scene
    ambient_light color rgb <1,1,1> * 1
    } 
#default{ finish{ ambient 0.00125 diffuse 0.9 }} 

// ----------------- Optics --------------------
  
#declare cameraDistance     = 29;       // 1920x1080 slanted orthogonal torus knot.
//#declare cameraDistance   =  3;       // 1920x1080 center close-up.

#declare cameraViewAngle    = 54;       // Normal perspective.                                                                 
#declare cameraVector =     <-1,.02,0>;   // Where the camera is located. [x=.02 is used to prevent an odd artifact.]
//#declare cameraVector =     <-1,1,.50>;

#declare cameraLocation = cameraVector*cameraDistance;
#declare cameraLook_At = <0,0,0>;

// #declare consoleTextZoom = 1.325;  // 800x600   3:2    // Used in consoleObject().  Sizes text area to screen area. 
   #declare consoleTextZoom = 1.35; // 1024x1768  3:2    // Used in consoleObject().  Sizes text area to screen area. 
// #declare consoleTextZoom = 1.765; // 1920x1080  3:2    // Used in consoleObject().  Sizes text area to screen area. 
// #declare consoleTextZoom = 2.00765; // 1920x1080  3:2    // John Wsol.

#declare cameraAspectRatio = image_width/image_height;

#declare cameraSky = y;        
#declare cameraDirection=vnormalize(cameraLook_At-cameraLocation);      
#declare cameraRight=vnormalize(vcross(cameraSky,cameraDirection));     // to the right
#declare cameraUp=vnormalize(vcross(cameraDirection,cameraRight));      // camera up
    
camera { 
    //orthographic
    angle cameraViewAngle
    direction cameraDirection
    right cameraRight*cameraAspectRatio
    up cameraUp
    sky cameraSky
    location cameraLocation 
    look_at  0    
}    

#declare cameraTransform =                                              // A vector toward the camera from the origin.
    transform { matrix < 
                    cameraRight.x, cameraRight.y, cameraRight.z,
                    cameraUp.x, cameraUp.y, cameraUp.z,
                    cameraDirection.x, cameraDirection.y, cameraDirection.z,
                    cameraLocation.x, cameraLocation.y, cameraLocation.z
                >
    }

// Define a text-positioning-macro for console text based on camera location (adapted from screen.inc) for facing console text toward the camera. 
#macro consoleObject (Object, Position, Spacing, Confine, Scaling)
   #local Obj_Max = max_extent(Object);
   #local Obj_Min = min_extent(Object);
   #local Obj_Cen = (Obj_Max+Obj_Min)/2;
   #local Obj_Dim = (Obj_Max-Obj_Min)/2;
   #local Pos = (Position-0.5)*2;
   #local Pos = (
      +<Pos.x*cameraAspectRatio/2,Pos.y/2,consoleTextZoom>
      +( -Obj_Cen -Pos*(Obj_Dim+Spacing) ) * Confine
   );
   object {
      Object
      no_shadow     // shouldn't cast shadows in the scene
      no_reflection // shouldn't be reflected in scene elements
      translate Pos
      scale Scaling * 2 
      transform {cameraTransform} // rotate to face camera.
   }
#end

light_source { 
    cameraLocation
    color .9  
    shadowless
    //rotate z*10
    //rotate -x*40
    } 
light_source { 
    cameraLocation
    color 1
    shadowless
    rotate y*40
    rotate x*60
    }
    
sky_sphere{ pigment { gradient <-1,1,-1>
                      color_map { [0.00 rgb <0.6,0.7,1.0>]
                                  [0.35 rgb <0.0,0.1,0.8>]
                                  [0.65 rgb <0.0,0.1,0.8>]
                                  [1.00 rgb <0.6,0.7,1.0>] 
                                } 
                      scale 2         
                    } // end of pigment
}
              
//--------------------------- Macros --------------------------------- 
// Axes macro: length and radii of axes, and boolean flags to include/exclude axes
#macro axes(length, radii, X, Y, Z)                               
    #if (X) cylinder{ 0, < length,         0,       0>, radii texture { pigment { color rgb  < .75,-.1,-.1     > }}} #end //  X axis, red    
    #if (X) cylinder{ 0, <-length,         0,       0>, radii texture { pigment { color rgbt <   1,  0,  0, .6 > }}} #end // -X axis red translucent -adjust xmit                                                          
    #if (Y) cylinder{ 0, <      0,  length/2,       0>, radii texture { pigment { color rgb  < -.1, .5,-.1     > }}} #end //  Y axis, green    
    #if (Y) cylinder{ 0, <      0, -length/2,       0>, radii texture { pigment { color rgbt <   0, .8,  0, .6 > }}} #end //  Y axis, green translucent
    #if (Z) cylinder{ 0, <      0,         0,  length>, radii texture { pigment { color rgb  <   0,  0,  2     > }}} #end //  Z axis, Blue    
    #if (Z) cylinder{ 0, <      0,         0, -length>, radii texture { pigment { color rgbt <  .1, .1, .4, .6 > }}} #end // -Z axis blue translucent     
#end //macro axes()

#macro torusKnotBifilar(ObjectA, ObjectB, major, minor, poloid, toroid, polyphase, loopRadius, delta)
    #declare phz = clock*final_frame/final_frame;
    #declare phz = 1/60;
    union{
        #local  n  = 0;                             // n Is the while loop index.
        #while (n <= (180 * poloid - delta ) )      // Loop only 180 degrees, and draw the ObjectB, below, 180 degrees advanced.
            #local phaz = n * toroid/poloid;        // Divide out poloid (multiplied already into n) to obtain toroidal rotation.
            
            // 1st Bifilar half as ObjectA
            // Print ObjectA along 1st 180 degrees around torus center axis.
            #if( 01 )
                object{ ObjectA
                    // Move the Object away from the origin on the X axis by the minor radius.
                    translate  <minor,0,0>
                    // Toroidally rotate Object around Z axis in the XY plane.
                    rotate <0,0,phaz>
                    // Move the rotated Object the distance of the major radius in the X-axis.    
                    translate <major,0,0>
                    // Rotate the object about the center Y axis of the torus.                                     
                    rotate y*n
                }
             #end
            
            // 2nd Bifilar half as ObjectB (radially symmetric about torus center axis.)
            // Print ObjectB along 2nd 180 degrees around torus center axis.
             #if( 10 )
                object{ ObjectB
                    // Move the Object away from the origin on the X axis by the minor radius.
                    translate  <minor,0,0>
                    // Toroidally rotate Object around Z axis in the XY plane.
                    rotate <0,0,phaz>
                    // Move the rotated Object the distance of the major radius in the X-axis.    
                    translate <major,0,0>
                    // Rotate the object about the center Y axis of the torus.                                     
                    rotate y*n
                    // Advance ObjectB an additional 180 degrees as the other bifilar half.
                    rotate y*180
                }                
            #end
            #local n = n + delta;
        #end
        rotate y*polyphase
    }
#end // macro torusKnotBifilar()
                                          
// ---------------- Scene ------------------------

// 13/8        = 1.625
// Phi         = 1.6180339887498948482045868343656
// Difference  = 1.625 - Phi 
// Difference  = 0.00696601125010515179541316563436
 
// Torus knot parameters (loop/twist) //
#declare poloid = 13; 
#declare toroid = 8; 

// Torus dimensions.                              
#declare Phi = pow(5,.5) * .5 + .5;     // Upper case Phi = 1.618...

#declare PhiIndex   =  4;               // Set the radix of Phi for the major radius.

// Calculate orthogonal major/minor radii.
#declare radiusMajor    =             pow(Phi, PhiIndex     );
#declare radiusMinor    = radiusMajor-pow(Phi, PhiIndex - 4 ); // Four degrees of Phi smaller.
             

#declare radiusConductor = 0.094;       // 3/16" = 0.188/2" OD of 3/16" conductor.
#declare radiusConductor = 0.125/2;     // 1/8"" = 0.188/2" OD of 3/16" conductor.
#declare radiusConductor = 0.1;       // Artistic license.

// Delta as increment between spheres tracing torus loop in the torus knot macro. 
// The knot is a string of overlapping spheres.  Delta sets the separation.
#declare plotDelta = .01;

// Toggle parts of the scene.
#declare showBaseTorus   = 01;
#declare showTorusKnots  = 01;
#declare showConsole     = 0;

#declare showAxes   =  0;
#declare axesRadius = .01;

#declare showPhaseA = 01;
#declare showPhaseB = 01;
#declare showPhaseC = 01;


// Clock the visibility variables for phase one, two, and three.
// If clocking parameters are not present in the command line text-box above the POV-Ray editor (this window)
// then frame_number will equal zero.
#if(frame_number  >= 1)
    #declare showPhaseA = 1;
#end
#if(frame_number  >= 2)
    #declare showPhaseB = 1;
#end
#if(frame_number  =  3)
    #declare showPhaseC = 1;
#end

//#declare 
union{
    //plane{y,0}
    
    // Moebius bifilar torus knots.    
    #if(showTorusKnots) 
        #local cycObjA =  sphere{0,radiusConductor}; // clipped_by{plane{ z,0 rotate x*45}}};
        
                // Render three phases rotated 20 degrees apart //
        union{
            #if(showPhaseA) torusKnotBifilar ( cycObjA, cycObjA, radiusMajor, radiusMinor, poloid, toroid, 0,   radiusConductor, plotDelta) #end
            #if(showPhaseB) torusKnotBifilar ( cycObjA, cycObjA, radiusMajor, radiusMinor, poloid, toroid, 120, radiusConductor, plotDelta) #end
            #if(showPhaseC) torusKnotBifilar ( cycObjA, cycObjA, radiusMajor, radiusMinor, poloid, toroid, 240, radiusConductor, plotDelta) #end
            
            //rotate -y*22.5 // 13:8: rotation aligns the bifilar halves with the scene.
            texture{T_Copper_3C}
        }
    #end // Moebius bifilar torus knots.    
   
    #if(showBaseTorus)
        // Base torus.          
        torus{ radiusMajor,radiusMinor *.994
               texture { T_Silver_5E }
               texture { pigment{rgbt<1,1,0,.975>} } 
               texture { pigment{rgbt<1,1,0,.7>} }   
             //clipped_by{plane{z,0}}
        }
    #end

    #if(showAxes)
        axes(radiusMajor+radiusMinor*4.0, axesRadius,11,11,111)
    #end
     
    rotate -y*10
    rotate z*0  // 90* for polar view, 0* for side.
}

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current13:35, 29 August 2021Thumbnail for version as of 13:35, 29 August 20211,024 × 768 (457 KB)Don (talk | contribs)
  • You cannot overwrite this file.

Metadata