POV-Ray : Newsgroups : povray.newusers : Toruses are making me cry. Server Time
4 Nov 2024 23:16:00 EST (-0500)
  Toruses are making me cry. (Message 1 to 6 of 6)  
From: Killroy Quartermaine
Subject: Toruses are making me cry.
Date: 14 Sep 2004 13:50:01
Message: <web.41472f2053e2c7b754757f2d0@news.povray.org>
OK, so I'm trying to make a CSG object which will eventually be a base upon
which a glass ball sits. I figure a this torus sitting half on top of a
very short but wide cylinder will do the trick. Because I'm still a bit
shaky writing the scene code, I render after every step, but something
strange happens when I add the torus to the scene. It renders entirely
black.
this happens regardless of whether or not I'm  tossing it into a union with
the cylinder or not.

Here is the code I have written for the scene thus far:
#include "colors.inc"

camera {
        location <-2,1,-4>
        look_at <0,0,0>}

light_source { <4,2,-1> White
       }

plane {<0,1,0>, -1 pigment {checker Blue White}}
        cylinder {<0,-1,0>, <0,-.9,0> 2 pigment {White}}
        torus { 2, 1.9 pigment{White}}

Also, toruses bother me on another  level. every other primitive shape (is
that right? spheres and cones and whatnot... they're primitives?) seems to
require a location in their basic description, but toruses only want the
two float values, and spit errors at you if you want to include a vector
for them. Please, I realize that I'm a rank amateur here, but if someone
would help me figure out what I'm doing wrong, I'd really appreciate it.


Post a reply to this message

From: JohnK
Subject: Re: Toruses are making me cry.
Date: 14 Sep 2004 14:40:00
Message: <web.41473a5fe713e40a4538baeb0@news.povray.org>
I'm very new too.  I ran the code you gave and it is indeed black.  It is
because the torus is too big so it blocks the camera.  I played with the
size and it renders fine.

I tried with the sizes and some translating real quick and got this...


#include "colors.inc"

camera {
        location <-2,1,-4>
        look_at <0,0,0>}

light_source { <4,2,-1> White
       }

plane {<0,1,0>, -1 pigment {checker Blue White}}
        cylinder {<0,-1,0>, <0,-.9,0> 2 pigment {White}}
        torus { .5, .49 pigment { White }
        translate <0, -1, 0>
}


Post a reply to this message

From: Tim Nikias
Subject: Re: Toruses are making me cry.
Date: 14 Sep 2004 15:21:45
Message: <414744c9@news.povray.org>
As JohnK mentioned, the torus is too big. If you look at the docs, you'll
notice that a torus needs two floats as input: the first defines the major
radius, the second the minor radius. In your case, the minor radius is
almost as large as the major radius. Hence, only a very small hole would be
left in the torus, but that may be your intention.

To clear things up: the torus sits at the origin, its equator lying on the
y-plane. To move objects about, you use "translate". It is quiet important
where in your code you translate the object: if you move it before the
texture-block, the texture won't be translated with the object in case you
decide to animate that translation. All this is covered somewhere in the
docs, so you might want to look a little into that. I've had to read that
section in 3.5-days quiet a few times until I fully grasped all the
implications of this for animations.

Regards,
Tim

-- 
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>


Post a reply to this message

From: Warp
Subject: Re: Toruses are making me cry.
Date: 14 Sep 2004 15:59:58
Message: <41474dbe@news.povray.org>
Killroy Quartermaine <iam### [at] yahoocom> wrote:
> Also, toruses bother me on another  level. every other primitive shape (is
> that right? spheres and cones and whatnot... they're primitives?) seems to
> require a location in their basic description, but toruses only want the
> two float values

  This may be more technical than what you are interested in, but the
reason why the torus primitive has no location parameter is probably
for speed reasons.
  Raytracing a torus is done by calculating the intersections of a
line and fourth order polynomial. I suppose solving the intersection
can be optimized a bit when the torus is sitting in the origin
(I haven't actually tried to make the math myself, so I may be
wrong and the real reason is just that the original coder who
added the torus was lazy, but the performance argument may well
be reasonable).
  (By the way, even if you "translate" a torus or apply other
transformations to it, the torus will still be sitting in the
origin, so the transformations you apply to the torus will
actually not affect the complexity of the ray-torus intersection
solving.)

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Christopher James Huff
Subject: Re: Toruses are making me cry.
Date: 15 Sep 2004 22:46:48
Message: <cjameshuff-002483.22464815092004@news.povray.org>
In article <41474dbe@news.povray.org>, Warp <war### [at] tagpovrayorg> 
wrote:

>   Raytracing a torus is done by calculating the intersections of a
> line and fourth order polynomial. I suppose solving the intersection
> can be optimized a bit when the torus is sitting in the origin

This is actually the case for cylinders and cones...POV transforms the 
cylinders internally to the proper position. However, it is so 
inconvenient to rotate and translate axis-aligned cylinders into the 
proper position that this is necessary just to make using them 
practical. For a torus, it's pretty easy to translate it into place. A 
normal vector would have been very useful in earlier versions, but we 
have macros for pointing it along a specified direction now.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

From: Tom Melly
Subject: Re: Toruses are making me cry.
Date: 21 Sep 2004 04:30:09
Message: <414fe691@news.povray.org>
"Killroy Quartermaine" <iam### [at] yahoocom> wrote in message
news:web.41472f2053e2c7b754757f2d0@news.povray.org...

BTW

http://www.bbc.co.uk/radio4/science/fiveshapes.shtml

(check out programme 4 - you should be able to listen to it via the above
page after 09:45am today)


Post a reply to this message

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