本文整理汇总了C#中Box2D.Common.Vec2.Set方法的典型用法代码示例。如果您正苦于以下问题:C# Vec2.Set方法的具体用法?C# Vec2.Set怎么用?C# Vec2.Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Box2D.Common.Vec2
的用法示例。
在下文中一共展示了Vec2.Set方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetWorldToScreenToOut
/// <summary>
/// Takes the world coordinates and puts the corresponding screen
/// coordinates in argScreen.
/// </summary>
/// <param name="worldX"></param>
/// <param name="worldY"></param>
/// <param name="argScreen"></param>
public void GetWorldToScreenToOut(float worldX, float worldY, Vec2 argScreen)
{
argScreen.Set(worldX, worldY);
ViewportTranform.GetWorldToScreen(argScreen, argScreen);
}
示例2: GetReactionForce
public override void GetReactionForce(float inv_dt, Vec2 argOut)
{
argOut.Set(m_uB).MulLocal(m_impulse).MulLocal(inv_dt);
}
示例3: GetReactionForce
public override void GetReactionForce(float inv_dt, Vec2 argOut)
{
Vec2 temp = Pool.PopVec2();
temp.Set(Axis).MulLocal(MotorImpulse + Impulse.Z);
argOut.Set(Perp).MulLocal(Impulse.X).AddLocal(temp).MulLocal(inv_dt);
Pool.PushVec2(1);
}
示例4: GetScreenToWorldToOut
/// <summary>
/// takes the screen coordinates and puts the corresponding
/// world coordinates in argWorld.
/// </summary>
/// <param name="screenX"></param>
/// <param name="screenY"></param>
/// <param name="argWorld"></param>
public void GetScreenToWorldToOut(float screenX, float screenY, Vec2 argWorld)
{
argWorld.Set(screenX, screenY);
ViewportTranform.GetScreenToWorld(argWorld, argWorld);
}
示例5: GetReactionForce
public override void GetReactionForce(float inv_dt, Vec2 argOut)
{
argOut.Set(Impulse.X, Impulse.Y).MulLocal(inv_dt);
}
示例6: ComputeCentroidToOut
public void ComputeCentroidToOut(Vec2[] vs, int count, Vec2 result)
{
Debug.Assert(count >= 3);
result.Set(0.0f, 0.0f);
float area = 0.0f;
// pRef is the reference point for forming triangles.
// It's location doesn't change the result (except for rounding error).
Vec2 pRef = pool1;
pRef.SetZero();
Vec2 e1 = pool2;
Vec2 e2 = pool3;
const float inv3 = 1.0f / 3.0f;
for (int i = 0; i < count; ++i)
{
// Triangle vertices.
Vec2 p1 = pRef;
Vec2 p2 = vs[i];
Vec2 p3 = i + 1 < count ? vs[i + 1] : vs[0];
e1.Set(p2).SubLocal(p1);
e2.Set(p3).SubLocal(p1);
float D = Vec2.Cross(e1, e2);
float triangleArea = 0.5f * D;
area += triangleArea;
// Area weighted centroid
e1.Set(p1).AddLocal(p2).AddLocal(p3).MulLocal(triangleArea * inv3);
result.AddLocal(e1);
}
// Centroid
Debug.Assert(area > Settings.EPSILON);
result.MulLocal(1.0f / area);
}
示例7: GetSearchDirection
public void GetSearchDirection(Vec2 result)
{
switch (Count)
{
case 1:
result.Set(m_v1.W).NegateLocal();
return;
case 2:
e12.Set(m_v2.W).SubLocal(m_v1.W);
// use out for a temp variable real quick
result.Set(m_v1.W).NegateLocal();
float sgn = Vec2.Cross(e12, result);
if (sgn > 0f)
{
// Origin is left of e12.
Vec2.CrossToOutUnsafe(1f, e12, result);
return;
}
else
{
// Origin is right of e12.
Vec2.CrossToOutUnsafe(e12, 1f, result);
return;
}
default:
Debug.Assert(false);
result.SetZero();
return;
}
}
示例8: GetWitnessPoints
public void GetWitnessPoints(Vec2 pA, Vec2 pB)
{
switch (Count)
{
case 0:
Debug.Assert(false);
break;
case 1:
pA.Set(m_v1.WA);
pB.Set(m_v1.WB);
break;
case 2:
case2.Set(m_v1.WA).MulLocal(m_v1.A);
pA.Set(m_v2.WA).MulLocal(m_v2.A).AddLocal(case2);
// m_v1.a * m_v1.wA + m_v2.a * m_v2.wA;
// *pB = m_v1.a * m_v1.wB + m_v2.a * m_v2.wB;
case2.Set(m_v1.WB).MulLocal(m_v1.A);
pB.Set(m_v2.WB).MulLocal(m_v2.A).AddLocal(case2);
break;
case 3:
pA.Set(m_v1.WA).MulLocal(m_v1.A);
case3.Set(m_v2.WA).MulLocal(m_v2.A);
case33.Set(m_v3.WA).MulLocal(m_v3.A);
pA.AddLocal(case3).AddLocal(case33);
pB.Set(pA);
// *pA = m_v1.a * m_v1.wA + m_v2.a * m_v2.wA + m_v3.a * m_v3.wA;
// *pB = *pA;
break;
default:
Debug.Assert(false);
break;
}
}
示例9: GetClosestPoint
/// <summary>
/// this returns pooled objects. don't keep or modify them
/// </summary>
/// <returns></returns>
public void GetClosestPoint(Vec2 result)
{
switch (Count)
{
case 0:
Debug.Assert(false);
result.SetZero();
return;
case 1:
result.Set(m_v1.W);
return;
case 2:
case22.Set(m_v2.W).MulLocal(m_v2.A);
case2.Set(m_v1.W).MulLocal(m_v1.A).AddLocal(case22);
result.Set(case2);
return;
case 3:
result.SetZero();
return;
default:
Debug.Assert(false);
result.SetZero();
return;
}
}
示例10: GetLinearVelocityFromWorldPointToOut
public void GetLinearVelocityFromWorldPointToOut(Vec2 worldPoint, Vec2 result)
{
result.Set(worldPoint).SubLocal(Sweep.C);
Vec2.CrossToOut(m_angularVelocity, result, result);
result.AddLocal(m_linearVelocity);
}
示例11: GetAnchorA
public override void GetAnchorA(Vec2 argOut)
{
argOut.Set(m_targetA);
}
示例12: GetYAxis
public void GetYAxis(Vec2 yAxis)
{
yAxis.Set(-Sin, Cos);
}
示例13: GetXAxis
public void GetXAxis(Vec2 xAxis)
{
xAxis.Set(Cos, Sin);
}