hou.hmath module
Houdini and 3D related math functions.
Functions
buildRotate(rx, ry, rz, order="xyz") -> Matrix4 OR buildRotate(self, values, order="xyz")→ Matrix4buildRotateAboutAxis(axis, angle_in_deg)→ Matrix4buildRotateToFrame(new_z_axis, new_y_axis)→ Matrix4buildScale(sx, sy, sz)→ Matrix4 ORbuildScale(values)→ Matrix4buildShear(sxy, sxz, syz) -> Matrix4 OR buildShear(values)→ Matrix4-
Return a shear matrix for the given shear components.
buildTranslate(tx, ty, tz) -> Matrix4 OR buildTranslate(values)→ Matrix4-
Returns a translation matrix for the given translation vector.
clamp(value, min, max)-float-
Returns the value clamped to the range
mintomax. See also hou.math.wrap. degToRad(degrees)→ doublefit(value, old_min, old_max, new_min, new_max)-
Returns a number between
new_minandnew_maxthat is relative to thevaluebetween the rangeold_minandold_max. If the value is outside theold_mintoold_maxrange, it will be clamped to the new range. fit01(value, new_min, new_max)→float-
Returns a number between
new_minandnew_maxthat is relative to thevaluebetween the range 0 and 1. If the value is outside the 0 to 1 range, it will be clamped to the new range. fit10(value, new_min, new_max)→float-
Returns a number between
new_minandnew_maxthat is relative to thevaluebetween the range 1 to 0. If the value is outside the 1 to 0 range, it will be clamped to the new range. fit11(value, new_min, new_max)→float-
Returns a number between
new_minandnew_maxthat is relative to thevaluebetween the range -1 to 1. If the value is outside the -1 to 1 range, it will be clamped to the new range. identityTransform()→ Matrix4-
Returns the identity matrix.
Note that the default value for a hou.Matrix4 object is the zero matrix, not the identity matrix.
>>> hou.hmath.identityTransform() <hou.Matrix4 [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]>
modularBlen(value1, value2, modulus, blend_factor)noise1d(self, pos)→float-
Generates 1 dimensional noise. The position passed in should be a sequence of 1 to 4 floats, representing the position in N-dimensional space. The return value is always a single float.
This function matches the output of the noise function from VEX.
noise3d(self, pos)→ hou.Vector3-
Generates 3 dimensional noise. The position passed in should be a sequence of 1 to 4 floats, representing the position in N-dimensional space. The return value is a hou.Vector3 object representing the vector noise at the given position.
This function matches the output of the noise function from VEX.
radToDeg(radians)→doublerand(seed)→float-
Returns a pseudo-random number from 0 to 1. Using the same
seedshould always give the same result. sign(value)→int-
Returns 1 if
valueis positive, -1 if negative and 0 if thevalueis 0. smooth(value, min, max)→float-
Takes a value and range and returns a smooth interpolation between 0 and 1.
When
valueis less thanmin, the return value is 0. Ifvalueis greater thanmax, the return value is 1.>>> hou.hmath.smooth(5, 0, 20) 0.15625 >>> hou.hmath.smooth(10, 0, 20) 0.5 >>> hou.hmath.smooth(15, 0, 20) 0.84375
sparseConvolutionNoise(pos3)→ floatsparseConvolutionTurbulantNoise(pos3, depth)→ floatturbulantNoise(pos3, depth)→ floatwrap(number, min, max)-
Similar to the hou.math.clamp function in that the resulting value will always fall between the specified minimum and maximum value. It will, however, create a saw-tooth wave for continuously increasing or decreasing values of the value.