POV-Ray : Newsgroups : povray.general : Fitting a gothic trefoil into an equilateral triangle : Re: Fitting a gothic trefoil into an equilateral triangle Server Time
5 Nov 2024 07:20:21 EST (-0500)
  Re: Fitting a gothic trefoil into an equilateral triangle  
From:
Date: 12 Jun 2003 23:51:10
Message: <3ee94a2e$1@news.povray.org>
// Hi LibraryMan,
//
// here is some code for you to play with; the radius of the circles
// can be specified:
//
//    Side * (sqrt(3)-1)/4   circles are mutually touching
//    Side * sqrt(3)/9       circles intersect in midpoint ("true gothic")
//    Side * sqrt(3)/6       circles have max. size (all are equal)
//
// The distance of the centers (distance AB as named in your link) is
//
//    Side-2*sqrt(3)*Radius
//
//
//
// Sputnik
//
//
// ----------------------------

// fr### [at] computermuseumfh-kielde
// ----------------------------


// +W640 +H480 -F +D +A0.1

// macro for trefoil ====================================================

#macro Trefoil (Side, Radius) // lower left corner at origin

  #local R = 0.005; // "Linewidth"/2

  #local Height  = sqrt(3)/2*Side;

  #local Corner1 = <Side/2, Height, 0>; // top corner
  #local Corner2 = 0; // bottom left corner
  #local Corner3 = Side*x; // bottom right corner

  #local Center  = <Side/2, Height/3, 0>; // triangle

  #local Center1 = <Side/2, Height-2*Radius, 0>; // top circle
  #local Center2 = <sqrt(3)*Radius, Radius, 0>; // bottom left circle
  #local Center3 = <Side-sqrt(3)*Radius, Radius, 0>; // bottom right circle

  union {
    union {
      sphere { Corner1, R }
      sphere { Corner2, R }
      sphere { Corner3, R }
      cylinder { Corner1, Corner2, R }
      cylinder { Corner2, Corner3, R }
      cylinder { Corner3, Corner1, R }
      texture { pigment { color green 1 } finish { ambient 1 } }
      }
    union {
      torus { Radius, R rotate 90*x translate Center1 }
      torus { Radius, R rotate 90*x translate Center2 }
      torus { Radius, R rotate 90*x translate Center3 }
      texture { pigment { color red 1 } finish { ambient 1 } }
      }
    // "}" omitted to allow application of transformations

  #end//macro Trefoil


// simple scene with trefoils ===========================================

Trefoil ( 1  , 1*(sqrt(3)-1)/4 ) translate <-1.6,  0.2  , 1> } // small
Trefoil ( 2  , 2*sqrt(3)/9     ) translate <-1  , -1    , 1> } // gothic
Trefoil ( 1  , 1*sqrt(3)/6     ) translate < 0.6,  0.2  , 1> } // large

light_source { <-1500, 2500, -2000>, color rgb 1 }

camera { orthographic up 3*y right 4*x }


// END ==================================================================


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.