Expressions

abs

float abs (float number)
	This is a mathematical function used to express the absolute
	value of the number.


		eg.  abs (-2.6)=2.6


acos

float acos (float number)
	This is a trigonometric mathematical function used to express
	the arccosine value of the number.


		eg.  acos (0)=90


arclen

float arclen (string SOP, float prim_num, float ustart, float ustop)
	Computes the length of the curve specified by prim_num in the range
	[ustart, ustop]. ustart and ustop are unit values, defined in the [0,1]
	interval.


	Note: the primitive must be either a NURBS, Bezier, or Polygon curve.


	For example:
		arclen("/obj/geo1/model1", 12, 0, 1)
	Will compute the length of the entire curve whose index is 12.


See also: surflen, normal, curvature, unituv


arg

string arg (string line, float argNum)
	This function extracts an argument from a line. The example
	below will extract the time out of the date string returned
	by the system function.


		eg.  arg (system(date), 3)=20:17:46


argc

float argc (string line)
	Returns the number of arguments in the line. Counts the number
	of arguments in the line.  Standard parsing is done, no variable
	expansion is done on the line.


		eg.  argc("This has four arguments")=4


arm

float arm (string sop_path, string ret_type)
	This function will extract inverse kinematic rotations from an arm sop.
	This is useful for creating hierarchical systems that mimic the arm.
	The sop_path is the full path of the arm sop.
	The ret_type is one of: srx, sry, arx, ury, hrx, hry, hrz,
	                        Hrx, Hry, Hrz, Htx, Hty, Htz
	The ret_type is the returned rotation, where:
		s=shoulder, a=humerus, u=ulna, h=hand, H=hand relative to shoulder
	    eg.  arm ("/obj/geo1/arm1", "arx")


	Note: the shoulder oxorder should be yx, hand should be xyz


asin

float asin (float number)
	This is a trigonometric mathematical function used to express
	the arcsine value of the number.


		eg.  asin (.866025)=60


atan

float atan (float number)
	This is a trigonometric mathematical function used to express
	the arctangent value of the number.


		eg.  atan (1.73205)=60


atan2

float atan2 (float y, float x)
	Compute the arctangent of y/x.  This is more stable than atan() since
	it can use the signs of y and x to determine the quadrant the angle
	is in.  It also handles the case where x is zero correctly, returning
	90 or -90.


		eg.  atan2(1, 0) = 90
		     atan2(0, 1) = 0
		     atan2(0, -1) = 180


atof

float atof (string source)
	Will forcibly convert a string into a float.


bbox

float bbox (string SOP, float type)
	This function will return bounding box information for a SOP.  The
	type can be one of D_XMIN, D_YMIN, D_ZMIN, D_XMAX, D_YMAX, D_ZMAX,
	D_XSIZE, D_YSIZE, or D_ZSIZE for the corresponding values of the
	bounding box.


bezier

float bezier ()
	This is a channel expression that yields a Bezier interpolation spline.


boneangle

float boneangle (string bone1, string bone2)
	This function will return the angle at the joint between the two given
	bone objects.

ceil

float ceil (float)
	Returns the smallest integer not less than the value passed in.


See also: floor, round, int, trunc, frac

centroid

float centroid (string SOP, float type)
	This function will return centroid information for a SOP.  The
	type can be one of D_X, D_Y, D_Z for the corresponding components
	of the centroid.

ch

float ch (string channel)
	Will evaluate the channel specified.


See also: chf, cht, chs, chsraw


chexist

float chexist (string channel_name)
	This function returns 1 if the specified channel exists, 0 if it doesn't.


		eg.  echo `chexist("/obj/geo1/tx")`

chf

float chf (string channel, float frame)
	Will evaluate the channel at the frame specified.


See also: ch, cht, chs, chsraw


chgroup

string chgroup (string group_name)
	This will return a string containing all of the channels contained
	in the group specified.  It is useful in the command language
	for traversing all channels in a group:
		eg. 	%  foreach channel ( `chgroup("group_name")` )
			%     echo $channel is in group_name
			%  end

chop

float chop (string channel)
	Evaluates the channel within a CHOP at the current time.
		eg.	chop("/ch/ch1/wave1/chan1")


See also: chopi, chopt, chopf, chopstr


chopcf

float chopcf (string CHOP, float channel_index, float frame)
	Evaluates the channel at index 'channel_index' within the specified CHOP 
	at the specified frame.
		eg.	chopcf("/ch/ch1/wave1", 0, 11)


See also: chopf, chopct, chopci


chopci

float chopci (string CHOP, float channel_index, float index)
	Evaluates the channel at index 'channel_index' within the specified CHOP 
	at the specified sample index.
		eg.	chopci("/ch/ch1/wave1", 0, 10)


See also: chopi, chopct, chopcf


chopct

float chopct (string CHOP, float channel_index, float time)
	Evaluates the channel at index 'channel_index' within the specified CHOP 
	at the specified time.
		eg.	chopct("/ch/ch1/wave1", 0, 0.5)


See also: chopt, chopcf, chopci


chope

float chope (string CHOP)
	Returns the end index of the channels in the specified CHOP.
		eg.	chope("/ch/ch1/wave1")


See also: chops, chopl, chopn, chopr


chopf

float chopf (string channel, float frame)
	Evaluates the channel within a CHOP with at the specified frame.
		eg.	chopf("/ch/ch1/wave1/chan1", 1)


See also: chopi, chopt, chop


chopi

float chopi (string channel, float index)
	Evaluates the channel within a CHOP with at the specified sample index.
		eg.	chopi("/ch/ch1/wave1/chan1", 10)


See also: chopf, chopt, chop


chopl

float chopl (string CHOP)
	Returns the length of the channels in the specified CHOP, in samples.
		eg.	chopl("/ch/ch1/wave1")


See also: chops, chope, chopn, chopr


chopn

float chopn (string CHOP)
	Returns the number of data channels within the specified CHOP.
		eg.	chopn("/ch/ch1/wave1")


See also: chops, chope, chopl, chopr


chopr

float chopr (string CHOP)
	Returns the sample rate of the specified CHOP.
		eg.	chopr("/ch/ch1/wave1")


See also: chops, chope, chopl, chopn


chops

float chops (string CHOP)
	Returns the start index of the specified CHOP.
		eg.	chops("/ch/ch1/wave1")


See also: chops, chope, chopl, chopn, chopr


chopstr

string chopstr (string channel)
	Returns the value of the channel within a CHOP at the current time
	as a text string.
		eg.	chopstr("/ch/ch1/wave1/chan1")


See also: chop, chopf, chopt, chopi


chopt

float chopt (string channel, float time)
	Returns the value of the channel within a CHOP at the time specified.
		eg.	chopt("/ch/ch1/wave1/chan1", 0.5)


See also: chopct, chopi, chopf, chopt


chs

string chs (string channel)
	Will evaluate the channel as a string.  This is useful for evaluating
	filenames in parameters.  The string will be expanded automatically by
	this function (at the current time).


See also: ch, chf, cht, chsop, chsraw


chsop

string chsop (string channel)
	Will evaluate the channel as a string.  This string is assumed to be a path
	to one or more nodes, node groups, or bundle names.  If the nodes or groups
	are specified as relative paths, they are converted to absolute paths
	using the referenced node as the source for the relative paths.


See also: ch, chf, chs, chsraw, cht


chsraw

string chsraw (string channel)
	This function returns the raw string expression from a parameter or
	channel as a string. Variables will NOT be expanded. If the given
	path is a channel, then it returns the expression of the channel
	that is evaluated at the current time.


See also: ch, chf, chs, chsop, cht


cht

float cht (string channel, float time)
	Will evaluate the channel at the time specified.


See also: ch, chf, chs, chsraw


clamp

float clamp (float value, float minimum, float maximum)
	This is a Houdini expression function that will clamp the value
	between the minimum and maximum numbers. It is used to prevent
	the value from going outside the specified range.


		i.e. If the value is less than the minimum number, the
		minimum number will be returned. If the value is greater
		than the maximum number, the maximum number will be returned.


clamptosphere

