POV-Ray : Newsgroups : povray.advanced-users : How to address last 2 components of 5-component vectors? : Re: How to address last 2 components of 5-component vectors? Server Time
3 May 2024 03:23:41 EDT (-0400)
  Re: How to address last 2 components of 5-component vectors?  
From: Bald Eagle
Date: 7 Jul 2016 19:10:00
Message: <web.577ee122ff0686005e7df57c0@news.povray.org>
Suggested language for that section:

This is a vector function, since it returns a 5-component color vector of the
rgbft type which can then be used in other functions to generate isosurfaces.
The function must be declared before the vector data can be accessed.
Any individual component of the rgbft vector can then be used just like any
other variable.  When using the vector component identifiers, you have to
specify exactly which component of the color vector should be used, and that is
done with the "dot notation."

For the examples below, refer to the above pigment function: fn_Pigm(x,y,z)

When the pigment function is evaluated for any <x, y, z>, it returns a color
vector as a result
That color vector has five "terms" or "components" which define the pigment in
3D space for every x, y, and z.
Several components have equivalent and interchangeable "dot" notations which is
useful depending upon what the vector is describing - a point in space, a color,
or uv-mapped points.

To specify these individual vector components, use the following "dot" types:

fn_Pigm( ).x | fn_Pigm( ).u | fn_Pigm( ).red
to get the red value of the color vector
(or the first term of _any_ 3, 4, or 5-term vector)
All 3 dot notations for the vector component refer to the same value and so give
the same result.  All of the below notations work in an analogous manner.

fn_Pigm( ).y | fn_Pigm( ).v | fn_Pigm( ).green
to get the green value of the color vector
(or the second term of _any_ 3, 4, or 5-term vector)

fn_Pigm( ).z | fn_Pigm( ).blue
to get the blue value of the color vector
(or the third term of _any_ 3, 4, or 5-term vector)

fn_Pigm( ).filter | fn_Pigm( ).t
to get the filter value of the color vector
(or the fourth term of _any_ 4 or 5-term vector)
[*For clarity, note that this is .filter, spelled-out, or .t _not_ .f]

fn_Pigm( ).transmit
to get the transmit value of the color vector
(or the fifth term of _any_ 5-term vector)
[*For clarity, note that this is .transmit, spelled-out, _not_ .t]

There is also a special-purpose operator, which returns a weighted grayscale
value:

fn_Pigm( ).gray to get the gray value of the color vector
The internal formula for calculating this gray value is as follows:
gray value = Red*0.297 + Green*0.589 + Blue*0.114

[The alternate spelling, ".grey", and .g are not supported as of version 3.7]

[Also, POV-Ray calculates heightfield values from vector data. Although that
value cannot currently be accessed with dot notation like the grayscale values,
the formula for calculating a heightfield value is:  hf value = (Red +
Green/255)*0.996093]


Post a reply to this message

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