PDA

View Full Version : normalValue = @0,0,[email protected];



dulo
12-13-2011, 04:47 AM
pointNorm = <0,0,0>;
normalValue = @0,0,[email protected];

whats the difference of these two lines, what is the purpose of the @ notation in the normalValue line ??

evenflcw
12-13-2011, 06:15 AM
The <0,0,0> notation creates a vector, a special lscript variable type containing 3 numbers, no more, no less. It's intended use is for 3d vectors/point locations (and rgb values to a lesser extent). These can be accessed individually through the data members, var.x .y .z or .h .p .b. You can also perform arithmetic operations with the vectors directly, rather than do it individually for each dimension, ie vectorC = vectorA + vectorB, rather than vectorC.x = vectorA.x + vectorB.x, vectorC.y = ...

The @0,0,[email protected] notation creates an array for three numbers, but the values can be any type, and the length of the array can be 0 or n (any length although more than a couple of thousand is likely not to be recommended in lscript; can grow dynamically, although that is best avoided aswell). Individual elements can be accessed using var[1...n] etc. It has none of the conveniences of the vector type.

Why somebody would use a 3-length array in place of a vector? I don't know, it depends on the situation.

dulo
12-13-2011, 06:22 AM
I found the notation in several lscripts which ship with lightwave and i suspected that it would the something like "packed data", but i think the vector notation could be used in most of the cases ...