Previous:Vector Operators Main Index Next:Built-in Vector Identifiers

#### Operator Promotion

You may use a lone float expression to define a vector whose components are all the same. POV-Ray knows when it needs a vector of a particular type and will promote a float into a vector if need be. For example the POV-Ray `scale` statement requires a three component vector. If you specify `scale 5` then POV-Ray interprets this as `scale <5,5,5>` which means you want to scale by 5 in every direction.

Versions of POV-Ray prior to 3.0 only allowed such use of a float as a vector in various limited places such as `scale` and `turbulence`. However you may now use this trick anywhere. For example...

     box{0,1}  // Same as box{<0,0,0>,<1,1,1>}

     sphere{0,1} // Same as sphere{<0,0,0>,1}

When promoting a float into a vector of 2, 3, 4 or 5 components, all components are set to the float value, however when promoting a vector of a lower number of components into a higher order vector, all remaining components are set to zero. For example if POV-Ray expects a 4D vector and you specify `9` the result is `<9,9,9,9>` but if you specify `<7,6>` the result is `<7,6,0,0>`.

Previous:Vector Operators Main Index Next:Built-in Vector Identifiers