Gocator Line Profile Sensors: User Manual
Gocator Web Interface • 432
Function Description
float sqrt(float x) Calculates square root of x
float sin(float x) Calculates sin(x) (x in radians)
float cos(float x) Calculates cos(x) (x in radians)
float tan(float x) Calculates tan(x) (x in radians)
float asin(float x) Calculates asin(x) (x in radians)
float acos(float x) Calculates acos(x) (x in radians)
float atan(float x) Calculates atan(x) (x in radians)
float pow (float x, float y) Calculates the exponential value. x is the base, y is the exponent
float fabs(float x) Calculates the absolute value of x
Math Functions
Example: Accumulated Volume
The following example shows how to create a custom measurement that is based on the values from
other measurements and persistent values. The example calculates the volume of the target using a
series of box area measurement values.
/* Calculate the volume of an object by accumulating the boxArea measurements*/
/* Encoder Resolution is 0.5mm. */
/* BoxArea Measurement ID is set to 1*/
long long encoder_res = 500;
int id = 1;
long long boxArea = Measurement_Value(id);
long long Volume = Memory_Get64s(0) + boxArea;
Memory_Set64s(0, Volume);
if (Volume > 1000000)
{
Output_Set(Volume, 1);
}
else
{
Output_Set(Volume, 0);
}