hou.hmath module

Houdini and 3D related math functions.

All Functions Replaces

Functions

buildRotate(rx, ry, rz, order="xyz") -> Matrix4 OR buildRotate(self, values, order="xyz") → Matrix4

Not documented yet

buildRotateAboutAxis(axis, angle_in_deg) → Matrix4

Not documented yet

buildRotateToFrame(new_z_axis, new_y_axis) → Matrix4

Not implemented yet

buildScale(sx, sy, sz) → Matrix4 OR buildScale(values) → Matrix4

Not documented yet

buildShear(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 min to max. See also hou.math.wrap.

degToRad(degrees) → double

Not documented yet

fit(value, old_min, old_max, new_min, new_max)

Returns a number between new_min and new_max that is relative to the value between the range old_min and old_max. If the value is outside the old_min to old_max range, it will be clamped to the new range.

fit01(value, new_min, new_max)float

Returns a number between new_min and new_max that is relative to the value between 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_min and new_max that is relative to the value between 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_min and new_max that is relative to the value between 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)

Not implemented yet

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)double

Not documented yet

rand(seed)float

Returns a pseudo-random number from 0 to 1. Using the same seed should always give the same result.

sign(value)int

Returns 1 if value is positive, -1 if negative and 0 if the value is 0.

smooth(value, min, max)float

Takes a value and range and returns a smooth interpolation between 0 and 1.

When value is less than min, the return value is 0. If value is greater than max, 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) → float

Not implemented yet

sparseConvolutionTurbulantNoise(pos3, depth) → float

Not implemented yet

turbulantNoise(pos3, depth) → float

Not implemented yet

wrap(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.

Replaces

clamp expression function , deg expression function , fit01 expression function , fit10 expression function , fit11 expression function , fit expression function , identity expression function , modblend expression function , morient expression function , noise expression function , rad expression function , rand expression function , rotate expression function , rotaxis expression function , noise expression function , scale expression function , sign expression function , smooth expression function , snoise expression function , sturb expression function , translate expression function , turb expression function , wrap expression function