PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Orientation of a device: definitions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
SensorGetOrientation (Function)
In French: CapteurRécupèreOrientation
Retrieves the current orientation of the device on one of its 3 axes.
Versions 17 and later
Universal Windows 10 App This function is now available for the Windows Phone applications.
New in version 17
Universal Windows 10 App This function is now available for the Windows Phone applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Android Widget This function is now available in Android Widget mode.
Versions 19 and later
WEBDEV - Browser code This function is now available in Browser code.
New in version 19
WEBDEV - Browser code This function is now available in Browser code.
WEBDEV - Browser code This function is now available in Browser code.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Example
nOrientation is int
nOrientation = SensorGetOrientation(snrAzimuth)
IF ErrorOccurred = True THEN
Error(ErrorInfo())
RETURN
END
Info(StringBuild("Orientation of the phone in relation to the North: %1 degrees", nOrientation))
// Device in portrait mode or in landscape mode?
IF Abs(SensorGetOrientation(cptRoll)) < 45 THEN
// Device in portrait mode
ELSE
// Device in landscape mode
END

// Device placed horizontally or vertically?
IF Abs(SensorGetOrientation(cptPitch)) < 45 THEN
// Device placed horizontally
ELSE
// Device placed vertically
END
Syntax
<Result> = SensorGetOrientation(<Orientation Type>)
<Result>: Integer
Orientation of the device expressed in degrees according to the requested type of orientation.
<Orientation Type>: Integer constant
Type of orientation to return:
snrAzimuthOrientation around the vertical axis (Z).
snrPitchOrientation around the horizontal axis (X).
snrRollOrientation around the longitudinal axis (Y).
Remarks

Orientation of a device: definitions

The change of orientation can be specified according to the three following dimensions:
  • Azimuth: Direction of the device in relation to the magnetic North around the vertical axis (Z). This direction is expressed in degrees (from 0 to 360 degrees). In this case, 0 or 360 corresponds to the North, 90 corresponds to the East, 180 corresponds to the South and 270 corresponds to the West.
  • Pitch: Rotation of the device around the horizontal axis (X). This rotation is expressed in degrees (from -180 to 180). Its value is set to 0 degree when the device lies down flat with the screen pointing to the ceiling, -90 degrees when the device stands still with the top of the device pointing to the ceiling, 90 degrees when the device stands still with the top of the device pointing to the ground and -180/180 degrees when the device lies down flat with the screen pointing to the ground.
  • Roll: Rotation of the device around the longitudinal axis (Y). This rotation is expressed in degrees (from -90 to 90). Its value is set to 0 degree when the device lies down flat with the screen pointing to the ceiling, -90 degrees when the screen is oriented to the left and 90 degrees when the screen is oriented to the right.
Origin of the orientation
System of coordinates (considering that the device lies down flat, the screen directed to the ceiling):
  • The origin is found in the bottom left corner of the screen.
  • The X axis represents the horizontal axis and it points to the right of the screen.
  • The Y axis represents the longitudinal axis and it points to the top of the screen.
  • The Z axis represents the vertical axis and it points outside the front of the screen.
Components
WEBDEV - Browser code WDJS.DLL
Android wd230android.jar
Minimum required version
  • Version 16
This page is also available for…
Comments
Click [Add] to post a comment