Exemple #1
0
        private static bool InTriangle(EarPoint pointToCheck, EarPoint earTip, EarPoint earTipPlusOne, EarPoint earTipMinusOne)
        {
            bool isIntriangle = GeoTriangleUtils.IsPointInTriangle2(earTip.mPoint, earTipPlusOne.mPoint, earTipMinusOne.mPoint, ref pointToCheck.mPoint);

            if (isIntriangle)
            {
                if (pointToCheck.mPoint == earTip.mPoint || pointToCheck.mPoint == earTipPlusOne.mPoint || pointToCheck.mPoint == earTipMinusOne.mPoint) // 端点
                {
                    return(false);
                }
            }
            return(isIntriangle);
        }
Exemple #2
0
        private static bool DoIntersect(EarPoint a, EarPoint b, EarPoint c, EarPoint d)
        {
            GeoInsectPointInfo insect = new GeoInsectPointInfo();
            bool isInsect             = GeoSegmentUtils.IsSegmentInsectSegment2(a.mPoint, b.mPoint, c.mPoint, d.mPoint, ref insect);

            if (isInsect)
            {
                float x = insect.mHitGlobalPoint[0];
                float y = insect.mHitGlobalPoint[1];
                if ((x == c[0] && y == c[1]) || (x == d[0] && y == d[1])) // 端点检测
                {
                    return(false);
                }
            }
            return(isInsect);
        }
Exemple #3
0
 public float SqrDot(EarPoint rhs)
 {
     return(mPoint[0] * rhs.mPoint[0] + mPoint[1] * rhs.mPoint[1]);
 }
Exemple #4
0
 public float Dot(EarPoint rhs)
 {
     return(Vector2.Dot(mPoint, rhs.mPoint));
 }
Exemple #5
0
 public float Cross(EarPoint rhs)
 {
     return((mPoint[0] * rhs.mPoint[1]) - (mPoint[1] * rhs.mPoint[0]));
 }
Exemple #6
0
        public LinkedListNode <EarPoint> InsertPoint(float x, float y, LinkedListNode <EarPoint> cur)
        {
            EarPoint newPoint = new EarPoint(mNumberOfPoints++, x, y);

            return(mHead.AddAfter(cur, newPoint));
        }