POV-Ray : Newsgroups : povray.advanced-users : Use Slope pattern for Planting distribution? Server Time
6 Oct 2024 19:17:49 EDT (-0400)
  Use Slope pattern for Planting distribution? (Message 21 to 25 of 25)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Thomas de Groot
Subject: Re: Use Slope pattern for Planting distribution?
Date: 15 Dec 2006 02:59:57
Message: <458255fd$1@news.povray.org>
"Gilles Tran" <tra### [at] inapgfr> schreef in bericht 
news:45818955@news.povray.org...

> 45813d16@news.povray.org...
>> Thomas de Groot <t.d### [at] internldotnet> wrote:
>>> so.... what do you think?
>>
>>  Yes, there's no mention of the returned vector being normalized. Thus
>> it may not be wise to assume it is, and thus it would be wise to use
>> vnormalize(), just in case.
>
> Just ran a test with the Makesnow macro and it looks to be normalized 
> indeed (all vlength(Norm)=1). It's just not documented probably.
>

Thanks Gilles! That is nice to know. A good piece of information for the 
documentation I guess.

Thomas


Post a reply to this message

From: Warp
Subject: Re: Use Slope pattern for Planting distribution?
Date: 15 Dec 2006 03:59:35
Message: <458263f6@news.povray.org>
Thomas de Groot <t.d### [at] internldotnet> wrote:
> Thanks Warp! This makes it clear for me. Perhaps it would be a suggestion to 
> add something like this in the documentation? I think that would be useful.

  I don't think the purpose of the documentation is to be an all-encompassing
mathematics tutorial. While mathematics is certainly very useful (and often
necessary) to use POV-Ray, the documentation should be about POV-Ray, not
about mathematics. I think it's fair that the documentation assumes that
the reader has some previous knowledge on math.

-- 
                                                          - Warp


Post a reply to this message

From: Warp
Subject: Re: Use Slope pattern for Planting distribution?
Date: 15 Dec 2006 04:02:10
Message: <45826491@news.povray.org>
Gilles Tran <tra### [at] inapgfr> wrote:
> Just ran a test with the Makesnow macro and it looks to be normalized indeed 
> (all vlength(Norm)=1). It's just not documented probably.

  I think a more definitive way would be to check from the source code
if all objects return a normalized vector (or if the implementation of
trace() normalizes the vector before it returns it).

  It's highly possible that all objects normalize the normal vector they
return, because it's most useful that way (eg. for lighting calculations
and basically everything else where normals are used). However, it might
also be possible that some objects do not normalize the vector for
efficiency reasons...

-- 
                                                          - Warp


Post a reply to this message

From: Thomas de Groot
Subject: Re: Use Slope pattern for Planting distribution?
Date: 15 Dec 2006 05:25:32
Message: <4582781c@news.povray.org>
"Warp" <war### [at] tagpovrayorg> schreef in bericht 
news:458263f6@news.povray.org...
>  I don't think the purpose of the documentation is to be an 
> all-encompassing
> mathematics tutorial. While mathematics is certainly very useful (and 
> often
> necessary) to use POV-Ray, the documentation should be about POV-Ray, not
> about mathematics. I think it's fair that the documentation assumes that
> the reader has some previous knowledge on math.
>

Hmm.. Yes... However, normalize is mentioned nowhere in the docs, except at 
vnormalize (and then very succintly) and in some examples without further 
comment. Without going too mathematical, imho that is too little for the 
average POV-Ray user (like me).

Thomas


Post a reply to this message

From: user
Subject: Re: Use Slope pattern for Planting distribution?
Date: 9 Jan 2007 13:00:25
Message: <45a3d839@news.povray.org>
Kirk Andrews <kir### [at] hotmailcom> wrote:
> Honestly, I've had a lot of difficulty understanding exactly how that works.
>  When you use the trace command to return the "normal", what exactly is
> being returned?  And perhaps someone might provide a short example code of
> how I might use that?

   Some basic vector math knowledge could be of great help when designing
thing with POV-Ray... :P

   A normal vector is a vector perpendicular (ie. at 90 degrees) to the
surface. In layman terms, a normal is a vector which points directly
away from the surface at that intersection point.

   You can use this normal vector to calculate the steepness of the surface
at that point.
   One simple way of doing this is using the dot product (vdot() function
in povray): Assuming that 'y' is up in your terrain and the normal vector
is normalized (ie. its length is 1; this can be done with vnormalize() just
in case), then the dot product of the normal vector and 'y' will give the
cosine of the angle between these two vectors. In other words, if the normal
vector has the same direction as 'y', the result of the dot product will
be 1 and if the normal vector is perpendicular to 'y' (ie. at 90 degrees)
then the result will be 0. Other directions of the normal vector will give
values in between 0 and 1 (not linearly, though, but that doesn't matter).

   In other words, if you do this:

#declare VD = vdot(vnormalize(TheNormalVectorYouGotWithTrace), y);

now VD will have a value between 0 and 1. 1 means completely vertical,
0 means completely horizontal. If you want to avoid putting a plant on
a surface which is too steep, try doing so only when VD > 0.2 or so
(try different values until you are happy).

   If you know the exact angle which you want to be the limit, then you
can simply compare VD with cos(radians(TheAngle)).

-- 
                                                           - Warp


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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