POV-Ray : Newsgroups : povray.advanced-users : Vector Components : Re: Vector Components Server Time
28 Jul 2024 16:25:18 EDT (-0400)
  Re: Vector Components  
From: Tor Olav Kristensen
Date: 15 Sep 2004 17:31:49
Message: <4148b4c5$1@news.povray.org>
nomail@nomail wrote:

>>Hmm... that's not gonna work.
> 
> 
> Not exactly what I wanted to hear.  I guess I will have to work out a new
> function  to do what I wanted.
> 
> Thank you.  If anyone has any suggestions to make the original work please
> feel free to post.

I suggest that you read about about user defined functions and
the select() function.

2.2.1.6.3 Declaring User-Defined Float Functions:
http://www.povray.org/documentation/view/3.6.1/231/

2.2.1.3.4 Functions:
http://www.povray.org/documentation/view/3.6.1/228/

Here's a simple example:

#declare MyFn =
   function(x, y, z) {                         // Or just: function { 

     select(y - 1, 0, SomeExpression, 0)  +    // Case: y = 1
     select(y - 2, 0, OtherExpression, 0) +    // Case: y = 2
     select(y - 2, 0, 0, YetAnotherExpression) // Case: y > 2
   }

You may also have a look at my reply in this thread in p.b.s-f:
From: Yadgar
Subject: Discontinuous functions?
Date: 14 Aug 2004 11:19:55

http://tinyurl.com/6vaar
http://news.povray.org/povray.binaries.scene-files/message/%3C411fd33c%40news.povray.org%3E/#%3C411fd33c%40news.povray.org%3E

-- 
Tor Olav
http://subcube.net
http://subcube.com


Post a reply to this message

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