POV-Ray : Newsgroups : povray.general : torus, inward/outward tilted Server Time
25 Apr 2024 20:12:33 EDT (-0400)
  torus, inward/outward tilted (Message 1 to 7 of 7)  
From: peter puzzelaar
Subject: torus, inward/outward tilted
Date: 17 Jul 2012 05:55:01
Message: <web.500534b792b607dd47437ba70@news.povray.org>
Hi all...

I am getting stuck on constructing a piece of an assembly.

This piece I want is a sector of a torus-ish element.
So let's describe this torus-ish thing...

Scale a normal torus in the y-direction:
  #declare myTorus= torus {24, 0.4 sturm on scale <1, 2, 1>}

Now I want to tilt the complete (scaled) torus inward (AND preserving the 2:1
ratio of the cross section of the tube)

I tried several things, like shearing with matrix  (which does indeed tilt the
torus: if applied on quarter of torus, and then connect 4 of these quarters
again
to get full torus again. You have a nice inward tilted torus).
However - no matter what i tried - it leads to a very flat torus - so no longer
preserving the 2:1 ratio of the cross section of the tube).

I would be happy for any advice on how to make a torus which has 2:1 ratio of
its tube preserved and can be tilted any degrees (0 to 90) inward/outward.

Best regards,

Peter


Post a reply to this message

From: clipka
Subject: Re: torus, inward/outward tilted
Date: 17 Jul 2012 10:20:06
Message: <50057496$1@news.povray.org>
Am 17.07.2012 11:49, schrieb peter puzzelaar:

> I am getting stuck on constructing a piece of an assembly.
>
> This piece I want is a sector of a torus-ish element.
> So let's describe this torus-ish thing...
>
> Scale a normal torus in the y-direction:
>    #declare myTorus= torus {24, 0.4 sturm on scale <1, 2, 1>}
>
> Now I want to tilt the complete (scaled) torus inward (AND preserving the 2:1
> ratio of the cross section of the tube)
>
> I tried several things, like shearing with matrix  (which does indeed tilt the
> torus: if applied on quarter of torus, and then connect 4 of these quarters
> again
> to get full torus again. You have a nice inward tilted torus).
> However - no matter what i tried - it leads to a very flat torus - so no longer
> preserving the 2:1 ratio of the cross section of the tube).
>
> I would be happy for any advice on how to make a torus which has 2:1 ratio of
> its tube preserved and can be tilted any degrees (0 to 90) inward/outward.

You won't get far with the torus primitive, but here are a few possible 
approaches:

* Use an isosurface; you'll need to figure out a function that will 
yield a rotated ellipsis, and combine that with another function to 
generate a surface of revolution.

* Approximate the shape using a sor or lathe object.

* Approximate the shape using a mesh.


Post a reply to this message

From: Le Forgeron
Subject: Re: torus, inward/outward tilted
Date: 17 Jul 2012 10:49:37
Message: <50057b81@news.povray.org>
Le 17/07/2012 16:20, clipka a écrit :
> Am 17.07.2012 11:49, schrieb peter puzzelaar:

>> I would be happy for any advice on how to make a torus which has 2:1
>> ratio of
>> its tube preserved and can be tilted any degrees (0 to 90)
>> inward/outward.
> 
> You won't get far with the torus primitive, but here are a few possible
> approaches:
> 
> * Use an isosurface; you'll need to figure out a function that will
> yield a rotated ellipsis, and combine that with another function to
> generate a surface of revolution.
> 
> * Approximate the shape using a sor or lathe object.
> 
> * Approximate the shape using a mesh.

* Use a poly of fourth order. Might raise to higher order as you deform
it. (polynomial syntax is to be preferred, IMHO)

Guess what ? there is even a basic torus in the wiki page:

> http://wiki.povray.org/content/Documentation:Tutorial_Section_3.2#Poly_Object



Now, If I could only understood the "inward tilted" thing applied to a
torus...


Post a reply to this message

From: peter puzzelaar
Subject: Re: torus, inward/outward tilted
Date: 18 Jul 2012 03:10:00
Message: <web.5006611b61ba12ab47437ba70@news.povray.org>
Le_Forgeron <lef### [at] freefr> wrote:

