本文整理汇总了C#中Jitter2D.LinearMath.JVector.LengthSquared方法的典型用法代码示例。如果您正苦于以下问题:C# JVector.LengthSquared方法的具体用法?C# JVector.LengthSquared怎么用?C# JVector.LengthSquared使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jitter2D.LinearMath.JVector
的用法示例。
在下文中一共展示了JVector.LengthSquared方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClosestPoints
public static bool ClosestPoints(ISupportMappable support1, ISupportMappable support2, ref JMatrix orientation1,
ref JMatrix orientation2, ref JVector position1, ref JVector position2,
out JVector p1, out JVector p2, out JVector normal)
{
VoronoiSimplexSolver simplexSolver = simplexSolverPool.GetNew();
simplexSolver.Reset();
p1 = p2 = JVector.Zero;
JVector r = position1 - position2;
JVector w, v;
JVector supVertexA;
JVector rn, vn;
rn = JVector.Negate(r);
SupportMapTransformed(support1, ref orientation1, ref position1, ref rn, out supVertexA);
JVector supVertexB;
SupportMapTransformed(support2, ref orientation2, ref position2, ref r, out supVertexB);
v = supVertexA - supVertexB;
normal = JVector.Zero;
int iter = 0;
float distSq = v.LengthSquared();
float epsilon = 0.00001f;
while ((distSq > epsilon) && (iter++ < MaxIterations))
{
IterationsTaken = iter;
vn = JVector.Negate(v);
SupportMapTransformed(support1, ref orientation1, ref position1, ref vn, out supVertexA);
SupportMapTransformed(support2, ref orientation2, ref position2, ref v, out supVertexB);
w = supVertexA - supVertexB;
if (!simplexSolver.InSimplex(w)) simplexSolver.AddVertex(w, supVertexA, supVertexB);
if (simplexSolver.Closest(out v))
{
distSq = v.LengthSquared();
normal = v;
}
else distSq = 0.0f;
}
simplexSolver.ComputePoints(out p1, out p2);
if (normal.LengthSquared() > JMath.Epsilon * JMath.Epsilon)
normal.Normalize();
simplexSolverPool.GiveBack(simplexSolver);
return true;
}
示例2: PointInsideLocal
/// <summary>
/// Returns true if the point is inside the circle.
/// </summary>
/// <param name="point">The point.</param>
/// <returns>True if the point is inside the circle.</returns>
public override bool PointInsideLocal(JVector point)
{
return (point.LengthSquared() <= (radius * radius));
}