POV-Ray : Newsgroups : povray.newusers : using coordinate vectors in #if statements Server Time
30 Jul 2024 02:26:43 EDT (-0400)
  using coordinate vectors in #if statements (Message 1 to 5 of 5)  
From: Floyd
Subject: using coordinate vectors in #if statements
Date: 11 Dec 2004 10:30:00
Message: <web.41bb1118d37e6b4d5ca17c0e0@news.povray.org>
I'm using trace() to place objects on a height-field, but I don't want to
place them above a certain elevation.  I tried using an

#if (y > 10)

statement to remove the objects above y=10 out of view, but I get a parser
error back that y is a vector, <0,1,0>, and a float is expected.  How do I
extract the value of y out of the coordinate vector for conditional
testing?

Thanks,
Floyd


Post a reply to this message

From: Warp
Subject: Re: using coordinate vectors in #if statements
Date: 11 Dec 2004 10:36:22
Message: <41bb13f6@news.povray.org>
Floyd <nomail@nomail> wrote:
> How do I
> extract the value of y out of the coordinate vector for conditional
> testing?

  Perhaps you should read the documentation for time to time?

  vector.y dhouls do it.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Tim Nikias
Subject: Re: using coordinate vectors in #if statements
Date: 11 Dec 2004 11:34:28
Message: <41bb2194$1@news.povray.org>
>   Perhaps you should read the documentation for time to time?

As necessary as this note often is (as really almost everything can be read
in the docs), sometimes it's just difficult to *find* what you're looking
for. You can't just enter "y-component" into the Help and get the answer.
That aside, I thought povray.newusers is the best place for new users to ask
such questions when they don't know their way about POV-Ray yet.

I'm sorry if I interpreted the sentence worse than it was meant, but you've
always got to be careful how you phrase things when others can only see the
written form...

Regards,
Tim

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


Post a reply to this message

From: kurtz le pirate
Subject: Re: using coordinate vectors in #if statements
Date: 11 Dec 2004 12:15:02
Message: <kurtzlepirate-4F42D3.18150211122004@news.povray.org>
In article <web.41bb1118d37e6b4d5ca17c0e0@news.povray.org>,
 "Floyd" <nomail@nomail> wrote:

>>I'm using trace() to place objects on a height-field, but I don't want to
>>place them above a certain elevation.  I tried using an
>>
>>#if (y > 10)
>>
>>statement to remove the objects above y=10 out of view, but I get a parser
>>error back that y is a vector, <0,1,0>, and a float is expected.  How do I
>>extract the value of y out of the coordinate vector for conditional
>>testing?
>>
>>Thanks,
>>Floyd

  hum...
  try this kind of code :

  #declare normalHF = <0.00, 0.00, 0.00>;
  #declare testPoint = <thisX, 0.50, thisZ>;
  #declare vectorHF = y;
  #declare yHF = trace (thisHF, testPoint,vectorHF, normalHF);

  #if(yHF>1)
    place object
  #end



  klp


Post a reply to this message

From: Floyd
Subject: Re: using coordinate vectors in #if statements
Date: 11 Dec 2004 14:00:01
Message: <web.41bb42fcb94966d25ca17c0e0@news.povray.org>
> >   Perhaps you should read the documentation for time to time?
>
> As necessary as this note often is (as really almost everything can be read
> in the docs), sometimes it's just difficult to *find* what you're looking
> for. You can't just enter "y-component" into the Help and get the answer.

Just for the record, I spent a great deal of time looking in the
documentation and elsewhere for examples where people have tried this
before.  Many of us don't have the docs memorized, and I figured if I've
spent as much time trying to find out, then an answer might be useful for
other people as well.  This forum is a good place to discover if a
particular approach is even possible in povray before wasting more time
trying to find a non-existent answer in the documentation.

Also, if it is known to be in the documentation, then simply pointing out
where or under what heading would be helpful (in this case 2.2.1.4.3
Operators).  From the cryptic response provided I assumed it could be done,
was in the documentation and once I found it I got it to work nicely with
the following code:

#declare Inter=
   trace (HFlandscape, <Xpos, 1000, Zpos>, <Xpos, -1000, Zpos>,);

translate Inter

#if (Inter.y > 10)
   translate y-100
#end

Thanks for your suggestions,
- Floyd


Post a reply to this message

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