当前位置: 首页>>代码示例>>C#>>正文


C# Vec2.set方法代码示例

本文整理汇总了C#中Vec2.set方法的典型用法代码示例。如果您正苦于以下问题:C# Vec2.set方法的具体用法?C# Vec2.set怎么用?C# Vec2.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Vec2的用法示例。


在下文中一共展示了Vec2.set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: initTest

        public override void initTest(bool argDeserialized)
        {
            input.transformA = new Transform();
            input.transformB = new Transform();
            {
                m_transformA = new Transform();
                m_transformA.setIdentity();
                m_transformA.p.set(0.0f, -0.2f);
                m_polygonA = new PolygonShape();
                m_polygonA.setAsBox(10.0f, 0.2f);
            }

            {
                m_positionB = new Vec2();
                m_positionB.set(12.017401f, 0.13678508f);
                m_angleB = -0.0109265f;

                m_transformB = new Transform();
                m_transformB.set(m_positionB, m_angleB);

                m_polygonB = new PolygonShape();
                m_polygonB.setAsBox(2.0f, 0.1f);
            }
            for (int i = 0; i < v.Length; i++)
            {
                v[i] = new Vec2();
            }
        }
开发者ID:Nomad1,项目名称:sharpbox2d,代码行数:28,代码来源:DistanceTest.cs

示例2: getReactionForce

 public override void getReactionForce(float inv_dt, ref Vec2 argOut)
 {
     Vec2 temp = pool.popVec2();
     temp.set(m_axis);
     temp.mulLocal(m_motorImpulse + m_impulse.z);
     argOut.set(m_perp);
     temp.mulLocal(m_impulse.x);
     temp.addLocal(temp);
     temp.mulLocal(inv_dt);
     pool.pushVec2(1);
 }
开发者ID:Nomad1,项目名称:sharpbox2d,代码行数:11,代码来源:PrismaticJoint.cs

示例3: getWorldToScreenToOut

 /**
    * Takes the world coordinates and puts the corresponding screen coordinates in argScreen.
    *
    * @param worldX
    * @param worldY
    * @param argScreen
    */
 public void getWorldToScreenToOut(float worldX, float worldY, Vec2 argScreen)
 {
     argScreen.set(worldX, worldY);
     viewportTransform.getWorldToScreen(argScreen, argScreen);
 }
开发者ID:Nomad1,项目名称:sharpbox2d,代码行数:12,代码来源:DebugDraw.cs

示例4: getScreenToWorldToOut

 /**
    * takes the screen coordinates and puts the corresponding world coordinates in argWorld.
    *
    * @param screenX
    * @param screenY
    * @param argWorld
    */
 public void getScreenToWorldToOut(float screenX, float screenY, Vec2 argWorld)
 {
     argWorld.set(screenX, screenY);
     viewportTransform.getScreenToWorld(argWorld, argWorld);
 }
开发者ID:Nomad1,项目名称:sharpbox2d,代码行数:12,代码来源:DebugDraw.cs

示例5: op

 public float op(Vec2 argVec)
 {
     argVec.set(MathUtils.randomFloat(-100, 100), MathUtils.randomFloat(-100, 100));
     argVec.mulLocal(3.2f);
     float s = argVec.length();
     argVec.normalize();
     return s;
 }
开发者ID:Nomad1,项目名称:sharpbox2d,代码行数:8,代码来源:StackTest.cs

示例6: getLinearOffset

 /**
    * Get the target linear offset, in frame A, in meters.
    */
 public void getLinearOffset(ref Vec2 v)
 {
     v.set(m_linearOffset);
 }
开发者ID:Nomad1,项目名称:sharpbox2d,代码行数:7,代码来源:MotorJoint.cs

示例7: getAnchorB

 public override void getAnchorB(ref Vec2 v)
 {
     v.set(m_bodyB.getPosition());
 }
开发者ID:Nomad1,项目名称:sharpbox2d,代码行数:4,代码来源:MotorJoint.cs

示例8: MoveAABB

        public void MoveAABB(AABB aabb)
        {
            Vec2 d = new Vec2();
            d.x = MathUtils.randomFloat(rand, -0.5f, 0.5f);
            d.y = MathUtils.randomFloat(rand, -0.5f, 0.5f);
            // d.x = 2.0f;
            // d.y = 0.0f;
            aabb.lowerBound.addLocal(d);
            aabb.upperBound.addLocal(d);
            aabb.lowerBound.add(aabb.upperBound);
            aabb.lowerBound.mulLocal(.5f);
            Vec2 c0 = aabb.lowerBound;
            Vec2 min = new Vec2();
            min.set(-worldExtent, 0.0f);
            Vec2 max = new Vec2();
            max.set(worldExtent, 2.0f*worldExtent);
            Vec2 c = MathUtils.clamp(c0, min, max);

            aabb.lowerBound.addLocal(c.sub(c0));
            aabb.upperBound.addLocal(c.sub(c0));
        }