float clamptosphere (float x, float y, float z, float min_radius, float max_radius, string constant_type)
	This function computes a vector R that is  parallel to the 
	given (x,y,z) vector.  R is adjusted so that its magnitude 
	is always between the min and max radii 
	(i.e min_radius <= |R| <= max_radius)


	This function returns one of the components of the vector 
	R according to the value of constant_type: "X", "Y" or "Z".

constant

float constant ()
	This is a channel expression for a constant value.


cos

float cos (float number)
	This is a trigonometric mathematical function used to express
	the cosine value of the number.


	        eg.  cos (60)=0.5


cosh

float cosh (float number)
	This is a mathematical function used to express the hyperbolic
	cosine value of the number.


	        eg.  cosh (2) = 3.7622


cross

vector cross (vector v1, vector v2)
	Computes the cross product between v1 and v2

cubic

float cubic ()
	A channel interpolation function which uses the slopes at either
	end to solve the differential equation to give a smooth curve between
	the end points.


cucwc

string cucwc ()
	Returns the name of the current working container (for custom panels).

cudatatype

string cudatatype (string gadget_path)
	Returns the type of data manipulated by the specified gadget.  Possible
	values are float, int, and string.

cumenuadd

string cumenuadd (string gadget_path, string menu_entry)
	Adds the specified menu entry to the given gadget if it is a menu.  Returns
	the entry if added.

cuquery

string cuquery (string panel_path, string value_name)
	Returns the specified value from the specified panel.

curvature

float curvature (string SOP, float prim_num, float u, float v)
	Evaluates the curvature of the surface at the parametric (u,v) location. u and
	v are unit values, defined in the [0,1] interval.


	Note: if the primitive is a mesh, u and v are defined in terms its number of
	rows and columns.


See also: unituv, primuv, primduv, normal


cutype

string cutype (string gadget_path)
	Returns the type of the specified gadget.

cycle

float cycle (float f1, float f2)
	A channel interpolation function which repeats the motion between
	frames f1 and f2. Each repeated portion will have its first value set
	to the last value of the previous cycle. If you wish to repeat motion
	exactly, use the repeat function instead.


	If f1 is less than f2, then it will cycle forwards from f1 to f2.
	If f2 is less than f1, then it will cycle backwards from f2 to f1.


See also: cyclet, repeat, repeatt


cyclet

float cyclet (float t1, float t2)
	A channel interpolation function which repeats the motion between
	times t1 and t2. Each repeated portion will have its first value set
	to the last value of the previous cycle. If you wish to repeat motion
	exactly, use the repeatt function instead.


	If t1 is less than t2, then it will cycle forwards from t1 to t2.
	If t2 is less than t1, then it will cycle backwards from t2 to t1.


See also: cycle, repeat, repeatt


deg

float deg (float radians)
	Converts the radians value to a value measured in degrees.


degree

float degree (string SOP, float prim_num, float D_U|D_V)
	Returns the degree of the polynomial defining the face or hull whose primitive
	number is specified. Polygons and meshes are expressed as linear functions,
	so their degree is 1. Spline types -- NURBS and Bezier curves and surfaces --
	have degrees ranging from 1 to 10.


	Note: If the primitive is a polygon or a curve, D_U and D_V are irrelevant.


detail

float detail (string SOP, string attrib_name, float attrib_index)
	This function can be used to get infromation about the specified SOP's
	detail attributes.


	For example:
		detail("/obj/geo1/attribpromote1", "area", 0)
	Would return the total area of the geometry, if the geometry had first
	been measured and then AttribPromote had promoted the area primitive
	attribute to a detail attribute with Add as the promotion method.


details

string details (string SOP, string attribute)
	This function will return the value of a string attribute for a given
	SOP.


	For example:
		details("/obj/geo1/attribcreate1", "varmap")
	Will return the currently bound index attribute's value.


determinant

float determinant (matrix mat)
	Returns the determinant of the matrix specified.  This is only valid
	if the matrix is a 4x4 or 3x3 matrix.  If the matrix is larger than
	4x4, the 4x4 determinant will be returned.  If the matrix is smaller
	than 3x3, the matrix will be converted to a 3x3 before the determinant
	is computed.  The results of the upward conversion are not guaranteed.

dihedral

matrix dihedral (vector v0, vector v1)
	Computes the dihedral matrix between v0 and v1.  This is a rotation
	matrix which will rotate vector v0 to vector v1.

distance

float distance (float x1, float y1, float z1, float x2, float y2, float z2)
	Returns sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2), the distance between the
	given points.


See also: pointdist, uvdist

dot

float dot (vector v0, vector v1)
	Computes the dot product between two vectors.

ease

float ease ()
	This is a channel expression function which will slowly ease in to
	and out of any change. It will start at rest and slowly increase the
	amount of change then, near the end of the function gradually reduce
	the amount of change until it is at rest.


easein

float easein ()
	This is a channel expression function which will slowly ease in to
	any change.


easeinp

float easeinp (float)
	This is a channel expression function which will slowly increase
	the motion of the model to its maximum value. This is similar to
	the motion of an object accelerating due to gravity.


easeout

float easeout ()
	This is a channel expression function which will slowly ease out
	of any change and come to rest.


easeoutp

float easeoutp (float number)
	This is a channel expression function which is similar to the easeinp
	expression only reversed. The change starts rapidly and begins to slow
	until it comes to rest.  The number determines the inflection point of
	the curve.  Increasing the number will shift the inflection point
	to the right.  Fractional numbers will towards zero will shift the
	inflection point to the right.  


easep

float easep (float number)
	This is a channel expression which will gradually ease in to the 
	motion and gradually ease out. The ease out is faster than the 
	ease in.


eval

float eval (string expression)
	This function will evaluate the string passed in as an expression.
	It's primary use is for evaluating variables which contain more
	complex expressions.  This function returns a floating point value.


	    e.g.	set foo = 1+2
			echo `eval($foo)`


evals

string evals (string expression)
	This function will evaluate the string passed in as an expression.
	It's primary use is for evaluating variables which contain more
	complex expressions.  This function returns a string value.


	    e.g.	set foo = system("ls")
			echo `evals($foo)`


execute

string execute (string command)
	This expression will execute the given houdini command (enclosed in 
	quotes)
	eg. execute("list") is the same as typing list in the text port


exp

float exp (float number)
	This is a logarithmic exponentiation function.


		eg.  exp (2)= 7.3338906


explodematrix

float explodematrix (matrix mat, string trs, string xyz, string component)
	This explodes a 3x3 or 4x4 matrix into the euler rotations required to
	rebuild it.  These components can be stuffed directly into Houdini
	rotation, scale, and translate channels.


	mat is the matrix to transform.  trs and xyz give the order of the
	expansion.  In trs, a "t" represents translation, "r" rotation, and
	"s" scale.  The xyz refers to the order of the rotations.  The
	component is a string describing which channel to extract.  It is
	"[trs][xyz]", where the trs chooses the channel between translate,
	rotate, and scale, and the xyz chooses the dimmension.


	For example:
	    explodematrix(mlookat(vector("[1,0,0]"),vector("[0,1,0]")),
			  "RST", "XYZ", "RZ")
	    explodematrix(identity(3)*2, "RST", "XYZ", "SZ")

findfile

string findfile (string filename)
	This function will search the houdini path for a specified file.  The
	filename specified should be relative to the houdini directory.  For
	example:
		findfile("scripts/123.cmd")
		findfile("config/Audio/Error.aiff")


fit

float fit (float num, float oldmin, float oldmax, float newmin, float newmax)
	Return a number between newmin and newmax that is relative 
	to num in the range between oldmin and oldmax.  If the value is
	outside the old range, it will be clamped to the new range.


		eg.  fit(3,1,4,5,20)=15


See also: fit01, fit11, fit10


fit01

float fit01 (float num, float newmin, float newmax)
	Return a number between newmin and newmax that is relative to num in
	the range between 0 and 1.  If the value is outside the 0 to 1 it
	will be clamped to the new range.


		eg.  fit01(.3,5,20)=9.5


See also: fit, fit11, fit10

fit10

float fit10 (float num, float newmin, float newmax)
	Return a number between newmin and newmax that is relative to num in
	the range between 1 and 0.  If the value is outside the 1 and 0 it
	will be clamped to the new range.


		eg.  fit(.3,5,20)=15.5


See also: fit, fit01, fit11

fit11

