POV-Ray : Newsgroups : povray.advanced-users : command capability / syntax Server Time
22 Dec 2024 12:54:21 EST (-0500)
  command capability / syntax (Message 1 to 8 of 8)  
From: Bald Eagle
Subject: command capability / syntax
Date: 25 May 2017 08:05:00
Message: <web.5926c74bb4e709cdc437ac910@news.povray.org>
I was wondering if:

vectors can be used in Boolean conditional statements

#if (Q = <1, 1, 1>)

If the number of arguments a macro takes is a value that is user accessible,
much like dimensions and dimension_size?

Can the size of a vector be determined by a command?
<1, 2> vs <1, 2, 3> vs <1, 2, 3, 4, 5>

Is there a way to determine if an identifier is a scalar or a vector?


Post a reply to this message

From: clipka
Subject: Re: command capability / syntax
Date: 25 May 2017 08:28:58
Message: <5926ce0a$1@news.povray.org>
Am 25.05.2017 um 14:00 schrieb Bald Eagle:
> I was wondering if:
> 
> vectors can be used in Boolean conditional statements
> 
> #if (Q = <1, 1, 1>)
> 
> If the number of arguments a macro takes is a value that is user accessible,
> much like dimensions and dimension_size?
> 
> Can the size of a vector be determined by a command?
> <1, 2> vs <1, 2, 3> vs <1, 2, 3, 4, 5>
> 
> Is there a way to determine if an identifier is a scalar or a vector?

Nononono.


Post a reply to this message

From: dick balaska
Subject: Re: command capability / syntax
Date: 26 May 2017 04:33:18
Message: <5927e84e$1@news.povray.org>
Am 2017-05-25 08:00, also sprach Bald Eagle:
> I was wondering if:
> 
> vectors can be used in Boolean conditional statements
> 
> #if (Q = <1, 1, 1>)

#if (VEq(Q,<1,1,1>)

-- 
dik


Post a reply to this message

From: Le Forgeron
Subject: Re: command capability / syntax
Date: 26 May 2017 05:02:49
Message: <5927ef39@news.povray.org>
Le 26/05/2017 à 10:33, dick balaska a écrit :
> Am 2017-05-25 08:00, also sprach Bald Eagle:
>> I was wondering if:
>>
>> vectors can be used in Boolean conditional statements
>>
>> #if (Q = <1, 1, 1>)
> 

#include "math.inc"

> #if (VEq(Q,<1,1,1>)
> 

for 5D: VEq5D


Post a reply to this message

From: Bald Eagle
Subject: Re: command capability / syntax
Date: 26 May 2017 08:00:00
Message: <web.5928184518337dfc437ac910@news.povray.org>
Le_Forgeron <jgr### [at] freefr> wrote:
> Le 26/05/2017 à 10:33, dick balaska a écrit :

> #include "math.inc"
>
> > #if (VEq(Q,<1,1,1>)
> >
>
> for 5D: VEq5D

Most excellent.
Thanks to both of you gentlemen.  I had not thought to look in the vector
functions for a simple Boolean comparison.

I'm thinking that a macro that does something like a progressive #ifdef(Q.x),
#ifdef (Q.y), #ifdef(Q.z) ..... would be able to count vector elements and
return the size of the vector, and if there's only 1 element, then it's a
scalar.


Post a reply to this message

From: Le Forgeron
Subject: Re: command capability / syntax
Date: 26 May 2017 11:00:06
Message: <592842f6$1@news.povray.org>
Le 26/05/2017 à 13:57, Bald Eagle a écrit :
> Le_Forgeron <jgr### [at] freefr> wrote:
>> Le 26/05/2017 à 10:33, dick balaska a écrit :
> I'm thinking that a macro that does something like a progressive #ifdef(Q.x),
> #ifdef (Q.y), #ifdef(Q.z) ..... would be able to count vector elements and
> return the size of the vector, and if there's only 1 element, then it's a
> scalar.

You forget one thing, which lose the whole idea: automatic expansion of
scalar and vector.

#declare Scalar = 1;

Yet, Scalar.x, Scalar.y and so on are valid and defined as 1.

#declare Vector = <1,2>;

Yet, Vector.z is valid and defined as 0.

The Wise-Man said No, listen to him.


Post a reply to this message

From: Kenneth
Subject: Re: command capability / syntax
Date: 26 May 2017 13:35:05
Message: <web.5928665618337df883fb31c0@news.povray.org>
dick balaska <dic### [at] buckosoftcom> wrote:
> Am 2017-05-25 08:00, also sprach Bald Eagle:
> > I was wondering if:
> >
> > vectors can be used in Boolean conditional statements
> >
> > #if (Q = <1, 1, 1>)
>
> #if (VEq(Q,<1,1,1>)
>

That's interesting; didn't know it could be done. But other comments here imply
that <1,1,1> is actually <1,1,1,0,0>. In which case, #if(VEq...) would still
return 0 or "false"(?). Unless VEq5D is used; but the vector would still need
<1,1,1,1,1>, not <1,1,1>, for even VEq5D to return "true."

Am I understanding this correctly?


Post a reply to this message

From: clipka
Subject: Re: command capability / syntax
Date: 26 May 2017 14:00:11
Message: <59286d2b$1@news.povray.org>
Am 26.05.2017 um 19:31 schrieb Kenneth:
> dick balaska <dic### [at] buckosoftcom> wrote:
>> Am 2017-05-25 08:00, also sprach Bald Eagle:
>>> I was wondering if:
>>>
>>> vectors can be used in Boolean conditional statements
>>>
>>> #if (Q = <1, 1, 1>)
>>
>> #if (VEq(Q,<1,1,1>)
>>
> 
> That's interesting; didn't know it could be done. But other comments here imply
> that <1,1,1> is actually <1,1,1,0,0>. In which case, #if(VEq...) would still
> return 0 or "false"(?). Unless VEq5D is used; but the vector would still need
> <1,1,1,1,1>, not <1,1,1>, for even VEq5D to return "true."
> 
> Am I understanding this correctly?

No.

<1,1,1> is /not/ <1,1,1,0,0>.

But if you use <1,1,1> in any context where a 5-dimensional vector is
expected, it will automatically be /expanded/ to <1,1,1,0,0>.

VEq(A,B) compares the first three components of A and B. If the vectors
have more components, those are simply ignored.


Post a reply to this message

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