예제 #1
0
        internal void CreateGlyphEdges()
        {
            int             lim = flattenPoints.Count - 1;
            GlyphPoint      p = null, q = null;
            OutsideEdgeLine edgeLine = null;

            _edges = new List <OutsideEdgeLine>();
            //
            for (int i = 0; i < lim; ++i)
            {
                //in order ...
                p = flattenPoints[i];
                q = flattenPoints[i + 1];
                if ((edgeLine = EdgeLine.FindCommonOutsideEdge(p, q)) != null)
                {
                    //from p point to q
                    //so ...
                    //edgeLine is outwardEdge for p.
                    //edgeLine is inwardEdge for q.
                    //p.OutwardEdge = q.InwardEdge = edgeLine;
                    _edges.Add(edgeLine);
                }
                else
                {
                    //?
                }
            }
            //close
            p = flattenPoints[lim];
            q = flattenPoints[0];

            if ((edgeLine = EdgeLine.FindCommonOutsideEdge(p, q)) != null)
            {
                //from p point to q
                //so ...
                //edgeLine is outwardEdge for p.
                //edgeLine is inwardEdge for q.
                //p.OutwardEdge = q.InwardEdge = edgeLine;
                _edges.Add(edgeLine);
            }
            else
            {
                //not found
            }
        }
예제 #2
0
        /// <summary>
        /// update dynamic cutpoint of 2 adjacent edges
        /// </summary>
        /// <param name="p"></param>
        static void UpdateNewEdgeCut(GlyphPoint p)
        {
            OutsideEdgeLine e0 = p.E0;
            OutsideEdgeLine e1 = p.E1;

            Vector2 tmp_e0_q = e0._newDynamicMidPoint + e0.GetOriginalEdgeVector();
            Vector2 tmp_e1_p = e1._newDynamicMidPoint - e1.GetOriginalEdgeVector();

            Vector2 cutpoint;

            if (MyMath.FindCutPoint(e0._newDynamicMidPoint, tmp_e0_q, e1._newDynamicMidPoint, tmp_e1_p, out cutpoint))
            {
                p.SetNewXY(cutpoint.X, cutpoint.Y);
            }
            else
            {
                //pararell edges
            }
        }