float fit11 (float num, float newmin, float newmax)
	Return a number between newmin and newmax that is relative to num in
	the range between -1 and 1.  If the value is outside the -1 to 1 it
	will be clamped to the new range.


		eg.  fit(.3,5,20)=14.75


See also: fit, fit01, fit10

floor

float floor (float number)
	Returns the largest integer not greater than the number


		eg.  floor(10.2)=10
		     floor(-10.2)=-11


See also: ceil, trunc, int, round, frac


frac

float frac (float number)
	The fractional component of the floating point number.  The fractional
	component is computed using the expression (number - floor(number)),
	which may result in unexpected values for negative numbers.  If
	negative numbers are an issue, you may want to call frac(abs(number)).


		eg.  frac(2.501) = 0.501


See also: trunc, floor, ceil, round, int


ftoa

string ftoa (float number)
	This expression will convert a number to a string. Type conversion
	is usually done automatically, however, you may wish to use this to
	force the conversion.


hasdetailattrib

float hasdetailattrib (string SOP, string attribute)
	This function will return 1 if the specified attribute is in the given
	sop, 0 otherwise.

haspoint

float haspoint (string group_name, string sop, float point_num)
	This function can be used to determine whether a given point is a member
	of a given group.  For example:
		haspoint("ears", "/obj/geo1/facet1", 4)
	Will return 1 if the group "ears" contains point number 4, otherwise it
	will return 0.


	The function will return 0 if the group specified is a primitive group.


See also: hasprim, pointlist, primlist


haspointattrib

float haspointattrib (string SOP, string attribute)
	This function will return 1 if the specified attribute is in the given
	sop, 0 otherwise.

hasprim

float hasprim (string group_name, string sop, float prim_num)
	This function can be used to determine whether a given primitive is a member
	of a given group.  For example:
		hasprim("ears", "/obj/geo1/facet1", 3)
	Will return 1 if the group "ears" contains primitive number 3, otherwise it
	will return 0.


	The function will return 0 if the group specified is a point group.


See also: haspoint, pointlist, primlist


hasprimattrib

float hasprimattrib (string SOP, string attribute)
	This function will return 1 if the specified attribute is in the given
	sop, 0 otherwise.

hasvertexattrib

float hasvertexattrib (string SOP, string attribute)
	This function will return 1 if the specified attribute is in the given
	sop, 0 otherwise.

hsv

float hsv (float red, float green, float blue, string component)
	Converts the RGB value to one of the HSV values based on component
	specified.  The component should be one of "h", "s" or "v".


	Example:   hsv(.3, .6, .4, "h")


ic

float ic (float input_index, float channel_index, float index)
	Evaluates a CHOP's input channel at the specified index.
		eg. ic(0, 2, 10)


See also: ics, ic, ice, icr, icn, icmin, icmax, icl, oc


ice

float ice (float input_index)
	Returns the end index of a CHOP's input.
		eg. ice(0)


See also: ics, ic, ice, icr, icn, icmin, icmax, icl, oc


icl

float icl (float input_index)
	Returns the length of a CHOP's input, in samples.
		eg. icl(0)


See also: ics, ic, ice, icr, icn, icmin, icmax, icl, oc


icmax

float icmax (float input_index, float channel_index)
	Evaluates a CHOP's input channel's maximum value.
		eg. icmax(0, 2)


See also: ics, ic, ice, icr, icn, icmin, icmax, icl, oc

icmin

float icmin (float input_index, float channel_index)
	Evaluates a CHOP's input channel's minimum value.
		eg. icmin(0, 2)


See also: ics, ic, ice, icr, icn, icmin, icmax, icl, oc

icn

float icn (float input_index)
	Returns the number of channels in a CHOP's input.
		eg. icn(0)


See also: ics, ic, ice, icr, icn, icmin, icmax, icl, oc


icr

float icr (float input_index)
	Returns the sample rate of a CHOP's input.
		eg. icr(0)


See also: ics, ic, ice, icr, icn, icmin, icmax, icl, oc


ics

float ics (float input_index)
	Returns the start index of a CHOP's input.
		eg. ics(0)


See also: ics, ic, ice, icr, icn, icmin, icmax, icl, oc


identity

matrix identity (float size)
	Creates an identity matrix of the size specified.  That is, the
	resulting matrix will have size rows and size columns.

if

float if (float expression, float true_value, float false_value)
	If the expression is true, the function evaluates to the
	true_value, otherwise the false_value is returned. The following
	example shows that if the frame number is less than 12, the resulting
	number equals the frame number. When the frame number reaches 12 or
	greater, the resulting number is always 75.


		eg.  if ($F<12, $F, 75)


	Note:  This is a function, which means all parameters to the function
	are evaluated.  So something like
	    if($F > 1, system('echo 1'), system('echo 2'))
	will result in both system calls being run regardless of the result of
	the expression.


index

float index (string source, string pattern)
	Finds the first occurrence of pattern in source and returns the number
	of characters before the pattern occurs.  If the pattern is not found
	-1 is returned.


		eg.   hscript -> echo `index("Testing index", "sting")`
		      2
		      hscript -> echo `index("Testing index", "i")`
		      4


See also: rindex


int

float int (float number)
	The integer value of the number by truncating the fractional parts off.


		eg.  int(2.501)=2
		     int(-2.501)=-2


		     int(0.2)=0
		     int(-.2)=0


See also: trunc, floor, ceil, round


invert

matrix invert (matrix mat)
	Inverts the matrix given.  This is only valid if the matrix is a 4x4
	or 3x3 matrix.  If the matrix is larger than 4x4, the matrix will be
	converted to a 4x4 matrix before it is inverted.  If the matrix is
	smaller than 3x3, the matrix will be enlarged to a 3x3 matrix before
	it is inverted.  The results of enlarging the matrix to a 3x3 are not
	guaranteed.

isclosed

float isclosed (string SOP, float prim_num)
	Returns 1 if the primitive is closed.  This is the same as iswrapu,
	and as such works on both polygonal, NURBS, and Bezier curves and
	surfaces.


See also: iswrapu, iswrapv


iscollided

float iscollided (string sopname, float pointnumber)
	Returns 1 if the point specified has collided with something


	    eg.  iscollided("../particle1", $PT)

ishvariable

float ishvariable (string variable_name)
	Checks only houdini variables to see if variable_name exists.
	Returns a 1 if the variable exists and a 0 if it does not.  System
	variables are not checked.


See also: isvariable


isspline

float isspline (string SOP, float prim_num)
	Returns 1 if the primitive is a spline, i.e. a NURBS or Bezier curve or surface.
	Otherwise, the value returned is 0.


isstuck

float isstuck (string sopname, float pointnumber)
	Will return if the point specified is used by a particle system
	and the point is stuck.  Warning, this function can be slow.


	    eg.   isstuck("../particle1", $PT)

isvariable

float isvariable (string variable_name)
	Is there an houdini or system variable named "variable_name"? Returns
	1 if the variable is defined, and 0 if it doesn't.


See also: ishvariable


iswrapu

float iswrapu (string SOP, float prim_num)
	Returns 1 if the primitive is wrapped in the u direction.  For curves,
	this is the same as isclosed.  


See also: isclosed, iswrapv


iswrapv

float iswrapv (string SOP, float prim_num)
	Returns 1 if the primitive is wrapped in the v direction.  Curves,
	circles, etc, are always consisdered to be unwrapped in this direction
	as they are only parameterized in u.


See also: isclosed, iwrapu


length

float length (float x, float y, float z)
	Returns sqrt(x*x + y*y + z*z), the length of the vector


limb

float limb (string sop_path, string ret_type)
	This function will extract inverse kinematic rotations from a limb sop.
	This is useful for creating hierarchical systems that mimic the limb.
	The sop_path is the full path of the limb sop.
	The ret_type is one of: 
	     HIP_RX0, HIP_RX, HIP_RY, HIP_RZ, KNEE_RX, ANKLE_RX, ANKLE_RY, ANKLE_RZ
	     FOOT_TX, FOOT_TY, FOOT_TZ, FOOT_RX, FOOT_RY, FOOT_RZ
	where
	     HIP_RX0 is the x rotation of a null above the thigh
	     HIP_RX, HIP_RY, HIP_RZ  are the rotations of the thigh
	     KNEE_RX is the x rotation of the shin
	     ANKLE_R* are the rotations of the foot relative to the shin
	     FOOT_R*, FOOT_T* are the world rotates/translates of the foot


	Note: the limb SOP should use +/-Y for its model axis.  All rotation orders
	      are xyz


	    eg.  limb("/obj/geo1/limb1", "KNEE_RX")

