VNorm
Parallel vector with unit length VGen
See also: VLength
Description
VNorm computes a normalized vector parallel to v
with length 1
. For scalar values this is equivalent to the sign
operation, returning -1 for all values < 0, 0 for 0, and +1 for all values > 0.
Supported Rates: frame, shape, pixel
Class Methods
VNorm.fr(v)
VNorm.sr(v)
VNorm.pr(v)
Make a VNorm VGen at requested rate.
Arguments
v
The input vector.
Returns:
A vector parallel to v but with unit length.
dimensions
input |
output |
1 |
1 |
2 |
2 |
3 |
3 |
4 |
4 |
Examples
// This example draws the unit circle by using VStep to only draw white
// when the distance between the position and the normalized position is
// within 0.1.
(
~normDist = ScinthDef.new(\normDist, {
var pos = VNormPos.pr;
VBWOut.pr(VStep.pr(0.9, 1.0 - VDistance.pr(pos, VNorm.pr(pos))));
}).add;
)
(
~k = Scinth.new(\normDist);
)
Last modified July 28, 2020: Update for a 0.0.7 Scintillator release (#5) (0177d81)