POV-Ray : Newsgroups : povray.general : Trace(): help required : Re: Trace(): help required Server Time
1 Aug 2024 02:18:32 EDT (-0400)
  Re: Trace(): help required  
From: Sven Littkowski
Date: 18 May 2006 22:39:03
Message: <446d2fc7$1@news.povray.org>
Hi Warp,

hmm, not sure how to work your "comment" out...   :-)

Let me just give you the scene as I got it from you. Remember, I am an 
absolute beginner if it comes to the trace function.

Best greetings,

Sven


"Warp" <war### [at] tagpovrayorg> schrieb im Newsbeitrag 
news:446d1c1c@news.povray.org...
> Sven Littkowski <sve### [at] jamaica-focuscom> wrote:
>> I rendered your example but just get the torus.
>
>  I can't even begin to fathom how that is possible.
>
> -- 
>                                                          - Warp


#version 3.5;

// Declare an object you want to trace:
#declare AnObject = torus
{
 1.0, 0.5
 pigment { rgb x }
 finish { specular 0.5 }
}

// Let's "drop" cylinders on this object from above.
// First let's define the area inside which to "drop" cylinders
// (this covers the entire torus above viewed from above):
#declare MinX = -1.5;
#declare MaxX = 1.5;
#declare MinZ = -1.5;
#declare MaxZ = 1.5;
#declare DropHeight = 2;
#declare CylinderRadius = .015;
#declare NormalScale = .1;

// Now let's loop through all that area using regular steps:
#declare Normal = < 0.0, 0.0, 0.0 >;
#declare Step = 0.1;
#declare IndX = MinX;

#while(IndX <= MaxX)
 #declare IndZ = MinZ;
 #while(IndZ <= MaxZ)

  // Now let's "drop" a cylinder onto the torus:
  #declare Intersection = trace(AnObject < IndX, DropHeight, IndZ > -y, 
Normal);
  // The first parameter is the object to trace (ie. our torus).
  // The second parameter is the starting point for the trace
  // (like the point from which we "drop" our cylinder).
  // The third parameter is the direction towards which we trace
  // (ie. the direction towards which we "drop" the cyliner)
  // The last parameter is the normal vector at the intersection point
  // (this has two uses, as seen below).

  // Now, a normal vector <0,0,0> is invalid and thus trace() uses that
  // value to indicate that it did not intersect the object at all.
  // Thus we have to check that it is not <0,0,0> before we crate the
  // cylinder:
  #if(vlength(Normal) > 0)
   // Now we can create the cylinder at the intersection point.
   // To keep things interesting, let's orientate the cylinder in
   // the direction of the normal vector:
   cylinder
   {
    Intersection, Intersection+Normal*NormalScale, CylinderRadius
    pigment { rgb y }
    finish { specular .5 }
   }
  #end

  #declare IndZ = IndZ + Step;
 #end
 #declare IndX = IndX + Step;
#end


camera { location < 0.0, 5.0, -5.0 > look_at 0.0 angle 35 }

light_source { <100.0, 200.0, 0>, 1.0 }

object { AnObject }


Post a reply to this message

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