# Reference Talk:Vector Expressions

From question of Bald Eagle in povray.advanced-users, 2016-07-07, that page is missing how to access the fifth component of a 5D vector.

The answer is to see it as a colour: .red, .green, .blue, .filter, .transmit

x,u,red -> 1st

y,v,green -> 2nd

z,blue -> 3rd

t,filter -> 4th

transmit -> 5th

(as a colour, there is also .grey, but that's another story)

The page Vector sends to Numeric Expression, but that one dismiss any details about DOT_ITEM by sending back to Vector / Colour Pages, none of which cover the subject.

--Le Forgeron 14:50, 7 July 2016 (UTC)

As stated in the talk page of Vector Expressions: The page Vector sends to Numeric Expression, but that one dismiss any details about DOT_ITEM by sending back to Vector / Colour Pages, none of which cover the subject.

In Numerics Expressions page, we have "The DOT_ITEM syntax is actually a vector or color operator but it returns a float value. See Vector Operators or Color Operators for details".

It reminds me of the house that get you mad, in Asterix (The twelve tasks of Asterix, 8th task): To get permit A38, you need the blue sheet... to get the blue sheet, you need to apply with the pink and green ...

Here the loop is smaller, but no one would give a newbie the information about getting a component from a vector (or colour).

I would suggest to leave "Numeric_Expressions" as it is so far, and adding, in both "Vector_Expressions" and "Colour_Expressions", a dedicated section about getting individual component out of a vector and colour.

In that section, the illustration of dot item with a basic example. Such as:

``` #declare Vector = < 1, 2, 3, 4, 5>;
#declare First_Component_1 = Vector.red;// 1
#declare First_Component_2 = Vector.u;// 1
#declare First_Component_3 = Vector.x;// 1
#declare Second_Component_1 = Vector.green;// 2
#declare Second_Component_2 = Vector.v;// 2
#declare Second_Component_3 = Vector.y;// 2
#declare Third_Component_1 = Vector.blue;// 3
#declare Third_Component_2 = Vector.z;// 3
#declare Fourth_Component_1 = Vector.filter;// 4
#declare Fourth_Component_2 = Vector.t;// 4
#declare Fifth_Component = Vector.transmit;// 5
```

(and repeat with a Colour= rgbtf <...> )

The section need a visible title (visible in Table of content)

--Le Forgeron 17:46, 7 July 2016 (UTC)

## Functions (max_extent 3.7.1 changes)

• Suggest replacing existing max_extent(pigment_indetifier) discussion with the following to match 3.7.1 changes.

Version 3.7 added support for reading the x,y pixel resolution of an image via a pigment identifier. Version 3.7.1 extends this support to images and df3 files used in normal and density identifiers.

When the identifier is passed to max_extent(), the resolution is returned as a 3 value vector. In the case of images the z value of the vector is set to 0.

A background matte example:

```#declare MatteImage = pigment { image_map { "YourImage.jpg" } }

#declare Resolution = max_extent ( MatteImage );

#declare MatteNormalizationScale =
<min(1,Resolution.x/Resolution.y),
min(1,Resolution.y/Resolution.x),1>;

box { 0, <1,1,0.001>
pigment { MatteImage }
scale MatteNormalizationScale // Fit matte to unit square
scale MatteSceneScale // Size matte for scene
}
```

To fit a df3 with unequal x,y,z ranges inside unit cube without distortion, the set up for the scaling variable is:

```#declare Density0 = density { density_file df3 "A20x30x40.df3" interpolate 0 }
#declare Df3MapRange = max_extent(Density0);
#declare Df3NormalizationScale =
<min(1,Df3MapRange.x/max(Df3MapRange.y,Df3MapRange.z)),
min(1,Df3MapRange.y/max(Df3MapRange.x,Df3MapRange.z)),
min(1,Df3MapRange.z/max(Df3MapRange.x,Df3MapRange.y))>;
```