Main Menu

All times are in GMT -8 (DST) :: The time is now 9:59 am.

Login or Register
Create an account and register your LMI products to gain access to useful resources.

Register Account

Login

Sub Menu

Knowledge Base
Article Data
Article Ref
2965-QRTO-1486
Date Created
Fri, 20th Mar 2015
Date Modified
Wed, 20th Jun 2018

   Surface plane tilt

Question 

How can I determine the tilt angle of a plane given an X Angle and Y Angle from the Surface Plane tool?

Answer 

Sensor Model G2xxx, G3xxx
Firmware Version All
SDK Version n/a

The tilt angle is defined here as the angle between the X-Y plane and the plane measured with the Surface Plane tool. 

The tilt angle can also be understood as the angle between the Z axis and the surface normal vector. This allows us to calculate the angle from the dot product of these two vectors. The dot product of the Z axis unit vector and the surface normal is equal to the Z component of the surface normal vector, which is cos(X_Angle) * cos(Y_Angle). The tilt angle can be calculated from the arc-cosine of this value:

    tilt = acos(cos(X_Angle) * cos(Y_Angle))

This calculation can be performed in a script, assuming you have added a Surface Plane tool with the default name.

// Gocator script to calculate Surface Plane tilt angle from X and Y Angles.
// This script assumes you have Surface Plane tool added with the default name.

char* toolName = "Surface Plane";
char* xAngleName = "X Angle";
char* yAngleName = "Y Angle";
float degToRad = 3.141593/180;
float radToDeg = 180/3.141593;

// check if the measurement tool exists
if (Measurement_NameExists(toolName, xAngleName)
 && Measurement_NameExists(toolName, yAngleName))
{
  // get the X and Y Angle outputs from the tool and convert to radians
  float xAngle = degToRad*Measurement_Value(Measurement_Id(toolName, xAngleName));
  float yAngle = degToRad*Measurement_Value(Measurement_Id(toolName, yAngleName));

  // calculate the tilt in radians
  float tiltRad = acos(cos(xAngle)*cos(yAngle));
  
  // set the output
  Output_SetAt(0, tiltRad*radToDeg, 1);
}
else
{
  // set the output to 0 with a measurement failed decision value
  Output_SetAt(0, 0, 0);
}