コード例 #1
0
ファイル: Segment3D.cs プロジェクト: jeffvella/DefenseShields
 /// <summary>
 /// Returns shortest distance from segment to the line
 /// </summary>
 public double DistanceTo(Line3d l)
 {
     if (l.PerpendicularTo(this.ToLine).BelongsTo(this))
     {
         return(l.DistanceTo(this.ToLine));
     }
     else
     {
         return(Min(this.P1.DistanceTo(l), this.P2.DistanceTo(l)));
     }
 }
コード例 #2
0
ファイル: Sphere.cs プロジェクト: jeffvella/DefenseShields
        public double DistanceTo(Line3d l)
        {
            double d = l.DistanceTo(this.Center);

            if (d > this.R)
            {
                return(d - this.R);
            }
            else
            {
                return(0);
            }
        }