示例#1
0
 public static bool IsOverlappedPointPointRect(SPoint Point_, SPointRect PointRect_)
 {
     return(
         CBase.ThetaOfTwoVectors(PointRect_.TopLeft.Sub(PointRect_.TopRight), Point_.Sub(PointRect_.TopRight)) < 0.0 &&
         CBase.ThetaOfTwoVectors(PointRect_.BottomLeft.Sub(PointRect_.TopLeft), Point_.Sub(PointRect_.TopLeft)) < 0.0 &&
         CBase.ThetaOfTwoVectors(PointRect_.BottomRight.Sub(PointRect_.BottomLeft), Point_.Sub(PointRect_.BottomLeft)) < 0.0 &&
         CBase.ThetaOfTwoVectors(PointRect_.TopRight.Sub(PointRect_.BottomRight), Point_.Sub(PointRect_.BottomRight)) < 0.0);
 }
示例#2
0
        public static SPoint GetCurPos(this SObjectStraight ObjectStraight_, float Time_)
        {
            if (ObjectStraight_.Dist == 0.0f)
            {
                return(ObjectStraight_.PosTheta.Pos);
            }

            var CurDist = ObjectStraight_.Speed * (Time_ - ObjectStraight_.Time);

            if (CurDist > ObjectStraight_.Dist)
            {
                CurDist = ObjectStraight_.Dist;
                ObjectStraight_.Dist = 0.0f;
                ObjectStraight_.Time = Time_;
                return(ObjectStraight_.PosTheta.Pos.Add(CBase.Vector(ObjectStraight_.PosTheta.Theta, CurDist)));
            }
            else
            {
                return(ObjectStraight_.PosTheta.Pos.GetAdd(CBase.Vector(ObjectStraight_.PosTheta.Theta, CurDist)));
            }
        }