开发者ID:Nomad1,项目名称:sharpbox2d,代码行数:21,代码来源:DynamicTreeTest.cs

示例9: computeCentroidToOut

        public void computeCentroidToOut(Vec2[] vs, int count, ref Vec2 v)
        {
            Debug.Assert(count >= 3);

            v.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;

            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); e1.subLocal(p1);
                e2.set(p3); e2.subLocal(p1);

                float D = Vec2.cross(e1, e2);

                float triangleArea = 0.5f*D;
                area += triangleArea;

                // Area weighted centroid
                e1.set(p1);
                e1.addLocal(p2);
                e1.addLocal(p3);
                e1.mulLocal(triangleArea*inv3);

                v.addLocal(e1);
            }

            // Centroid
            Debug.Assert(area > Settings.EPSILON);
            v.mulLocal(1.0f/area);
        }
开发者ID:Nomad1,项目名称:sharpbox2d,代码行数:45,代码来源:PolygonShape.cs

示例10: getAnchorA

 public override void getAnchorA(ref Vec2 argOut)
 {
     argOut.set(m_targetA);
 }
开发者ID:Nomad1,项目名称:sharpbox2d,代码行数:4,代码来源:MouseJoint.cs

示例11: getWitnessPoints

            public void getWitnessPoints(Vec2 pA, Vec2 pB)
            {
                switch (m_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);
                        case2.mulLocal(m_v1.a);
                        pA.set(m_v2.wA);
                        pA.mulLocal(m_v2.a);
                        pA.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);
                        case2.mulLocal(m_v1.a);
                        pB.set(m_v2.wB);
                        pB.mulLocal(m_v2.a);
                        pB.addLocal(case2);

                        break;

                    case 3:
                        pA.set(m_v1.wA);
                        pA.mulLocal(m_v1.a);
                        case3.set(m_v2.wA);
                        case3.mulLocal(m_v2.a);
                        case33.set(m_v3.wA);
                        case33.mulLocal(m_v3.a);
                        pA.addLocal(case3);
                        pA.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;
                }
            }
开发者ID:Nomad1,项目名称:sharpbox2d,代码行数:48,代码来源:Distance.cs

示例12: getSearchDirection

            public void getSearchDirection(ref Vec2 v)
            {
                switch (m_count)
                {
                    case 1:
                        v.set(m_v1.w);
                        v.negateLocal();
                        return;
                    case 2:
                        e12.set(m_v2.w);
                        e12.subLocal(m_v1.w);
                        // use ref for a temp variable real quick
                        v.set(m_v1.w);
                        v.negateLocal();
                        float sgn = Vec2.cross(e12, v);

                        if (sgn > 0f)
                        {
                            // Origin is left of e12.
                            Vec2.crossToOutUnsafe(1f, e12, ref v);
                            return;
                        }
                        else
                        {
                            // Origin is right of e12.
                            Vec2.crossToOutUnsafe(e12, 1f, ref v);
                            return;
                        }
                    default:
                        Debug.Assert(false);
                        v.setZero();
                        return;
                }
            }
开发者ID:Nomad1,项目名称:sharpbox2d,代码行数:34,代码来源:Distance.cs

示例13: getClosestPoint

 /**
  * this returns pooled objects. don't keep or modify them
  *
  * @return
  */
 public void getClosestPoint(ref Vec2 v)
 {
     switch (m_count)
     {
         case 0:
             Debug.Assert(false);
             v.setZero();
             return;
         case 1:
             v.set(m_v1.w);
             return;
         case 2:
             case22.set(m_v2.w);
             case22.mulLocal(m_v2.a);
             case2.set(m_v1.w);
             case2.mulLocal(m_v1.a);
             case2.addLocal(case22);
             v.set(case2);
             return;
         case 3:
             v.setZero();
             return;
         default:
             Debug.Assert(false);
             v.setZero();
             return;
     }
 }
开发者ID:Nomad1,项目名称:sharpbox2d,代码行数:33,代码来源:Distance.cs

示例14: getReactionForce

 public override void getReactionForce(float inv_dt, ref Vec2 argOut)
 {
     argOut.set(m_impulse.x, m_impulse.y);
     argOut.mulLocal(inv_dt);
 }
开发者ID:Nomad1,项目名称:sharpbox2d,代码行数:5,代码来源:RevoluteJoint.cs

示例15: getReactionForce

 public override void getReactionForce(float inv_dt, ref Vec2 v)
 {
     v.set(m_linearImpulse);
     v.mulLocal(inv_dt);
 }
开发者ID:Nomad1,项目名称:sharpbox2d,代码行数:5,代码来源:MotorJoint.cs


注:本文中的Vec2.set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。