コード例 #1
0
ファイル: struct0c6.cs プロジェクト: bing2008/CastNetGame
 public float m00017e(double p0, double p1)
 {
     struct0c6 structc;
     float num = (float) this.m000085();
     Vector2 vector = new Vector2(((float) (this.f0000c0.f000069 - this.f0000bf.f000069)) / num, ((float) (this.f0000c0.f000074 - this.f0000bf.f000074)) / num);
     Vector2 vector2 = new Vector2((float) (p0 - this.f0000bf.f000069), (float) (p1 - this.f0000bf.f000074));
     float num2 = Vector2.Dot(vector2, vector);
     if (num2 < 0f)
     {
         structc = new struct0c6(p0, p1, this.f0000bf.f000069, this.f0000bf.f000074);
         return (float) structc.m000085();
     }
     if (num2 > num)
     {
         structc = new struct0c6(p0, p1, this.f0000c0.f000069, this.f0000c0.f000074);
         return (float) structc.m000085();
     }
     vector.X *= num2;
     vector.Y *= num2;
     float num3 = vector2.X - vector.X;
     num3 *= num3;
     float num4 = vector2.Y - vector.Y;
     num4 *= num4;
     return (float) Math.Sqrt((double) (num3 + num4));
 }
コード例 #2
0
ファイル: struct0c6.cs プロジェクト: bing2008/CastNetGame
 public float m00017f(struct055 point, out struct0c6 connectingSegment)
 {
     double num = this.m000085();
     struct055 struct2 = new struct055((this.f0000c0.f000069 - this.f0000bf.f000069) / num, (this.f0000c0.f000074 - this.f0000bf.f000074) / num);
     struct055 struct3 = new struct055(point.f000069 - this.f0000bf.f000069, point.f000074 - this.f0000bf.f000074);
     double num2 = struct055.m000083(struct3, struct2);
     if (num2 < 0.0)
     {
         connectingSegment.f0000bf = point;
         connectingSegment.f0000c0 = this.f0000bf;
         return (float) connectingSegment.m000085();
     }
     if (num2 > num)
     {
         connectingSegment.f0000bf = point;
         connectingSegment.f0000c0 = this.f0000c0;
         return (float) connectingSegment.m000085();
     }
     connectingSegment.f0000bf = point;
     connectingSegment.f0000c0 = new struct055(this.f0000bf.f000069 + (num2 * struct2.f000069), this.f0000bf.f000074 + (num2 * struct2.f000074));
     return (float) connectingSegment.m000085();
 }