linear

float linear ()
	This is a channel interpolation function which will do linear
	interpolation of the end points.


lock

float lock (float float)
	This function simply returns the value of its argument. However, it is
	special in that if an expression is enclosed in a lock function, then
	its values cannot be changed, till the lock expression is removed.

log

float log (float number)
	This is the natural logarithm of the number.


		eg.  log (2.718281828)= 1


log10

float log10 (float number)
	This is the logarithm base 10 of the number.


		eg.  log10 (10) = 1
		     log10(100) = 2


match

float match ()
	This is a channel expression which will match the in coming and
	out going slope.  The curve will move smoothly from the in coming
	value to the out going value.


matchin

float matchin ()
	This is a channel expression which will match the in coming slope and
	extend the previous segment in a straight line from where it completes.


matchout

float matchout ()
	This is a channel expression which will compute a straight line which
	has the same slope as the in coming slope of the next segment.  It will
	compute this straight line so that the value will have a smooth
	transition into the next segment.


matrix

matrix matrix (string pattern)
	Converts a string pattern to a matrix.  The pattern should start with
	a square bracket, followed by a series of rows (specified as vector
	patterns - see the vector() function), followed by a trailing square
	bracket.  For example:
	    matrix("[[1,2,3][2,3,5][-3,2,-3]]")

max

float max (float value1, float value2)
	Returns the larger of value1 or value2.


		eg.  max (5,3)=5


mcols

float mcols (matrix mat)
	Returns the number of columns in a matrix

min

float min (float value1, float value2)
	Returns the smaller of value1 or value2.


		eg.  min (5,3)=3




mindist

float mindist (string SOP, float point_num, string SOP, float prim_num, float return_type)
	Given a point and a primitive, this function will find the distance between 
	the point and the closest spot on the primitive. This expression is an alias
	for pointdist().


See also: pointdist, primdist, distance, uvdist


mlookat

matrix mlookat (vector from, vector to)
	Computes a transform matrix specifying a lookat from the from point to
	the to point.  The from and to vectors are converted to 3 vectors for
	this computation.  The resulting matrix will be a 3x3 matrix.

modblend

float modblend (float val1, float val2, float length, float weight)
	Blends the two modular values. This function can be used to correctly
	blend two angles or other cyclic values.


	Example: modblend(355, 5, 360, 0.5) will evaluate to 0. Simple linearly
	blending of the two values would result in an incorrect value of 180.

morient

matrix morient (vector zaxis, vector yaxis)
	Computes the transform matrix to rotate the x,y,z axes such that the
	specified zaxis is the new zaxis and yaxis the new yaxis.  The
	resulting matrix is a 3x3 matrix.

mrows

float mrows (matrix mat)
	Returns the number of rows in a matrix

mzero

matrix mzero (matrix mat)
	Sets all values of the matrix to 0.

nearpoint

float nearpoint (string SOP, float x, float y, float z)
	Finds the nearest point in the SOP to the given point (x, y, z).  The
	return value is the number of the point which its closest to.


	For example:
	        nearpoint("/obj/geo1/grid1", 1, 2, 3)
	Will return the point in the grid closest to the (1, 2, 3) point.


See also: xyzdist, primdist, pointdist


noise

float noise (float X, float Y, float Z)
	This function can be used to apply noise to geometry.
	For example to make a bumpy grid you could append a point SOP and
	use the following in the pos Z field:


	noise($TX, $TY, $TZ) 


See also: snoise, turb, sturb


normal

float normal (string SOP, float prim_num, float u, float v, float index)
	Evaluates the X, Y, or Z component of the surface normal at the parametric 
	(u,v) location. u and v are unit values, defined in the [0,1] interval.


	Note: if the primitive is a mesh, u and v are defined in terms its number of
	rows and columns.


See also: unituv, primuv, primduv, curvature


normalize

vector normalize (vector v)
	Returns the normalized vector

npoints

float npoints (string name)
	This function returns the number of points in the SOP.  -1 is returned
	if the SOP cannot be cooked.


nprims

float nprims (string name)
	This function returns the number of polygons in the SOP.  -1 is returned
	if the SOP cannot be cooked.


objlightmask

string objlightmask (string geometry, string options)
	This function returns a list of the lights which match the light mask
	of the geometry object specified.  The list of lights is a space
	separated string of path names.  The options allow some control over
	how the light names are generated.  Currently, options include:
	    f - Generate full path names for the lights.  If this option is
	        excluded, the path names will be generated relative to /obj
	    a - Exclude matching ambient lights
	    A - Only include ambient lights in the expansion
	For example:
		objlightmask("/obj/geo1", "fa")
	will return all the lights in /obj/geo1's light-mask.  Any ambient
	lights will be excluded from the expanded string, and the paths
	generated will be the full path name of the light.  The string might
	look something like "/obj/light1 /obj/light2 /obj/subnet1/light1".


	This is a slightly more general form of the oplightmask command.


See also: oplightmask

oc

float oc (float output_channel_index, float index)
	Returns the value of a CHOP's output at the specified sample index.
		eg. oc(0, 10)


See also: ics, ic, ice, icr, icn, icmin, icmax, icl, oc


oldrand

float oldrand (float value)
	Gives a pseudo-random number between 0 and 1 depending on the value.
	If the same value  is used the same number will result each time. A
	different number is returned if fractional values are different.


		eg.  oldrand(12.1) gives a different result than oldrand(12.2)


	NOTE:  It is a good idea to use non-integer values as the argument
	       to oldrand().
	       This function is similar to rand() but uses a different
	       algorithm for generating the random numbers


See also: rand


opblist

string opblist (string bundle_name)
	This function returns a string containing the full paths to all
	operators contained in the bundle.

opdigits

float opdigits (string name)
	This function will return the numeric value of the last set of 
	consecutive digits in a node's name. It is used when building several 
	similar networks.


	    eg.   opdigits("/obj/geo1")  = 1
	          opdigits("..") = 1             (at the sop level of geo1)

opexist

float opexist (string op_name)
	This function returns 1 if the specified node exists, 0 if it doesn't.


		eg.  echo `opexist("../box1")`

opflag

string opflag (string network, string flag)
	This function builds a string of all the nodes which have the
	particular flag set.  Currently the flags recognized are:
	    "d"	= Display Flag
	    "r" = Render Flag
	    "t" = Template Flag
	    "l" = Locked Flag
	    "s" = Selected Flag
	    "c" = Current Flag


	Example:
	    List all displayed objects
		hscript -> echo `opflag("/obj", "d")`


	    List all locked SOPs in object geo1
		hscript -> echo `opflag("/obj/geo1", "l")`


See also: opselect

opfullpath

string opfullpath (string op)
	This function will return the full path to the operator specified.


See also: opfullpathfrom, opname, opsubpath

opfullpathfrom

string opfullpathfrom (string op, string fromop)
	This function will return the full path to the operator op, which is
	specified relative to the operator fromop. The fromop operator is specified
	relative to the current node.


See also: opfullpath, opname, opsubpath

opinput

string opinput (string name, float index)
	Will print the name of the operator that is connected to the input of
	the given index.  For example:
	    point("../" + opinput(".", 0), $PT, "P", 0)


See also: opinputpath, opninputs, opoutput, opoutputpath, opnoutputs


opinputpath

string opinputpath (string name, float index)
	Will print the full path of the operator that is connected to the input
	of the given index.  For example:
	    point(opinputpath(".", 0), $PT, "P", 0)


See also: opinput, opninputs, opoutput, opoutputpath, opnoutputs


opisloading

float opisloading ()
	This function returns 1 if Houdini is currently in the process of loading
	a hip file, otherwise it will return 0.

opisquitting

float opisquitting ()
	This function returns 1 if Houdini is currently in the process of shutting
	down, otherwise it will return 0. This information is particularly useful
	in node deletion scripts to determine if the node is being deleted because
	Houdini is quitting rather than because the user chose to delete it.

oplightmask

