示例#1
0
        public static bool IsCollidedVSegmentVSegment(SVSegment VSegment0_, SVSegment VSegment1_, SPoint Dir_, SCollisionInfo CollisionInfo_)
        {
            if (!IsCollidedPointVLine(new SPoint(VSegment0_.X, VSegment0_.Bottom), VSegment1_, Dir_, CollisionInfo_))
            {
                return(false);
            }

            // 라인의 중첩영역을 임시로 CollisionInfo의 Point에 저장
            CollisionInfo_.Point.X = CollisionInfo_.Point.Y + (VSegment0_.Top - VSegment0_.Bottom);

            if (CollisionInfo_.Point.Y < VSegment1_.Bottom) // Point.Y : ContactBottom
            {
                CollisionInfo_.Point.Y = VSegment1_.Bottom;
            }
            if (CollisionInfo_.Point.X > VSegment1_.Top)    // Point.X : ContactTop
            {
                CollisionInfo_.Point.X = VSegment1_.Top;
            }

            if (CollisionInfo_.Point.X < CollisionInfo_.Point.Y)    // 중첩영역이 없으면
            {
                return(false);
            }

            CollisionInfo_.Point.Y  = ((CollisionInfo_.Point.X + CollisionInfo_.Point.Y) / 2.0f);
            CollisionInfo_.Point.X  = VSegment1_.X;
            CollisionInfo_.Normal.X = -Dir_.X;
            CollisionInfo_.Normal.Y = 0.0f;
            return(true);
        }
示例#2
0
 public void Set(SVSegment Obj_)
 {
     base.Set(Obj_);
     Bottom = Obj_.Bottom;
     Top    = Obj_.Top;
 }
示例#3
0
 public SVSegment(SVSegment Obj_) : base(Obj_)
 {
     Bottom = Obj_.Bottom;
     Top    = Obj_.Top;
 }