POV-Ray : Newsgroups : povray.general : Trace(): help required Server Time
1 Aug 2024 06:19:50 EDT (-0400)
  Trace(): help required (Message 11 to 20 of 20)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Sven Littkowski
Subject: Re: Trace(): help required
Date: 19 May 2006 06:42:21
Message: <446da10d$1@news.povray.org>
Well, NOW I understand. Thanks, Povman!

That means, the norm function actually could be used like a rotate < x, y, z 
 > command? And if so, where would be the point of rotation - would that 
point be the point where the placable object hits via the trace command the 
surface of the traced object, or would it be the placable objects natural 
postion from its own X,Y,Z coordinates (as usual, otherwise)?

Hmmm, I guess, I have to look deeply into the given examples again. But I 
also would appreciate easy answers...

Thanks a lot, Povman,

Sven




"POVMAN" <s### [at] acom> schrieb im Newsbeitrag news:446d891e$1@news.povray.org...
> The NORM is a Vector that represents the angle at which the ray being used 
> in the trace function hits the object.


Post a reply to this message

From: Warp
Subject: Re: Trace(): help required
Date: 19 May 2006 08:27:27
Message: <446db9ae@news.povray.org>
Sven Littkowski <sve### [at] jamaica-focuscom> wrote:
> Now, what happened: I changed the 
> formatting, and - you are so right - I removed commas. I usually don't use 
> commas often, but made the experience that this was not giving any trouble. 

  You shouldn't remove commas because sometimes they are crucial.

  "a -b" is *not* the same thing as "a, -b".

-- 
                                                          - Warp


Post a reply to this message

From: Sven Littkowski
Subject: Re: Trace(): help required
Date: 19 May 2006 08:59:57
Message: <446dc14d@news.povray.org>
Yes, exactly that I found out. The error was caused just in the trace 
function. And because it is flexible with the amount of parameters. That 
was, what broke my neck!

:-)

Sven


"Warp" <war### [at] tagpovrayorg> schrieb im Newsbeitrag 
news:446db9ae@news.povray.org...
>  You shouldn't remove commas because sometimes they are crucial.
>  "a -b" is *not* the same thing as "a, -b".


Post a reply to this message

From: Sven Littkowski
Subject: Re: Trace(): help required
Date: 19 May 2006 09:15:32
Message: <446dc4f4$1@news.povray.org>
Hmmm, I still don't succeed. I want to randomly place a number of green 
cylinders onto the blob, just above and below the horizontal rectangular cut 
in the blob (lower edge of the picture).

What exactly do I do wrong? Please see below a simplified scene code.

Sven


#version 3.5;
#include "colors.inc"

#declare MittelRumpf=blob 
// 4er Frontgebilde
{
 threshold 0.3
 sphere { < 0.0, 0.0, 400.0 > 300.0, 1.5 }
 cylinder { < -450.0, 0.0, 400.0 > < 450.0, 0.0, 400.0 > 300.0, 1.0 scale < 
1.0, 1.0, 1.0 > } 

 sphere { < 0.0, 0.0, 500.0 > 200.0, 1.0 }
 cylinder { < -50.0, 0.0, 500.0 > < 50.0, 0.0, 500.0 > 600.0, 1.0 scale < 
0.12, 1.0, 0.5 > } 

 sphere { < 0.0, 0.0, 800.0 > 280.0, 1.0 scale < 1.0, 1.43, 1.0 > }
 cylinder { < 0.0, -50.0, 500.0 > < 0.0, 50.00, 500.0 > 300.0, 1.0 }
 scale < 1.0, 0.7, 1.0 >
}


#declare MitteFront=difference
{
 object { MittelRumpf }
 box { < -60.0, -400.0, -400.0 > < 60.0, 400.0, 1000.0 > } // 
........................................................................... 
Wegfall der vorderen Rumpfmitte
 box { < -400.0, -400.0, 250.0 > < 400.0, 400.0, 550.0 > } // 
........................................................................... 
Wegfall der Mitte quer
 box { < -200.0, -400.0, 400.0 > < 200.0, 400.0, 1000.0 > } // 
.......................................................................... 
Wegfall der Mitte bis nach hinten
 pigment { Red }
}

#declare MitteSeite=difference
{
 object { MittelRumpf }
 box { < -400.0, -400.0, -400.0 > < 400.0, 400.0, 650.0 > } // 
.......................................................................... 
Wegfall der Mitte und von Vorne
 box { < -150.0, -400.0, 400.0 > < 150.0, 400.0, 1000.0 > } // 
.......................................................................... 
Wegfall der Mitte bis nach hinten
 box { < 200.0, -400.0, 400.0 > < 400.0, 400.0, 1000.0 > } // 
........................................................................... 
Wegfall der hinteren Seite
 box { < -400.0, -400.0, 400.0 > < -200.0, 400.0, 1000.0 > } // 
......................................................................... 
Wegfall der hinteren Seite
 pigment { Red }
}

