本文整理汇总了C#中System.Vector4.ToVector2方法的典型用法代码示例。如果您正苦于以下问题:C# Vector4.ToVector2方法的具体用法?C# Vector4.ToVector2怎么用?C# Vector4.ToVector2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Vector4
的用法示例。
在下文中一共展示了Vector4.ToVector2方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DistanceSquared
/// <summary>
/// Calculates the squared distance between two vectors.
/// </summary>
/// <param name="vector2">Extended SharpDX Vector2</param>
/// <param name="toVector4">SharpDX Vector4</param>
/// <returns>The squared distance between the two vectors.</returns>
public static float DistanceSquared(this Vector2 vector2, Vector4 toVector4)
{
return Vector2.DistanceSquared(vector2, toVector4.ToVector2());
}
示例2: Extend
/// <summary>
/// Extends a Vector2 to a Vector4.
/// </summary>
/// <param name="vector2">Extended SharpDX Vector2 (From)</param>
/// <param name="toVector4">SharpDX Vector4 (To)</param>
/// <param name="distance">Distance (float units)</param>
/// <returns>Extended Vector2</returns>
public static Vector2 Extend(this Vector2 vector2, Vector4 toVector4, float distance)
{
return vector2 + distance * (toVector4.ToVector2() - vector2).Normalized();
}
示例3: Distance2D
/// <summary>
/// Extension wrapper for Vector2.Distance method
/// </summary>
/// <param name="v1">First vector</param>
/// <param name="v2">Second vector</param>
/// <returns>The distance between two vectors</returns>
public static float Distance2D(this Vector4 v1, Vector4 v2)
{
return Vector2.Distance(v1.ToVector2(), v2.ToVector2());
}