VEX101 – pt. 6: Generating Randomness by Moritz 09.10.2019 comments 4 Part of: VEX 101 Premium Course, VEX 101 Premium Content To view this content, you must be a member of Entagma's Patreon at $29 or more Unlock with Patreon
Thank you for these tutorials, am having trouble understanding
f@pscale = pscale;
What is the f for, If I type @pscale = pscale; , I get the same results in my Geo spreadsheet with no errors, is this correct?. I understand its setting the pscale in the geo att. Thanks you Ben
letters in front of the @ explicitly specify the attribute’s data type. In our case the “f” denotes a float. Most of the time Houdini automatically selects the correct data type for the attribute, especially if we’re working on built-in attributes such as pscale. However to be sure and have control over what’s happening, I prefer explicitly typing my attributes using the data type before the @. For a list of attribute data types see: https://www.sidefx.com/docs/houdini/vex/snippets.html#attributes
While working through this lesson I’ve found something interesting about the fit() functions that I suspect will apply to others as well: when operating a vector with uniform values, a float can be used instead of a complete vector. For example, fit01(randdir, -1.0, 1.0); has the same effect as expanding those values into 3-element vectors.
Thanks again for the excellent lessons!
On further experimentation, integers work as well and are automatically converted to floats. I appreciate what you said about explicitly typing attributes, but since these values are to be converted to vectors anyway (which are always made up of floats if I understand correctly), perhaps it’s not as important in this case.