本文整理匯總了C#中Sharp3D.Math.Core.Vector2D.Normalize方法的典型用法代碼示例。如果您正苦於以下問題:C# Vector2D.Normalize方法的具體用法?C# Vector2D.Normalize怎麽用?C# Vector2D.Normalize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sharp3D.Math.Core.Vector2D
的用法示例。
在下文中一共展示了Vector2D.Normalize方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DrawArrowHead
protected void DrawArrowHead(Pic.Factory2D.PicGraphics graphics, Vector2D pt, Vector2D director)
{
director.Normalize();
Vector2D normal = new Vector2D(-director.Y, director.X);
double angleRad = _globalCotationProperties._arrowHeadAngle * Math.PI / 180.0;
double arrowLength = graphics.DX_inv(_globalCotationProperties._arrowLength);
// lower part of arrow head
graphics.DrawLine(LineType
, pt - arrowLength * (Math.Cos(angleRad) * director + Math.Sin(angleRad) * normal)
, pt);
// upper part of arrow head
graphics.DrawLine(LineType
, pt - arrowLength * (Math.Cos(angleRad) * director - Math.Sin(angleRad) * normal)
, pt);
}
示例2: vecToAngleRad
static public double vecToAngleRad(Vector2D vec)
{
// handling null vector case
const double epsilon = 0.001;
if (vec.GetLengthSquared() < epsilon) return 0.0;
// non null vector
vec.Normalize();
if (vec.Y >= 0.0)
return Math.Acos(vec.X);
else
return 2.0 * Math.PI - Math.Acos(vec.X);
}