예제 #1
0
 //点p1 ,p2 ,p3 から三角形が作れるかを判定(3点が一直線上にないか判定)
 public static bool isTriangle(LDPoint p1, LDPoint p2, LDPoint p3)
 {
     if ((p1.x() * p2.y() + p2.x() * p3.y() + p3.x() * p1.y()) - (p1.x() * p3.y() + p2.x() * p1.y() + p3.x() * p2.y()) != 0)
     {
         return(true);
     }
     return(false);
 }
예제 #2
0
파일: PointUtil.cs 프로젝트: KajitaLD/math
            //2点が一定差以内(d以下)にあるかどうか。
            public static bool isNearSimple(LDPoint a, LDPoint b, float d)
            {
                if (Math.Abs(a.x() - b.x()) > d) return false;
                if (Math.Abs(a.y() - b.y()) > d) return false;

                return true;
            }
예제 #3
0
        //三角形の高さ (底辺p12からp3までの高さ)
        public static float getTriangleHeight(LDPoint p1, LDPoint p2, LDPoint p3)
        {
            LDPoint ab = p2 - p1;
            LDPoint ac = p3 - p1;
            float   D  = Math.Abs(ab.x() * ac.y() - ab.y() * ac.x());
            float   L  = PointUtil.distance(p1, p2);
            float   H  = D / L;

            return(H);
        }
예제 #4
0
            //2点が一定差以内(d以下)にあるかどうか。

            public static bool isNearSimple(LDPoint a, LDPoint b, float d)
            {
                if (Math.Abs(a.x() - b.x()) > d)
                {
                    return(false);
                }
                if (Math.Abs(a.y() - b.y()) > d)
                {
                    return(false);
                }

                return(true);
            }
예제 #5
0
 private static uint qHash(LDPoint key)
 {
     return((uint)key.x().GetHashCode());//適当。xだけでハッシュ
 }
예제 #6
0
 private static uint qHash(LDPoint key)
 {
     return (uint)key.x().GetHashCode();//適当。xだけでハッシュ
 }
예제 #7
0
 //点p1 ,p2 ,p3 から三角形が作れるかを判定(3点が一直線上にないか判定)
 public static bool isTriangle(LDPoint p1, LDPoint p2, LDPoint p3)
 {
     if ((p1.x() * p2.y() + p2.x() * p3.y() + p3.x() * p1.y()) - (p1.x() * p3.y() + p2.x() * p1.y() + p3.x() * p2.y()) != 0)
         return true;
     return false;
 }
예제 #8
0
 //文字列にする
 public static String toString(LDPoint p)
 {
     return("Point (" + p.x() + "," + p.y() + ")");
 }
예제 #9
0
파일: PointUtil.cs 프로젝트: KajitaLD/math
 //文字列にする
 public static String toString(LDPoint p)
 {
     return "Point (" + p.x() + "," + p.y() + ")";
 }