POV-Ray : Newsgroups : povray.advanced-users : command capability / syntax Server Time: 18 Jun 2019 16:51:03 GMT
 command capability / syntax (Message 1 to 8 of 8)
 From: Bald Eagle Subject: command capability / syntax Date: 25 May 2017 12:05:00 Message:
```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?
```
 From: clipka Subject: Re: command capability / syntax Date: 25 May 2017 12: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.
```
 From: dick balaska Subject: Re: command capability / syntax Date: 26 May 2017 08: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
```
 From: Le Forgeron Subject: Re: command capability / syntax Date: 26 May 2017 09: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
```
 From: Bald Eagle Subject: Re: command capability / syntax Date: 26 May 2017 12:00:00 Message:
```Le_Forgeron <jgr### [at] freefr> wrote:

> #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.
```
 From: Le Forgeron Subject: Re: command capability / syntax Date: 26 May 2017 15:00:06 Message: <592842f6\$1@news.povray.org>
```Le 26/05/2017 Ã  13:57, Bald Eagle a Ã©crit :
> Le_Forgeron <jgr### [at] freefr> wrote:
> 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.
```
 From: Kenneth Subject: Re: command capability / syntax Date: 26 May 2017 17:35:05 Message:
```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?
```
 From: clipka Subject: Re: command capability / syntax Date: 26 May 2017 18: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.
```