本文整理汇总了C#中IrrlichtNETCP.Vector3D.Set方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3D.Set方法的具体用法?C# Vector3D.Set怎么用?C# Vector3D.Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IrrlichtNETCP.Vector3D
的用法示例。
在下文中一共展示了Vector3D.Set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Box3D
public Box3D(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax)
{
MinEdge = new Vector3D();
MaxEdge = new Vector3D();
MinEdge.Set(xMin, yMin, zMin);
MaxEdge.Set(xMax, yMax, zMax);
}
示例2: CalculateSphericalCameraCoordinates
public IrrlichtNETCP.Vector3D CalculateSphericalCameraCoordinates(IrrlichtNETCP.Vector3D camPos,
IrrlichtNETCP.Vector3D targetPos)
{
float xCamRotationAnglePHI, xCamRotationAngleTHETA;
IrrlichtNETCP.Vector3D result = new IrrlichtNETCP.Vector3D(); // result is spherical coordinates as a 3D vector in (radius, theta, phi) order
IrrlichtNETCP.Vector3D relCamPos = camPos - targetPos;
float camDistance = (float)Math.Sqrt(relCamPos.DotProduct(relCamPos));
xCamRotationAnglePHI = 0.5f * (float)Math.PI - (float)Math.Asin((double)(relCamPos.Y / camDistance));
if (xCamRotationAnglePHI < 0.0)
{
xCamRotationAnglePHI += 2.0f * (float)Math.PI;
}
if (Math.Abs(relCamPos.X) > 0.0)
{
xCamRotationAngleTHETA = (float)Math.Atan((double)(relCamPos.Z / relCamPos.X));
if (relCamPos.X < 0.0f)
{
xCamRotationAngleTHETA += (float)Math.PI;
}
if (xCamRotationAngleTHETA < 0.0)
{
xCamRotationAngleTHETA += 2.0f * (float)Math.PI;
}
}
else
{
if (relCamPos.Z > 0)
{
xCamRotationAngleTHETA = 0.5f * (float)Math.PI; // 90 deg
}
else
{
xCamRotationAngleTHETA = 1.5f * (float)Math.PI; // 270 deg
}
}
result.Set(camDistance, xCamRotationAngleTHETA, xCamRotationAnglePHI);
return result;
}