> Now, If I could only understood the "inward tilted" thing applied to a
> torus...

actually the inward/outward is superfluous (depends only if you look at the
torus from top or bottom).

here is a code snippet for a the tilted torus...
camera {location <0, 36, -48> look_at <0, 0, 0>}

#declare myTiltedInwardQuartTorus =
intersection {
  torus {24, 0.4 sturm on scale <1, 2, 1> matrix < 1,0,0,  1,1,1,   0,0,1,
0,0,0>}
  box {<-25, -1, -25> <0, 1, 0>}
}

// inward tilted torus
union {
  object {myTiltedInwardQuartTorus}
  object {myTiltedInwardQuartTorus rotate <0,  90, 0>}
  object {myTiltedInwardQuartTorus rotate <0, 180, 0>}
  object {myTiltedInwardQuartTorus rotate <0, 270, 0>}
  texture {pigment {color rgb<0.8, 0.8, 0.2>} finish {ambient 0.2 phong 1}}
}

Regards, Peter.


Post a reply to this message

From: Cousin Ricky
Subject: Re: torus, inward/outward tilted
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

From: Cousin Ricky
Subject: Re: torus, inward/outward tilted
Date: 21 Jul 2012 13:20:01
Message: <web.500ae40961ba12ab85de7b680@news.povray.org>
"peter puzzelaar" <pet### [at] hotmailcom> wrote:
> Scale a normal torus in the y-direction:
>   #declare myTorus= torus {24, 0.4 sturm on scale <1, 2, 1>}
>
> Now I want to tilt the complete (scaled) torus inward (AND preserving the 2:1
> ratio of the cross section of the tube)
>
> [...]
>
> I would be happy for any advice on how to make a torus which has 2:1 ratio of
> its tube preserved and can be tilted any degrees (0 to 90) inward/outward.

Go to http://lib.povray.org/searchcollection/index.php and type tiltedtorus into
the Find Keywords field.  See if that's what you're looking for.


Post a reply to this message

From: peter puzzelaar
Subject: Re: torus, inward/outward tilted
Date: 28 Jul 2012 16:40:01
Message: <web.50144d6461ba12ab47437ba70@news.povray.org>
"Cousin Ricky" <rickysttATyahooDOTcom> wrote:
> "peter puzzelaar" <pet### [at] hotmailcom> wrote:
> > Scale a normal torus in the y-direction:
> >   #declare myTorus= torus {24, 0.4 sturm on scale <1, 2, 1>}
> >
> > Now I want to tilt the complete (scaled) torus inward (AND preserving the 2:1
> > ratio of the cross section of the tube)
> >
> > [...]
> >
> > I would be happy for any advice on how to make a torus which has 2:1 ratio of
> > its tube preserved and can be tilted any degrees (0 to 90) inward/outward.
>
> Go to http://lib.povray.org/searchcollection/index.php and type tiltedtorus into
> the Find Keywords field.  See if that's what you're looking for.

Thanks for the help and good advice...
This is what i conjured up (and it worked).

#declare MyTorus =
lathe {
  cubic_spline
  9,
  <T_rad*1.87-0.4*sqrt(2), -0.4*sqrt(2)>,
  <T_rad*1.87            , -0.4*sqrt(2)>,
  <T_rad*1.87+0.4*sqrt(2),  0          >,
  <T_rad*1.87+0.4*sqrt(2),  0.4*sqrt(2)>,
  <T_rad*1.87            ,  0.4*sqrt(2)>,
  <T_rad*1.87-0.4*sqrt(2),  0          >,
  <T_rad*1.87-0.4*sqrt(2), -0.4*sqrt(2)>,
  <T_rad*1.87            , -0.4*sqrt(2)>,
  <T_rad*1.87+0.4*sqrt(2),  0           >
}

This will create a torus with major radius = T_Rad and the points of the lathe
are chosen in such a way that an oval with axes of ratio 2:1 is created.

Again thanks for all help...

Peter


Post a reply to this message

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