Пример #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);
        }
Пример #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);
        }
Пример #3
0
 public float SqrDot(EarPoint rhs)
 {
     return(mPoint[0] * rhs.mPoint[0] + mPoint[1] * rhs.mPoint[1]);
 }
Пример #4
0
 public float Dot(EarPoint rhs)
 {
     return(Vector2.Dot(mPoint, rhs.mPoint));
 }
Пример #5
0
 public float Cross(EarPoint rhs)
 {
     return((mPoint[0] * rhs.mPoint[1]) - (mPoint[1] * rhs.mPoint[0]));
 }
Пример #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));
        }
Пример #7
0
        public LinkedListNode <EarPoint> InsertPoint(Vector3 v, LinkedListNode <EarPoint> cur)
        {
            EarPoint newPoint = new EarPoint(mNumberOfPoints++, v);

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