mirror of
https://github.com/glfw/glfw.git
synced 2025-10-03 21:30:57 +00:00
Change orientation unit to radian
This commit is contained in:
parent
79ac263771
commit
fa5882eb54
@ -1518,9 +1518,9 @@ typedef void (* GLFWjoystickfun)(int,int);
|
|||||||
* @param[in] y pen position relative to the screen.
|
* @param[in] y pen position relative to the screen.
|
||||||
* @param[in] z pen position relative to the tablet.
|
* @param[in] z pen position relative to the tablet.
|
||||||
* @param[in] pen pressure from 0.0 to 1.0.
|
* @param[in] pen pressure from 0.0 to 1.0.
|
||||||
* @param[in] pen pitch in degree.
|
* @param[in] pen pitch in radian.
|
||||||
* @param[in] pen yaw in degree.
|
* @param[in] pen yaw in radian.
|
||||||
* @param[in] pen roll in degree.
|
* @param[in] pen roll in radian.
|
||||||
*
|
*
|
||||||
* @sa @ref pen_tablet_data
|
* @sa @ref pen_tablet_data
|
||||||
* @sa @ref glfwSetPenTabletDataCallback
|
* @sa @ref glfwSetPenTabletDataCallback
|
||||||
|
@ -639,13 +639,13 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
|
|
||||||
x = ((double)(packet.x - contextInfo.lcInOrgX) / contextInfo.lcInExtX) * contextInfo.lcSysExtX + contextInfo.lcSysOrgX;
|
x = ((double)(packet.x - contextInfo.lcInOrgX) / contextInfo.lcInExtX) * contextInfo.lcSysExtX + contextInfo.lcSysOrgX;
|
||||||
y = ((double)(packet.y - contextInfo.lcInOrgY) / contextInfo.lcInExtY) * contextInfo.lcSysExtY + contextInfo.lcSysOrgY;
|
y = ((double)(packet.y - contextInfo.lcInOrgY) / contextInfo.lcInExtY) * contextInfo.lcSysExtY + contextInfo.lcSysOrgY;
|
||||||
z = ((double)(packet.z - contextInfo.lcOutOrgZ) / contextInfo.lcOutExtZ);
|
z = packet.z / 1024.0;
|
||||||
pressure = (double)(packet.normalPressure - pressureInfo.min) / (pressureInfo.max - pressureInfo.min);
|
pressure = (double)(packet.normalPressure - pressureInfo.min) / (pressureInfo.max - pressureInfo.min);
|
||||||
if (aziInfo.resolution && altInfo.resolution) {
|
if (aziInfo.resolution && altInfo.resolution) {
|
||||||
double alt = (double)(packet.orientation.altitude - altInfo.min) / (altInfo.max - altInfo.min);
|
double alt = (double)(packet.orientation.altitude - altInfo.min) / (altInfo.max - altInfo.min);
|
||||||
double azi = (double)(packet.orientation.azimuth - aziInfo.min) / (aziInfo.max - aziInfo.min);
|
double azi = (double)(packet.orientation.azimuth - aziInfo.min) / (aziInfo.max - aziInfo.min);
|
||||||
pitch = (0.5 - alt) * 180.0;
|
pitch = alt * 3.14159265359;
|
||||||
yaw = azi * 360.0;
|
yaw = azi * 6.28318530718;
|
||||||
}
|
}
|
||||||
if (rollInfo.resolution) { // roll seems to be mostly unsupported so this is untested
|
if (rollInfo.resolution) { // roll seems to be mostly unsupported so this is untested
|
||||||
roll = (double)(packet.orientation.twist - rollInfo.min) / (rollInfo.max - rollInfo.min) * 360.0;
|
roll = (double)(packet.orientation.twist - rollInfo.min) / (rollInfo.max - rollInfo.min) * 360.0;
|
||||||
|
Loading…
Reference in New Issue
Block a user