示例#1
0
        //--------------------- VectorToLocalSpace --------------------------------
        //
        //------------------------------------------------------------------------
        public static Vector2D VectorToLocalSpace(Vector2D vec,
                                                  Vector2D AgentHeading,
                                                  Vector2D AgentSide)
        {
            //make a copy of the point
            Vector2D TransPoint = new Vector2D(vec.X, vec.Y);

            //create a transformation matrix
            C2DMatrix matTransform = new C2DMatrix();

            //create the transformation matrix
            matTransform._11(AgentHeading.X); matTransform._12(AgentSide.X);
            matTransform._21(AgentHeading.Y); matTransform._22(AgentSide.Y);

            //now transform the vertices
            matTransform.TransformVector2D(TransPoint);

            return(TransPoint);
        }
示例#2
0
        //--------------------- PointToLocalSpace --------------------------------
        //
        //------------------------------------------------------------------------
        public static Vector2D PointToLocalSpace(Vector2D point,
                                                 Vector2D AgentHeading,
                                                 Vector2D AgentSide,
                                                 Vector2D AgentPosition)
        {
            //make a copy of the point
            Vector2D TransPoint = new Vector2D(point.X, point.Y);

            //create a transformation matrix
            C2DMatrix matTransform = new C2DMatrix();

            double Tx = -AgentPosition.Dot(AgentHeading);
            double Ty = -AgentPosition.Dot(AgentSide);

            //create the transformation matrix
            matTransform._11(AgentHeading.X); matTransform._12(AgentSide.X);
            matTransform._21(AgentHeading.Y); matTransform._22(AgentSide.Y);
            matTransform._31(Tx); matTransform._32(Ty);

            //now transform the vertices
            matTransform.TransformVector2D(TransPoint);

            return(TransPoint);
        }
示例#3
0
        //--------------------- VectorToLocalSpace --------------------------------
        //
        //------------------------------------------------------------------------
        public static Vector2D VectorToLocalSpace(Vector2D vec,
                                     Vector2D AgentHeading,
                                     Vector2D AgentSide)
        {

            //make a copy of the point
            Vector2D TransPoint = new Vector2D(vec.X, vec.Y);

            //create a transformation matrix
            C2DMatrix matTransform = new C2DMatrix();

            //create the transformation matrix
            matTransform._11(AgentHeading.X); matTransform._12(AgentSide.X);
            matTransform._21(AgentHeading.Y); matTransform._22(AgentSide.Y);

            //now transform the vertices
            matTransform.TransformVector2D( TransPoint);

            return TransPoint;
        }
示例#4
0
        //--------------------- PointToLocalSpace --------------------------------
        //
        //------------------------------------------------------------------------
        public static Vector2D PointToLocalSpace(Vector2D point,
                                     Vector2D AgentHeading,
                                     Vector2D AgentSide,
                                      Vector2D AgentPosition)
        {

            //make a copy of the point
            Vector2D TransPoint = new Vector2D(point.X, point.Y);

            //create a transformation matrix
            C2DMatrix matTransform = new C2DMatrix();

            double Tx = -AgentPosition.Dot(AgentHeading);
            double Ty = -AgentPosition.Dot(AgentSide);

            //create the transformation matrix
            matTransform._11(AgentHeading.X); matTransform._12(AgentSide.X);
            matTransform._21(AgentHeading.Y); matTransform._22(AgentSide.Y);
            matTransform._31(Tx); matTransform._32(Ty);

            //now transform the vertices
            matTransform.TransformVector2D( TransPoint);

            return TransPoint;
        }