#declare MitteOben=difference
{
 object { MittelRumpf }
 box { < -400.0, -400.0, -400.0 > < -60.0, 400.0, 250.0 > }
 box { < 60.0, -400.0, -400.0 > < 400.0, 400.0, 250.0 > }
 box { < -400.0, -400.0, 550.0 > < -200.0, 400.0, 1000.0 > }
 box { < 200.0, -400.0, 550.0 > < 400.0, 400.0, 1000.0 > }
 box { < -400.0, -400.0, 650.0 > < -150.0, 400.0, 1000.0 > }
 box { < 150.0, -400.0, 650.0 > < 400.0, 400.0, 1000.0 > }
 pigment { Red }
}

#declare Basisrumpf=union
{
 object { MitteFront }
 object { MitteSeite }
 object { MitteOben }
}

#declare SechseckSensor=cylinder
{
 < 0.0, 0.0, 0.0 > < 0.0, 0.0, -5.0 > 5.0
 pigment { Green }
}

#declare Mittelsegment=difference
{
  union
  {
   object { Basisrumpf }  //
   #declare Runde=200;
   #declare Next=seed(60);
   #while(Runde<360)
    #declare MyNext=rand(Next);
    #declare Normal=< 0.0, 0.0, 0.0 >;
    #declare MySurface=trace( Basisrumpf, < Runde, 40, 2000.0 >, < Runde, 
40.0, 0.0 >, Normal );
    #if(vlength(Normal)>0)
     object { SechseckSensor scale < 1.0, 1.0, -1.0 > translate MySurface 
scale < 1.0, 1.0, 1.0 > }
     object { SechseckSensor scale < 1.0, 1.0, -1.0 > translate MySurface 
scale < -1.0, 1.0, 1.0 > }
     object { SechseckSensor scale < 1.0, 1.0, -1.0 > translate MySurface 
scale < 1.0, -1.0, 1.0 > }
     object { SechseckSensor scale < 1.0, 1.0, -1.0 > translate MySurface 
scale < -1.0, -1.0, 1.0 > }
    #end
    #declare Runde=Runde+5+(10*MyNext);
   #end
  }
  box { < -400.0, -400.0, 750.0 > < 400.0, 400.0, 1000.0 > pigment { Red } }
  box { < -460.0, -20.0, 0.0 > < 460.0, 20.0, 800.0 > pigment { Red } }
}

camera
{
 location < -400.0, 500.0, -1300.0 >
 look_at < -500.0, 300.0, -500.0 >
}

light_source
{
 < -1000000.0, -1000000.0, -5000.0 >
 color rgb < 0.99, 0.80, 0.47 > *4
}

light_source
{
 < -1000000.0, 1000000.0, 1000000.0 >
 color rgb < 0.2, 0.2, 0.3 > *4
}

 object { Mittelsegment rotate < 0.0, 180.0, 0.0 > }


Post a reply to this message

From: Warp
Subject: Re: Trace(): help required
Date: 19 May 2006 11:03:52
Message: <446dde57@news.povray.org>
Sven Littkowski <sve### [at] jamaica-focuscom> wrote:
> trace( Basisrumpf, < Runde, 40, 2000.0 >, < Runde, 40.0, 0.0 >, Normal );

  Are you sure you read my example scene carefully?

  More precisely, do you understand the difference between a point and
a direction vector?

-- 
                                                          - Warp


Post a reply to this message

From: Sven Littkowski
Subject: Re: Trace(): help required
Date: 19 May 2006 13:44:57
Message: <446e0419@news.povray.org>
Yes, usually I do. But to be honest, the trace thing is new, I easily could 
misunderstand, truly. If you look to the various "SF: Preview: Imperial 

what objects I do out of my mind (without any 3D editor).

But with your question you actually give me a hint, and I am looking now 
again into the scene, in hope to discover that thinking error. Sometimes you 
are so frustrated in finding out things, that you don't see the forest 
because of the many trees.

Thanks, greetings,

Sven





"Warp" <war### [at] tagpovrayorg> schrieb im Newsbeitrag 
news:446dde57@news.povray.org...
> Sven Littkowski <sve### [at] jamaica-focuscom> wrote:
>> trace( Basisrumpf, < Runde, 40, 2000.0 >, < Runde, 40.0, 0.0 >, Normal );
>
>  Are you sure you read my example scene carefully?
>
>  More precisely, do you understand the difference between a point and
> a direction vector?
>
> -- 
>                                                          - Warp


