POV-Ray : Newsgroups : povray.general : torus, inward/outward tilted : Re: torus, inward/outward tilted Server Time
30 Apr 2024 00:02:30 EDT (-0400)
  Re: torus, inward/outward tilted  
From: Cousin Ricky
Date: 19 Jul 2012 13:45:01
Message: <web.5008456861ba12ab85de7b680@news.povray.org>
Render the following scene file.  It will show you why your 2:1 ratio isn't
preserved.
____________________________________________

  #version 3.6;
  #include "colors.inc"
  global_settings { assumed_gamma 1 }
  camera { location <6, 0, -6> look_at 0 }

  #declare Section = disc
  { 0, z, 1
    pigment
    { object
      { union
        { cylinder { -x, x, 0.05 }
          cylinder { -y, y, 0.05 }
        }
        White Red
      }
    }
    finish { ambient 1 diffuse 0 }
    rotate -45 * y
  }
  object
  { Section
    translate <-3, 0, -3>
  }
  object
  { Section
    scale <1, 2, 1>
    translate <-1.25, 0, -1.25>
  }
  object
  { Section
    scale <1, 2, 1>
    matrix <1,0,0, 1,1,1, 0,0,1, 0,0,0>
    translate <1.6, 0, 1.6>
  }
____________________________________________

The very process of shearing causes the y-axis to lengthen, which breaks the 2:1
ratio.

In addition, the minor and major axes of the cross section's ellipse do not
remain aligned with the x and sheared y axes, distorting the ratio even further.
 This also causes the actual tilt angle to be slightly more than the shear
angle.  (E.g., with a shear of 1:1, or 45 degrees, the elliptical cross section
will be tilted slightly more than 45 degrees.)

Patching four sheared quadrants together doesn't work very well.  This is better
illustrated if you change your torus major radius from 24 to 6, and change the
camera location from <0, 36, -48> to <0, 9, -12>.  Instead, try playing with
this isosurface function:

  #include "functions.inc"
  #declare fn_Tilted_torus = function
    (x, y, z, P0_RMajor, P1_rMinor, P2_yScale, P3_tilt)
  { f_torus (x, y / P2_yScale, z, P0_RMajor + y * P3_tilt, P1_rMinor)
  }

The above function does a shear, so it's subject to the same distortions to the
cross section.  It's surely possible to write a function that rotates instead of
shears, but the math is more complicated.  (It can be done with linear
transformations, but the matrix will not be the same for all points.)


Post a reply to this message

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