Beispiel #1
0
            public void getSearchDirection(Vec2 out_Renamed)
            {
                switch (m_count)
                {

                    case 1:
                        out_Renamed.set_Renamed(m_v1.w).negateLocal();
                        return;

                    case 2:
                        e12.set_Renamed(m_v2.w).subLocal(m_v1.w);
                        // use out for a temp variable real quick
                        out_Renamed.set_Renamed(m_v1.w).negateLocal();
                        float sgn = Vec2.cross(e12, out_Renamed);

                        if (sgn > 0f)
                        {
                            // Origin is left of e12.
                            Vec2.crossToOutUnsafe(1f, e12, out_Renamed);
                            return;
                        }
                        else
                        {
                            // Origin is right of e12.
                            Vec2.crossToOutUnsafe(e12, 1f, out_Renamed);
                            return;
                        }
                        goto default;

                    default:
                        Debug.Assert(false);
                        out_Renamed.setZero();
                        return;

                }
            }
Beispiel #2
0
            /// <summary> this returns pooled objects. don't keep or modify them
            /// 
            /// </summary>
            /// <returns>
            /// </returns>
            public virtual void getClosestPoint(Vec2 out_Renamed)
            {
                switch (m_count)
                {

                    case 0:
                        Debug.Assert(false);
                        out_Renamed.setZero();
                        return;

                    case 1:
                        out_Renamed.set_Renamed(m_v1.w);
                        return;

                    case 2:
                        case22.set_Renamed(m_v2.w).mulLocal(m_v2.a);
                        case2.set_Renamed(m_v1.w).mulLocal(m_v1.a).addLocal(case22);
                        out_Renamed.set_Renamed(case2);
                        return;

                    case 3:
                        out_Renamed.setZero();
                        return;

                    default:
                        Debug.Assert(false);
                        out_Renamed.setZero();
                        return;

                }
            }