POV-Ray : Newsgroups : povray.advanced-users : Fat torii leave artifacts with CSG Server Time
1 Nov 2024 03:15:19 EDT (-0400)
  Fat torii leave artifacts with CSG (Message 1 to 4 of 4)  
From: David Wallace
Subject: Fat torii leave artifacts with CSG
Date: 17 Jul 2003 03:12:50
Message: <3f164c72$1@news.povray.org>
When I try to subtract a torus whose inner radius exceeds its outer radius
from a cylinder, it leaves an ovoid behind.  Check out the following
example:

// Object
#declare otbgRad = 0.05;
#declare otbgRadT = 0.005;
#declare otbgHgt = 0.15;
#declare otbgOfs = 0.04;
#declare otbThk = 0.003;
#declare otbRadL = 0.050;
#declare otbRadH = otbRadL*1.6;
#declare otbRadT = otbRadL*1.9;
#declare otbHgtL = otbgRad*.7;
#declare otbHgtH = otbgHgt*0.9;

#declare otbRadTc = (otbRadT+otbRadH-otbThk)*0.5;
#declare otbRadBc = (otbRadT+otbRadH)*0.5;
#declare otbRadTw = (otbRadT-otbRadH+otbThk)*0.5;
#declare otbRadBw = (otbRadT-otbRadH)*0.5;
#declare otbSquB = otbRadBw/(otbRadBw+otbThk);
#declare otbPos = -otbgHgt-otbgRad+otbgRadT;

#declare otBucket = union {
 #local bcut = otbRadL-otbHgtL-otbThk;
 #local brad = otbHgtL-otbThk;
 difference {                                             // Watch this area
  cylinder { -y*otbHgtL, y*0, otbRadL }
  torus { bcut, brad translate -y*otbHgtL sturm }
  //sphere { -y*otbHgtL, brad }
  //cylinder { -y*otbHgtL*1.1, -y*otbThk, bcut }
 }
 difference {
  cone { y*0, otbRadL, y*otbHgtH, otbRadH }
  cone { -y*otbThk, otbRadL-otbThk, y*otbHgtH*1.01, otbRadH-otbThk }
 }
 difference {
  torus { otbRadTc, otbRadTw sturm }
  torus { otbRadBc, otbRadBw scale <1, otbSquB, 1> sturm }
  plane { y, 0 }
  translate y*otbHgtH
 }
 texture { colWheel } // use your own texture here
 translate y*otbHgtL
}

// Instantiation
light_source { <.3, -1.1,  0>, rgb <1, 1, 1> }
camera { location < .1, -0.3,   .01> look_at <0,-0.05, 0> }
object { otBucket translate y*otbPos }

The cylinder cutout, if uncommented, cuts a hole in the ovoid but does not
eliminate it.  The sphere, however, all but wipes it out.  What's going on?


Post a reply to this message

From: Hughes, B 
Subject: Re: Fat torii leave artifacts with CSG
Date: 17 Jul 2003 07:40:38
Message: <3f168b36@news.povray.org>
Multiply the sphere (you commented out) radius by 0.92 and it should be
okay. You weren't matching the inner torus nipple distance to the sphere's
radius. This was only a guess, of course.

I thought the problem might be about how the torus is internally bounded and
could have trouble with overlapping surfaces, inside/outside not being as
expected. Or even that the unit scale being used might be too small and
cause precision errors. But the above works.

I was about to go so far as to suggest poly or quartic shapes to mimic the
torus primitive but that doesn't seem necessary.

Bob H.


Post a reply to this message

From: Mike Williams
Subject: Re: Fat torii leave artifacts with CSG
Date: 17 Jul 2003 14:53:56
Message: <5ZWS4TAzBvF$Ew6X@econym.demon.co.uk>
Wasn't it David Wallace who wrote:
>When I try to subtract a torus whose inner radius exceeds its outer radius
>from a cylinder, it leaves an ovoid behind.

Yes. What else would you expect it to do?

A fat torus is a self-intersecting shape. Under normal circumstances
there's a hole inside. When you difference the torus out of some other
object, then the bit that was the hole gets left behind.

You don't normally see the hole inside the fat torus because it's
completely inside, but you can see it if you make the surface
transparent or cut a little hole in it.

camera { location  <0, 0, -15> look_at <0, 0, 0>}

light_source {<10,10,-100> colour rgb 1}

torus {1.5,3
  rotate <90,55,0>
  clipped_by {plane {-z,3.5}}
  pigment {rgb 1}
  no_shadow
}


Post a reply to this message

From: David Wallace
Subject: Re: Fat torii leave artifacts with CSG
Date: 18 Jul 2003 00:21:18
Message: <3f1775be@news.povray.org>
"Mike Williams" <mik### [at] econymdemoncouk> wrote in message
news:5ZWS4TAzBvF$Ew6X@econym.demon.co.uk...
> Wasn't it David Wallace who wrote:
> >When I try to subtract a torus whose inner radius exceeds its outer
radius
> >from a cylinder, it leaves an ovoid behind.
>
> Yes. What else would you expect it to do?
>
> A fat torus is a self-intersecting shape. Under normal circumstances
> there's a hole inside. When you difference the torus out of some other
> object, then the bit that was the hole gets left behind.
>
That's what I suspected.  Hence the commented cutouts in the original post.
The idea was to wipe out the nipple and, once discovered, the central ovoid.
The cylinder got the nipple but left part of the ovoid while the sphere got
the ovoid but left a small part of the nipple.  Actually the object looks
quite nice with just the sphere removed.


Post a reply to this message

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