 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
I find that I can use the following code:
#declare a = 1;
#sphere {a,a pigment{color rgb a}}
Furthermore, the following code:
#declare a = 1;
#sphere {a.x,a pigment{color rgb a}}
gives the same result, i.e. a.x gives the x component, which is 1, which
is then re-interpreted as the vector <1,1,1>
Obviously not good style, but is "a" held internally both as a float and
as a vector? I appreciate any insight into this.
--
Kaveh
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Kaveh" <kav### [at] delete_this focalimage com> wrote in message
news:1flqk0y.1vw6141xu6fckN%kaveh@delete_this.focalimage.com...
>
> #declare a = 1;
> #sphere {a.x,a pigment{color rgb a}}
>
> gives the same result, i.e. a.x gives the x component, which is 1, which
> is then re-interpreted as the vector <1,1,1>
>
> Obviously not good style, but is "a" held internally both as a float and
> as a vector? I appreciate any insight into this.
I believe it is interpreted at the place where it is used, as in the
position of a sphere being a vector if given only a float and same for
color. I don't think a declared float is stored as a vector since it would
be an error if used for other things that require a nonvector.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Sat, 16 Nov 2002 00:23:50 -0500, Kaveh quoth:
> I find that I can use the following code:
>
> #declare a = 1;
This creates a variable named "a" that stores the value "1" as a
double-precision floating-point number.
> #sphere {a,a pigment{color rgb a}}
This uses "a" as a color, so it gets promoted to the 5 component vector
<1,1,1,0,0> temporarily. It's still stored as a float.
> Furthermore, the following code:
>
> #declare a = 1;
> #sphere {a.x,a pigment{color rgb a}}
>
> gives the same result, i.e. a.x gives the x component, which is 1, which
> is then re-interpreted as the vector <1,1,1>
a.x is a vector expression, so "a" gets promoted to the 3 component
vector <1,1,1>. It's still a float. See section 6.1.4.4 "Operator
promotion" of the manual for more information.
--
Mark
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Mark Wagner <mar### [at] gte net> wrote:
[...]
> a.x is a vector expression, so "a" gets promoted to the 3 component
> vector <1,1,1>. It's still a float. See section 6.1.4.4 "Operator
> promotion" of the manual for more information.
Thank you Mark. It's the 'temporary promotion' that explains it. I will
look at the manual.
--
Kaveh
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |