예제 #1
0
        public bool IntersectSegment(ref VInt3 segSrc, ref VInt3 segVec, ref VInt3 nearPoint, ref VInt3 pointProj)
        {
            if (this._vertecesXZ == null || this._vertecesXZ.Length < 2)
            {
                return(false);
            }
            if (!this.IsInBoundXZ(segSrc) && !this.IsInBoundXZ(segSrc + segVec))
            {
                return(false);
            }
            VInt2 xz  = segSrc.get_xz();
            VInt2 xz2 = segVec.get_xz();
            VInt2 vInt;
            VInt2 vInt2;

            if (IntMath.SegIntersectPlg(ref xz, ref xz2, this._vertecesXZ, ref vInt, ref vInt2))
            {
                nearPoint.x = vInt.x;
                nearPoint.z = vInt.y;
                pointProj.x = vInt2.x;
                pointProj.z = vInt2.y;
                return(true);
            }
            return(false);
        }
예제 #2
0
 public bool IntersectSegment(ref VInt3 segSrc, ref VInt3 segVec, ref VInt3 nearPoint, ref VInt3 pointProj)
 {
     if (((this._vertecesXZ != null) && (this._vertecesXZ.Length >= 2)) && (this.IsInBoundXZ(segSrc) || this.IsInBoundXZ(segSrc + segVec)))
     {
         VInt2 num3;
         VInt2 num4;
         VInt2 xz   = segSrc.xz;
         VInt2 num2 = segVec.xz;
         if (IntMath.SegIntersectPlg(ref xz, ref num2, this._vertecesXZ, out num3, out num4))
         {
             nearPoint.x = num3.x;
             nearPoint.z = num3.y;
             pointProj.x = num4.x;
             pointProj.z = num4.y;
             return(true);
         }
     }
     return(false);
 }