Post a reply to this message

From: Sven Littkowski
Subject: Re: Trace(): help required
Date: 19 May 2006 14:04:04
Message: <446e0894$1@news.povray.org>
Hello Warp,

I got now (finally) your point. I thought I could define the location of the 
ray more exactly to which location that ray is pointing to. I replaced it 
now with a simple "-z" and it works. Thanks, Warp,

Sven

>  More precisely, do you understand the difference between a point and
> a direction vector?


Post a reply to this message

From: Kenneth
Subject: Re: Trace(): help required
Date: 22 May 2006 01:20:01
Message: <web.447148d7501983a81bc008390@news.povray.org>
"Sven Littkowski" <sve### [at] jamaica-focuscom> wrote:
> Hi Seb,
>
> many thanks and my appreciation for your answer. I understand now the 3
> vectors version.
>
> But what is a 4 vectors version? What is the NORM doing and about?
>
> Sven

Hi, Sven!  I feel your pain--it took me awhile to understand trace( ) as
well. But it's certainly one of the *coolest* features of POV.

It may not be clear from the discussions so far that the 4th parameter--the
normal of the surface found at the traced intersection point--is optional.
You can leave it out.  But if you do use it, you first have to #declare a
"dummy" value for it, the usual way being #declare my_norm = <0,0,0>.  But
it could have any three vector values to begin with, because the trace
operation will "fill" it each time with its own found value. It took me
awhile to understand that myself. That is, unlike the values you SUPPLY to
the first three parameters, the 4th parameter actually GIVES BACK a vector
value for each trace "ray" shot, which can be used for other things.  And
like Warp says, the found normal is VERY useful in finding out IF a trace
ray has actually hit your main object.. The idea behind #if (vlength
my_norm !=0) --that is, "not equal to zero"--is that, if a trace ray
doesn't hit your main object, trace returns a location of <0,0,0> AND
automatically fills the 4th parameter with <0,0,0>.The vlength (vector
length) of such a "vector" is zero. You can then make a simple #if...#else
block to keep your code from creating an object in such a case. (All such
objects would otherwise be placed one on top of the other, all at location
<0,0,0>.)

Ken W.


Post a reply to this message

From: Kenneth
Subject: Re: Trace(): help required
Date: 22 May 2006 01:55:00
Message: <web.447150ec501983a81bc008390@news.povray.org>
"Kenneth" <kdw### [at] earthlinknet> wrote:
> The idea behind #if (vlength my_norm !=0) ...

Sorry, that should have been #if (vlength (my_norm) !=0)

BTW, you could instead use #if (vlength (my_norm) = 0) and simply rearrange
the parts in your #if......#else block to get the same results.

Ken


Post a reply to this message

From: Kenneth
Subject: Re: Trace(): help required
Date: 22 May 2006 02:45:00
Message: <web.44715ba0501983a81bc008390@news.povray.org>
"Sven Littkowski" <sve### [at] jamaica-focuscom> wrote:

> That means, the norm function actually could be used like a rotate < x, y, z
>  > command? And if so, where would be the point of rotation - would that
> point be the point where the placable object hits via the trace command the
> surface of the traced object, or would it be the placable objects natural
> postion from its own X,Y,Z coordinates (as usual, otherwise)?

Using the normal to try and rotate other already-created objects is not an
easy thing to accomplish.  True, it can be used quite well the way Warp has
shown, when actually CREATING an object at the traced intersection point.
But the results of doing something like, say,

object{my_small_object
 rotate my_norm*90 // to try and re-orient your small placed
                  // object according to the
                  // normal of the surface
 translate traced_intersection_point // putting each small object onto the
                                     // bigger traced object
            }

doesn't work out the way you might think. It *looks* like it works, sort of,
but the rotational results are not correct. I personally tried all sorts of
trigonometric trickery with the normal, and finally found a way to do this
(see below.)  But then I discovered the Point_At_Trans macro in
transforms.inc. With it, you can take any pre-created object -- made at the
origin--and rotate it using the my_norm vector. (It takes the +y vector
there and rotates it--and the object-- around to the my_norm vector.) Very
handy!!

My other way of doing it is this (using "dot notation" to pull out
individual vector values):
#declare x_degrees_reorient = degrees (atan2 (my_norm.y, my_norm.z));
#declare y_degrees_reorient = degrees (atan2 (my_norm.y, my_norm.x));

then rotate your pre-created object , while it's still at the origin, like
this:
rotate <90 - x_degrees_reorient, 0, z_degrees_reorient - 90)

then translate it to the traced location.

I can't guarantee that it has the EXACT same results as Point_At_Trans, but
it looks identical to me.

Ken W.


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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