This document is archived and information here might be outdated. Recommended version. |
Get the high precision normalized view direction.
[Visual Basic .NET]
Public Sub GetAccurateViewDirection ( _
ByRef pViewX As Double, _
ByRef pViewY As Double, _
ByRef pViewZ As Double _
)
[C#]
public void GetAccurateViewDirection (
ref double pViewX,
ref double pViewY,
ref double pViewZ
);
[C++]
HRESULT GetAccurateViewDirection(
System.Double* pViewX,
System.Double* pViewY,
System.Double* pViewZ
);
[C++] Parameters pViewX [out]
pViewX is a parameter of type double* pViewY [out]
pViewY is a parameter of type double* pViewZ [out]
pViewZ is a parameter of type double*
Get the high precision normalized view direction. The x, y and z values returned will create a 3D vector with a unit length of 1.
The following code shows that the x, y and z values returned will create a 3D vector with a unit length of 1.
..
ESRI.ArcGIS.GlobeCore.IGlobeDisplay globeDisplay = globe.GlobeDisplay;
ESRI.ArcGIS.Analyst3D.ISceneViewer sceneViewer = globeDisplay.ActiveViewer;
ESRI.ArcGIS.Analyst3D.ICamera camera = sceneViewer.Camera;
ESRI.ArcGIS.GlobeCore.IGlobeCamera globeCamera = (ESRI.ArcGIS.GlobeCore.IGlobeCamera)camera;
double viewX, viewY, viewZ;
globeCamera.GetAccurateViewDirection(out viewX, out viewY, out viewZ);
bool isVectorThreeD;
// Check if the magnitude of the resulting vector = 1
if (Math.Sqrt(Math.Pow(viewX, 2) + Math.Pow(viewY, 2) + Math.Pow(viewZ, 2)) == 1)
{
isVectorThreeD = true;
}
else
{
isVectorThreeD = false;
}
MessageBox.Show (isVectorThreeD.ToString()