string oplightmask (string geometry)
	This function returns a list of the lights which match the light mask
	of the object specified.  The list of lights is a space separated
	string of path names.  For example:
		oplightmask("/obj/geo1")
	might return the string "/obj/ambient1 /obj/light1 /obj/subnet1/light1".


	This function is equivalent to: objlightmask(geometry, "f")


See also: objlightmask

opname

string opname (string name)
	This function will print the name of the node given.  It's main use is
	to find out the name of the network containing the node.  For example,
	if used in a SOP, opname("..") will give the name of the object
	containing the SOP.


See also: opfullpath, opsubpath

opnchildren

float opnchildren (string name)
	Returns the number of nodes contained in the specified node.  This
	will return the number of nodes in a sub-network or the number of
	SOPs in an Object.  It is non-recursive in that only the direct
	contents of the node are counted, not all of their nodes as well.


opninputs

float opninputs (string name)
	Returns the maximum number of inputs that the node has connected.  It
	is possible to have blank inputs (i.e. that aren't connected).


See also: opinput, opoutput, opnoutputs


opnoutputs

float opnoutputs (string name)
	Returns the number of nodes which are connected to the output of the
	specified node.


See also: opinput, opoutput, opninputs


opoutput

string opoutput (string name, float index)
	Will print the name of the operator which connects to the given node.
	Multiple operators can connect and the order is arbitrary.


See also: opinput, opinputpath, opninputs, opoutputpath, opnoutputs


opoutputpath

string opoutputpath (string name, float index)
	Will print the full path of the operator which connects to the given
	node.  Multiple operators can connect and the order is arbitrary.


See also: opinput, opinputpath, opninputs, opoutput, opnoutputs


oppinput

string oppinput (string name, float index)
	This function has been replaced with opinput

oppwd

string oppwd ()
	This is a short cut for execute("oppwf")


oppwf

string oppwf ()
	This is a short form for execute("oppwf")


opselect

string opselect (string network)
	This function builds a string of all the selected nodes in a network.
	Example:


	    hscript -> echo `opselect("/obj")`
	    geo1 geo2


See also: opflag

opsubpath

string opsubpath (string op)
	This function will return the path of the specified operator including
	any containing subnets.


See also: opfullpath, opname

optransform

matrix optransform (string object_name)
	Returns the matrix specifying the transform of the object at the
	current time.

optype

string optype (string name)
	This function will print the type of operator that the node specified
	is.  For example:  optype("/obj/geo1") would most likely return "geo",
	indicating that object geo1 is a geometry object.


See also: optypeinfo

optypeinfo

string optypeinfo (string name, string pattern)
	This function will return type information from the specified
	operator.  Unlike optype which just returns the optype, this allows
	you to specify a string of parameters which will cause different
	things to be output.  The possible characters in the string which
	correspond to output are, and examples for "/obj/geo1":
		N - The name of the node, ie "geo1"
		t - The type of the node, same as optype, or "geo"
		e - The label of the node, or "Geometry"
		n - The network type of the node, or "OBJ"
		s - The script path of the node, or "obj"
		i - The index of the node, a number corresponding to the
		    network type.
		T - The table name of the node, or "Object"	
	Thus, optypeinfo("/obj/geo1", "NtT") will return "geo1 geo Object".


See also: optype

origin

float origin (string obj1, string obj2, string constant_type)
	This function will return one of TX, TY, TZ, RX, RY, RZ, SX, SY, SZ
	value necessary to transform obj1 to obj2, depending on the type argument
	("TX", "TY", "TZ", "RX", "RY", "RZ", "SX", "SY" or "SZ" ).


	This can also be thought of as the position of obj2 relative to
	obj1. It will compute the position of obj1 relative to obj2 and returns
	one of TX, TY, TZ, RX, RY, RZ, SX, SY, SZ based on the type argument.


	If obj1 is the empty string (""), then the world space position of obj2
	is returned.


See also: vorigin, vtorigin, vrorigin, originoffset

originoffset

float originoffset (string obj1, vector pos1, string obj2, vector pos2, string constant_type)
	This function will return one of TX, TY, TZ, RX, RY, RZ value necessary
	to transform the point pos1 in the space of object obj1 to point pos2
	in the space of object obj2, depending on the type argument
	("TX", "TY", "TZ", "RX", "RY" or "RZ").


	This can also be thought of as the position of pos2 in obj2 relative to
	pos1 in obj1.


	If obj1 is the empty string (""), then the world space position of pos2
	in obj2 is returned.


See also: origin, vorigin, vtorigin, vrorigin

padzero

string padzero (float number, float value)
	Returns a string containing value preceded by enough zeros to make up
	'number' digits


		eg.  padzero(5, 126) = 00126
		     padzero(5, 23) = 00023
		     padzero(1, 23) = 23


param

float param (string token, float value)
	Returns the global parameter value associated with the token,
	or 'value' if not defined. This function is used with stamping
	operators (eg. Copy SOP, LSystem SOP).


		eg.  param("sides", 5)
		     param("fuzzy", 0.5)

pic

float pic (string copname, float U, float V, float color_type)
	This function will lookup a single pixel from a COP and return the color
	of the pixel.  The color_type parameter can be one of the following:
	    D_CR, D_CG, D_CB, D_CA, D_CHUE, D_CSAT, D_CVAL, D_CLUM
	for the red, green, blue, alpha, hue, saturation, value, or luminance of
	the pixel.  The color returned will be interpolated smoothly between
	adjacent pixels.


		eg.  pic("/img/img1/color1", .5, .5, D_CLUM)


See also: picni, tex, texni, res

picni

float picni (string copname, float U, float V, float color_type)
	This function will lookup a single pixel from a COP and return the color
	of the pixel.  The color_type parameter can be one of the following:
	    D_CR, D_CG, D_CB, D_CA, D_CHUE, D_CSAT, D_CVAL, D_CLUM
	for the red, green, blue, alpha, hue, saturation, value, or luminance of
	the pixel.  The color returned will not be interpolated.  That is, it
	will be the exact color of the pixel.


		eg.  picni("/img/img1/color1", .5, .5, D_CLUM)


See also: pic, tex, texni, res

point

float point (string SOP, float point_number, string attribute, float index)
	This function will extract information from a point in a sop.  The
	attribute parameter is the name of the attribute (eg.  "Cd" for
	diffuse color).  Two special attributes exist "P" and "Pw" which
	represent the position of the point in space ("Pw" allows you to
	access the W component of the position).


	For example:
		point("/obj/geo1/facet1", 3, "P", 0)
	Will return the X component of point 3 of the facet1 SOP in geo1.


		point("/obj/geo1/facet1", 3, "N", 2)
	Will return the Z component of the normal attribute of point 3 in the
	facet1 SOP of object geo1.


	Note: This function will interpolate between point values if the point
	number is fractional, such as 3.35


pointavg

float pointavg (string SOP, string attribute, float index)
	This function works much like the point function, except that it
	returns the average value of the attribute for all points in the
	specified sop.

pointdist

float pointdist (string SOP, float point_num, string SOP, float prim_num, float return_type)
	Given a point and a primitive, this function finds the distance between 
	the point and the closest spot on the primitive.  If prim_num is minus
	one, the closest distance to any primitive is found.
	return_type 0 yields the minimum distance.
	return_type 1 yields the u parametric value at the point of minimum distance.
	return_type 2 yields the v parametric value at the point of minimum distance.
	return_type 3 yields the primitive number that was closest.


	For example:
		pointdist("/obj/geo1/add1", 0, "/obj/geo1/grid1", 0, 0)
	Will return the distance between point 0 of add1 and the closest spot from
	the surface of grid1 primitive number 0.  If the return_type were 1, the u
	parametric value that is closest to the point would be returned.


See also: primdist, xyzdist, nearpoint


pointgrouplist

string pointgrouplist (string sop_path)
	This function returns a string containing all the point groups in the
	given SOP. The returned string is a space separated list of group names.


See also: haspoint, pointlist, hasprim, primlist, primgrouplist


pointlist

string pointlist (string sop, string group_name)
	This function returns a string containing all the points in the point
	group specified.  The string is a space separated list of numbers.


See also: haspoint, pointgrouplist, hasprim, primlist, primgrouplist


points

string points (string SOP, float point_number, string attribute)
	This function will return the value of a string attribute for a given
	point of a SOP.


	For example:
		points("/obj/geo1/facet1", 3, "instance")
	Will return the string associated with the string attribute "instance"
	for point 3 in the facet1 SOP in geo1.


popevent

float popevent (string event_name)
	Returns whether a POP event is occurring or not. This function should only
	be used from within a POP.

popeventtime

float popeventtime (string event_name)
	Returns the time at which a POP event is occurring. This function should only
	be used from within a POP.

poppoint

float poppoint (float point_number, string attribute, float index)
	Returns the value of an attribute for a specific particle within a POP. This
	function should only be used from within a POP.

pow

float pow (float base, float exponent)
	This computes the base to the power given.


		eg.   pow(2, 3) = 8


prim

float prim (string SOP, float prim_num, string attrib_name, float attrib_index)
	This function can be used to get information about a specified primitive.
	When given the "P" or "Pw" attribute, the centroid of the primitive will
	be returned.


	For example:
		prim("/obj/geo1/facet1", 3, "P", 0)
	Will evaluate the X component of the centroid of primitive 3 in the sop
	specified.
		prim("/obj/geo1/facet1", 3, "Cd", 1)
	Will evaluate the green color of the "Cd" attribute of primitive 3.


See also: primuv, point

primdist

float primdist (string SOP, float prim1_num, string SOP, float prim2_num, float return_type)
	This expression finds the minimum distance between two primitives.
	return_type 0 yields the minimum distance.
	return_type 1 yields prim1's u value at the point of minimum distance.
	return_type 2 yields prim1's v value at the point of minimum distance.
	return_type 3 yields prim2's u value at the point of minimum distance.
	return_type 4 yields prim2's v value at the point of minimum distance.


	Currently, primdist() will return 0 unless given face types (polygons and/or
	curves) or spline surfaces.


	For example:
		primdist("/obj/geo1/sphere1", 0, "/obj/geo1/grid1", 0, 0)
	Will return the distance between the first primitives in both sphere1 and
	grid1.


See also: pointdist, xyzdist, nearpoint


primduv

float primduv (string SOP, float prim_num, string attrib_name, float attrib_index, float u, float v, float du, float dv)
	Evaluates the (partial) derivatives of a face or hull attribute at a
	parametric (u,v) position. u and v are unit values, defined in the [0,1]
	interval. When given the "P" or "Pw" attribute, the positional derivative of
	(u,v)'s image on the primitive will be returned. If the primitive is a face
	type, v and dv are ignored. If both du and dv are 0, primduv becomes 
	equivalent to primuv.


	Note: if the primitive is a polygon or a mesh, u and v are defined in terms of
	the number of vertices, or rows or columns respectively.


	For example:
		primduv("/obj/geo1/tube1", 12, "P", 2, 0.4, 0.5, 1, 0)
	Will evaluate the Z component of the first-order partial derivative of 
	primitive 12 with respect to u, at the parametric location (0.4,0.5).


See also: primuv, normal, curvature, unituv


primgrouplist

string primgrouplist (string sop_path)
	This function returns a string containing all the primitive groups in
	the given SOP. The returned string is a space separated list of group
	names.


See also: haspoint, pointlist, pointgrouplist, hasprim, primlist


primlist

string primlist (string sop, string group_name)
	This function returns a string containing all the primitives in the
	primitive group specified.  The string is a space separated list of
	numbers.


See also: haspoint, pointlist, pointgrouplist, hasprim, primgrouplist


prims

string prims (string SOP, float primitive_number, string attribute)
	This function will return the value of a string attribute for a given
	primitive in a SOP.


	For example:
		prims("/obj/geo1/facet1", 3, "texturemap")
	Will return the string associated with the string attribute
	"texturemap" for primitive 3 in the facet1 SOP in geo1.


primuv

float primuv (string SOP, float prim_num, string attrib_name, float attrib_index, float u, float v)
	Evaluates the specified attribute at a parametric (u,v) position on the
	primitive. u and v are unit values, defined in the [0,1] interval. When given
	the "P" or "Pw" attribute, the x, y, or z image of the (u,v) domain point will
	be returned. If the primitive is a face type or a circle, v is ignored.


	Note: if the primitive is a polygon or a mesh, u and v are defined in terms of
	the number of vertices, or rows or columns respectively. Currently, only the
	positional attribute of quadric primitives can be evaluated.


	For example:
		primuv("/obj/geo1/tube1", 0, "Cd", 1, 0.7, 0.3)
	Will evaluate the Green component of the diffuse color attribute at a location
	on primitive 0 given by the parametric coordinates (0.7,0.3).


See also: primduv, normal, curvature, unituv


print

float print (string message, float)
	Prints the value of the expression into the textport and returns
	the same expression value.  This can be used to diagnose
	parameters in SOPs or channels.  For example:
	    printf("Value = ", 32.3)
	will return 32.3.

pulse

float pulse (float value, float start, float end)
	This function creates an on/off pulse. If the value is less than start
	or greater than end, pulse returns a 0. Otherwise, it returns 1. 
	Frequently, start and end are frame numbers and val is the current
	frame, $F.


qlinear

float qlinear ()
	A channel interpolation function which uses quaternions to interpolate
	between the keyframes.  This function requires that it has two
	neighbouring channels named appropriately.  This means they should end
	with x, y, and z, or be three consecutive numbers starting from 0
	(such as 0, 1, 2, or 6, 7, 8).


	Because the interpolation is done in quaternion space, the
	orientations will blend smoothly with no gimbal lock or unexpected
	spins.  However, the rotation values may appear to jump suddenly.
	This is because different rotation values can represent the same
	orientation.


	Note in the graph editor a segment using this expression will show as
	a dashed straight line.  This does not represent the actual
	intermediate channel values, but does give an accurate visual feel for
	the behaviour of the interpolation.


quintic

float quintic ()
	A channel interpolation function which uses the slopes and
	accelerations to smoothly interpolate the segment.

rad

float rad (float number)
	Converts the number to radians assuming that the number is measured in
	degrees.


		eg.  rad (180)=3.1415926


rand

float rand (float value)
	Gives a pseudo-random number between 0 and 1 depending on the value.
	If the same value  is used the same number will result each time. A
	different number is returned if fractional values are different.


		i.e. rand(12.1) gives a different result than rand(12.2)


	NOTE:  It is a good idea to use non-integer values as the argument
	to rand().


raw

float raw ()
	This is a channel interpolation function for raw channels.


realuv

float realuv (string SOP, float prim_num, float uv_unit, float D_U|D_V)
	Returns the real u or v parametric value, given the unit value of the same
	parameter. The unit value is defined in the [0,1] interval. The real value
	is defined in the valid interval of the primitive's domain if the primitive
	is a spline type. If the primitive is a polygon or a mesh, the size of its
	domain is given by the number of vertices, or rows or columns respectively.
	If the primitive is a polygon or a curve, D_U and D_V are irrelevant.


	Note: the result is undefined if the primitive is neither a face nor a hull.


See also: unituv


repeat

float repeat (float f1, float f2)
	A channel interpolation function which repeats the exact motion between
	frames f1 and f2. If you wish to repeat the motion cumulatively, use
	the cycle function instead.


See also: repeatt, cycle, cyclet


repeatt

float repeatt (float t1, float t2)
	A channel interpolation function which repeats the motion between
	times t1 and t2. If you wish to repeatt the motion cumulatively, use
	the cyclet function instead.


See also: repeat, cycle, cyclet


res

float res (string copname, float res_type)
	This function will return the natural resolution of the specified
	COP.  The res_type can be either D_XRES or D_YRES.


		eg.  res("/img/img1/color1", D_XRES)

rgb

float rgb (float hue, float saturation, float value, string component)
	Converts the color specified by hue/saturation/value to RGB.
	The component is a string which should be one of "r", "g", or "b".


	For example:   rgb(270, .5, 1, "b")


rindex

float rindex (string source, string pattern)
	Finds the last occurrence of pattern in source and returns the number
	of characters before the pattern occurs.  If the pattern is not found
	-1 is returned.


		eg.   hscript -> echo `rindex("Testing rindex", "sting")`
		      2
		      hscript -> echo `rindex("Testing rindex", "i")`
		      8


See also: index

rint

float rint (float)
	Will round to the nearest integer.  When the fractional component is .5
	exactly, the function will round to the nearest even integer.


See also: round

rotate

matrix rotate (float angle, string axis)
	Computes a 4x4 rotation matrix of a rotation specified by the angle
	(in degrees) around an axis.  The axis should be a string which is one
	of "x", "y", or "z".


See also: rotaxis, scale, translate

rotaxis

matrix rotaxis (float angle, vector axis)
	Computes a 4x4 rotation matrix of a rotation specified by the angle
	around the axis specified by the vector.  The vector is converted to a
	3 vector for the purposes of this computation.


See also: rotate, scale, translate

round

float round (float)
	Will round to the nearest integer.  When the fractional component is .5
	exactly, the function will round to the nearest even integer.


	        eg.  round(2.501)=3
		     round(-2.501)=-3


		     round(0.2)=0
		     round(-.2)=0


See also: trunc, int, ceil, floor, frac

run

string run (string command)
	This is a short form for the execute function.  The command specified
	will be executed and string returned will be the output of the command.
	The command is a houdini command.


scale

matrix scale (float sx, float sy, float sz)
	Computes a scale matrix given by the three scale values.


See also: rotate, rotaxis, translate

sign

float sign (float value)
	The sign of the value. For example, it returns 1 if the value is any
	positive number, -1 if the value is a negative number and 0 if the
	value is 0.


sin

float sin (float)
	This is a trigonometric mathematical function used to express
	the sine value of the number.


	        eg.  sin (60)=0.866025


sinh

float sinh (float number)
	The hyperbolic sine of the number.


smooth

float smooth (float value, float minimum, float maximum)
	The return value is a smooth interpolation between 0 and 1. When the 
	value is less than the minimum, the return value is 0. If the value
	is greater than the maximum, the return value is 1.


		eg.  smooth ($F, 12, 55)


	This will generate an ease-type curve between values 0 and 1, starting 
	at frame 12 and ending at frame 55. Dig it!


snoise

float snoise (float X, float Y, float Z)
	This function applies noise based on sparse convolution. 


	noise($TX, $TY, $TZ) 


See also: noise, turb, sturb


spknot

float spknot (string SOP, float prim_num, float knot_index, float D_U|D_V)
	This spline-specific function returns the floating-point knot value, given the
	knot index in the U or V knot sequence. The first valid knot index is 0. If the
	primitive is a Bezier curve or surface, the values returned are those of its
	breakpoints. If the primitive is a curve, D_U and D_V are irrelevant.


spline

float spline ()
	A channel interpolation function which runs a spline through the
	timemarks specified by t1 and t2 (including all the timemarks between
	t1 and t2).  The tension specifies the tension of the spline.


sqrt

float sqrt (float number)
	The Square root of the number.


		eg.  sqrt (144)=12


strcasecmp

float strcasecmp (string s1, string s2)
	String comparison which ignores case of string.  Return codes are:
	    negative if s1 < s2
	    positive if s1 > s2
	    zero if s1 == s2

strcasematch

float strcasematch (string pattern, string s)
	Does pattern matching comparison for a string ignoring case
	sensitivity.  If the pattern matches the string, the return code will
	be 1 otherwise, the return code will be 0.
	Multiple patterns may be specified using a comma separated list.


	Example:	strmatch("FOO*", "foobar")	returns 1
			strmatch("?baR", "fred")	returns 0
			strmatch("FoO*,bAr*, "bar")	returns 1


See also: strcmp, strcasecmp, strcasematch

strcat

string strcat (string s1, string s2)
	This will concatenate two strings.


	        eg.  strcat("Current motion file is; ", $MOTNAME)
	             Current motion file is job1.bmot


strcmp

float strcmp (string s1, string s2)
	Returns a negative number if s1 is lexicographically less than s2
	Returns a positive number if s1 is lexicographically greater than s2
	Returns a zero if s1 is equal to s2
		eg.  strcmp("abc", "xyz")=-23
		strcmp("xyz, "abc")=23
		strcmp("abc", "abc")=0


strdup

string strdup (float count, string s2)
	Returns s2 duplicated count number of times.
		eg. strdup(3, "abc") = "abcabcabc"
		strdup(0, "Foobar") = ""
		strdup(3, "/(120)[B]") = "/(120)[B]/(120)[B]/(120)[B]"

stripmatrix

string stripmatrix (string mat)
	This function will strip out all non-essential characters from the
	string representation of a matrix or vector.  This is useful when you
	want to interpret the values of the matrix (i.e. to pass to a VEX
	function).  A string containing the floating point numbers (and only
	the numbers) which make up the matrix will be returned.
		eg.  stripmatrix(identity(3)) = "1 0 0  0 1 0  0 0 1"
		     stripmatrix(vector3(1,2,3)) = "1 2 3"

strlen

float strlen (string)
	Returns the number of characters in the string.
		eg.  strlen("abcde")=5


strmatch

float strmatch (string pattern, string s)
	Does pattern matching comparison for a string.  If the string matches
	the pattern, then the return code will be 1, otherwise it will be 0.
	Multiple patterns may be specified using a comma separated list.


	Example:	strmatch("foo*", "foobar")	returns 1
			strmatch("?bar", "fred")	returns 0
			strmatch("foo*,bar*", "bar")	returns 1


See also: strcmp, strcasecmp, strcasematch

sturb

float sturb (float X, float Y, float Z, float depth)
	This function generates spatially coherent noise based on 
	sparse convolution.   The depth passed in is the amount of fractalization
	which is done to the noise.


See also: turb, noise, snoise


substr

string substr (string, float, float)
	This will extract a sub-string of the first argument.
		eg.   hscript-> echo `substr("abcdefghijklm", 3, 4)`
	              defg
	        Note:  The first character is specified by a start of 0


surflen

float surflen (string SOP, float prim_num, float ustart, float vstart, float ustop, float vstop)
	Given a surface and two parametric points in its domain ( [ustart,vstart]
	and [ustop,vstop] ) surflen computes the length of the 3D curve that
	stretches between the two points. This curve is the 3D image of the line
	in the surface domain, whose end-points are [ustart,vstart] and [ustop,vstop].
	If either u or v is kept constant, the 3D curve coincides with an isoparm.


	All four uv numbers are unit values, defined in the [0,1] interval.


	Note: the primitive must be either a NURBS surface or a Bezier surface. A
	polygonal mesh can be simulated by a bi-linear Bezier surface (u and v order 2).


	For example:
		surflen("/obj/geo1/grid1", 12, 0, 1, 0.2, 0.8)
	Will compute the length of the curve on surface #12, defined parametrically
	by the surface domain points [0,1] and [0.2, 0.8].


See also: arclen, normal, curvature, unituv


system

string system (string)
	Returns the output of a unix command.
		eg.  system("finger")`
		mark     Mark Elendt           q1    45 Fri 14:46


systemES

float systemES (string)
	Returns the exit status of a unix command.
		eg.  hscript-> echo `systemES("test -r $HOME/houdini/123.cmd")`
	        0


tan

float tan (float)
	This is a trigonometric mathematical function used to express
	the tangent value of the number.


	        eg.  tan (60)=1.73205


tanh

float tanh (float number)
	The hyperbolic tangent of the number.


tex

float tex (string diskfile, float U, float V, string color_type)
	This function will access a texture map stored on disk and return the
	color of the pixel specified by the U and V coordinates.  The
	color_type parameter can be one of the following:


	    r, R, or D_CR	= Red channel
	    g, G, or D_CG	= Green channel
	    b, B, or D_CB	= Blue channel
	    a, A, or D_CA	= Alpha channel
	    h, H, or D_CHUE	= Color hue
	    s, S, or D_CSAT	= Color saturation
	    v, V, or D_CVAL	= Color value
	    l, L, or D_CLUM	= Color luminance


	The color returned will be interpolated smoothly between pixels.
	Textures can be 1, 3 or 4 channel images containing 8-bit, 16-bit or
	floating point data.  When the color component asked for doesn't match
	the format of the image, some default behaviour will be taken.


	    e.g. tex("Mandril.pic", $BBX, $BBY, r).


See also: texni, pic, picni


texni

float texni (string diskfile, float U, float V, string color_type)
	This function will access a texture map stored on disk and return the
	color of the pixel specified by the U and V coordinates.  The
	color_type parameter can be one of the following:


	    r, R, or D_CR	= Red channel
	    g, G, or D_CG	= Green channel
	    b, B, or D_CB	= Blue channel
	    a, A, or D_CA	= Alpha channel
	    h, H, or D_CHUE	= Color hue
	    s, S, or D_CSAT	= Color saturation
	    v, V, or D_CVAL	= Color value
	    l, L, or D_CLUM	= Color luminance


	The color returned will be not be interpolated between pixels.  That
	is, the color returned will be the exact color of the pixel specified.
	Textures can be 1, 3 or 4 channel images containing 8-bit, 16-bit or
	floating point data.  When the color component asked for doesn't match
	the format of the image, some default behaviour will be taken.


	    e.g. tex("Mandril.pic", $BBX, $BBY, r).


See also: tex, pic, picni


tolower

string tolower (string s)
	Converts all the characters in the string to lower case

toupper

string toupper (string s)
	Converts all the characters in the string to upper case

translate

matrix translate (float tx, float ty, float tz)
	Computes a translation matrix given the three translate values.


See also: rotate, rotaxis, scale

transpose

matrix transpose (matrix mat)
	Computes the transpose of the matrix specified.

trunc

float trunc (float number)
	The integer value of the number by truncating the number.  The number
	is rounded toward 0.  That is, for positive numbers, the largest
	integer less than the number will be returned.  For negative numbers,
	the smallest integer greater than the number will be returned.


		eg.  trunc(2.6)=2
		eg.  trunc(-2.6)=-2


See also: int, floor, ceil, round, frac


turb

float turb (float X, float Y, float Z, float depth)
	This function generates spatially coherent noise (i.e. random numbers
	which are close to each other when the X, Y, Z points are close to
	each other).  The depth passed in is the amount of fractalization
	which is done to the noise.


See also: sturb, noise, snoise


unituv

float unituv (string SOP, float prim_num, float uv_real, float D_U|D_V)
	Returns the unit u or v parametric value, given the real value of the same
	parameter. The unit value is defined in the [0,1] interval. The real value
	is defined in the valid interval of the primitive's domain if the primitive
	is a spline type. If the primitive is a polygon or a mesh, the size of its
	domain is given by the number of vertices, or rows or columns respectively.
	If the primitive is a polygon or a curve, D_U and D_V are irrelevant.


	Note: the result is undefined if the primitive is neither a face nor a hull.


See also: realuv


uvdist

float uvdist (string SOP, float prim1_num, float u1, float v1, string SOP, float prim2_num, float u2, float v2)
	This expression finds the distance between two primitives at two parametric
	locations. Valid u and v values are between 0 and 1.


	Any primitive type is allowed.


	For example:
		uvdist("/obj/geo1/sphere1", 0, 0.1, 0.8, "/obj/geo1/grid1", 2, 1, 0.5)
	Will return the distance between point (0.1, 0.8) on the first primitive in
	sphere1 and point (1, 0.5) on the third primitive in grid1.


See also: distance, primdist, pointdist, unituv


vangle

float vangle (vector v0, vector v1)
	Returns the angle between the two vectors specified.

vector

vector vector (string pattern)
	The pattern passed in will be converted to a vector.  The pattern
	should consist of a leading square bracket followed by a comma
	separated list of values and a closing square bracket.


	Example:  vector("[1,2,3,4,5]")

vector3

vector vector3 (float x, float y, float z)
	Creates a 3 vector with the x, y, and z components specified.

vector4

vector vector4 (float x, float y, float z, float w)
	Creates a 4 vector with the x, y, z, and w components specified.

vertex

float vertex (string SOP, float primitive_number, float vertex_number, string attribute, float index)
	This function will extract information from a vertex of a primitive in
	a sop.  The attribute parameter is the name of the attribute (eg.
	"Cd" for diffuse color).  Two special attributes exist "P" and "Pw"
	which represent the position of the point in space ("Pw" allows you to
	access the W component of the position).


	For example:
		vertex("/obj/geo1/facet1", 2, 3, "P", 0)
	Will return the X component of vertex 3 of primitive2 in the facet1
	SOP of geo1.


		point("/obj/geo1/facet1", 2, 3, "Cd", 2)
	Will return the Z component of the color attribute of vertex 3 of
	primitive 2 in the facet1 SOP of object geo1.


	Note: This function will interpolate between point values if the
	vertex number is fractional, such as 3.35


vertexs

string vertexs (string SOP, float primitive_number, float vertex_number, string attribute)
	This function will return the value of a string attribute for a given
	vertex (of a given primitive) in a SOP.


	For example:
		vertexs("/obj/geo1/facet1", 1, 3, "instance")
	Will return the string associated with the string attribute "instance"
	for vertex 3 of primitive 0 in the facet1 SOP in geo1.


vlength

float vlength (vector vec)
	Computes the length of the vector specified.  This is equivalent to:
	    sqrt(dot(vec, vec))

vlength2

float vlength2 (vector vec)
	Compute the square of the length of the vector specified.  This is
	equivalent to:
	    dot(vec, vec)

vmatch

float vmatch ()
	This is a channel expression which will match the in coming and
	out going slope.  However, the values at each end of the segment
	will be determined by the values specified.


vmatchin

float vmatchin ()
	This is a channel expression which will match the in coming slope.
	The segment will be a straight line matching the slope of the previous
	segment, but using the starting value specified


vmatchout

float vmatchout ()
	This is a channel expression which will compute a straight line which
	has the same slope as the in coming slope of the next segment.  The
	straight line will end at the value specified.


vorigin

vector vorigin (string obj1, string obj2)
	This function will return a vector with 6 values in it.  The values
	are set to "[TX, TY, TZ, RX, RY, RZ]" for the position of obj1
	relative to obj2.


	This can also be thought of as the position of obj2 relative to obj1.


	If obj1 is the empty string (""), then the world space position of obj2
	is returned.


See also: origin, vtorigin, vrorigin, originoffset

vpname

string vpname (string viewer, float viewport_quadrant_number)
	This function will return the name of the viewport in the given
	quadrant of a viewer.

vrorigin

vector vrorigin (string obj1, string obj2)
	This function will return a vector containing the rotates required
	to transform obj1 to the space of obj2.


	This can also be thought of as the orientation of obj2 relative to obj1.


	If obj1 is the empty string (""), then the world space rotation of obj2
	is returned.


See also: origin, vorigin, vtorigin, originoffset

vscale

vector vscale (vector vec, float scale)
	Multiplies the vector by the scale.  This is equivalent to vec*scale

vset

vector vset (float size, float value)
	Creates a vector of the size specified.  Each component of the vector
	will be set to the value given.

vsize

float vsize (vector vec)
	Returns the number of elements in the vector

vtorigin

vector vtorigin (string obj1, string obj2)
	This function will return a vector containing the translates required
	to transform obj1 to the space of obj2.


	This can also be thought of as the position of obj2 relative to obj1.


	If obj1 is the empty string (""), then the world space position of obj2
	is returned.


See also: origin, vorigin, vrorigin, originoffset

wrap

float wrap (float, float, float)
	Similar to the clamp expression in that the resulting value will always
	fall between the specified minimum and maximum value. It will, however,
	create a sawtooth wave for continuously increasing or decreasing values
	of the value.


		eg.  wrap ($F, 5, 10)
		This will create a sawtooth function between 5 and 10.


xyzdist

float xyzdist (float x, float y, float z, string SOP, float prim_num, float return_type)
	Finds the distance between the point (x, y, z) and the specified sop's
	primitive.  If the prim_num is -1, it finds the closest distance to
	any primitive in the mentioned sop.
	return_type 0 yields the minimum distance.
	return_type 1 yields the u parametric value at the point of minimum distance.
	return_type 2 yields the v parametric value at the point of minimum distance.
	return_type 3 yields the primitive number that was closest.


	For example:
		xyzdist(1, 2, 3, "/obj/geo1/grid1", 0, 0)
	Will return the distance between (1, 2, 3) and the closest spot from
	the surface of grid1 primitive number 0.  If the return_type were 1, the u
	parametric value that is closest to the point would be returned.


See also: primdist, nearpoint, pointdist