SetZero() public method

Zero out this vector.
public SetZero ( ) : void
return void
Beispiel #1
0
            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;
                }
            }
Beispiel #2
0
 /// <summary>
 /// Set this to the identity transform.
 /// </summary>
 public void SetIdentity()
 {
     P.SetZero();
     Q.SetIdentity();
 }
Beispiel #3
0
            /// <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;

                }
            }