예제 #1
0
    public ShapePath GetShapePath(Vector3[] path = null, Quaternion[] rots = null)
    {
        if (path == null) {
            path = GetPathPoints();
        }
        if (rots == null) {
            rots = GetPathRots(path);
        }

        ShapePath sp = new ShapePath();
        sp.begin();

        sp.moveTo(path[0], rots[0]);
        for (int n = 1; n < path.Length-1; n++) {
            Vector3 pos = Vector3.Lerp(path[n], path[n + 1], 0.5f);
            sp.curveTo(path[n], pos, rots[n]);
        }

        Vector3 posC = Vector3.Lerp(path[path.Length - 2], path[path.Length - 1], 0.5f);
        Vector3 posEnd = path[path.Length - 1];
        sp.curveTo(posC, posEnd, rots[path.Length - 1]);

        sp.end();

        return sp;
    }
예제 #2
0
        public ShapePath.FlagsAndCommand vertex(out double x, out double y)
        {
            x = 0;
            y = 0;

            if (ShapePath.is_stop(m_NextPathCommand))
            {
                return(ShapePath.FlagsAndCommand.CommandStop);
            }

            if ((m_CurrentFlatenAngle < endAngle - flatenDeltaAngle / 4) != ((int)EDirection.CounterClockWise == 1))
            {
                x = originX + Math.Cos(endAngle) * radiusX;
                y = originY + Math.Sin(endAngle) * radiusY;
                m_NextPathCommand = ShapePath.FlagsAndCommand.CommandStop;

                return(ShapePath.FlagsAndCommand.CommandLineTo);
            }

            x = originX + Math.Cos(m_CurrentFlatenAngle) * radiusX;
            y = originY + Math.Sin(m_CurrentFlatenAngle) * radiusY;

            m_CurrentFlatenAngle += flatenDeltaAngle;

            ShapePath.FlagsAndCommand CurrentPathCommand = m_NextPathCommand;
            m_NextPathCommand = ShapePath.FlagsAndCommand.CommandLineTo;
            return(CurrentPathCommand);
        }
예제 #3
0
        public void CorrectlySetsColorThicknessAndRectangle()
        {
            img.Draw(color, thickness, rectangle);

            Assert.NotEmpty(img.ProcessorApplications);
            DrawPathProcessor <Color> processor = Assert.IsType <DrawPathProcessor <Color> >(img.ProcessorApplications[0].processor);

            Assert.Equal(GraphicsOptions.Default, processor.Options);

            ShapePath shapepath = Assert.IsType <ShapePath>(processor.Path);

            Assert.NotEmpty(shapepath.Paths);

            SixLabors.Shapes.Rectangle rect = Assert.IsType <SixLabors.Shapes.Rectangle>(shapepath.Paths[0].AsShape());

            Assert.Equal(rect.Location.X, rectangle.X);
            Assert.Equal(rect.Location.Y, rectangle.Y);
            Assert.Equal(rect.Size.Width, rectangle.Width);
            Assert.Equal(rect.Size.Height, rectangle.Height);

            Pen <Color> pen = Assert.IsType <Pen <Color> >(processor.Pen);

            Assert.Equal(thickness, pen.Width);

            SolidBrush <Color> brush = Assert.IsType <SolidBrush <Color> >(pen.Brush);

            Assert.Equal(color, brush.Color);
        }
예제 #4
0
        public override ShapePath.FlagsAndCommand vertex(out double x, out double y)
        {
            x = 0;
            y = 0;
            ShapePath.FlagsAndCommand cmd = ShapePath.FlagsAndCommand.CommandStop;
            switch (m_idx)
            {
            case 0:
            case 1:
            case 2:
                cmd = m_stroke.vertex(out x, out y);
                break;

            case 3:
            case 4:
            case 5:
            case 6:
                cmd = m_ellipse.vertex(out x, out y);
                break;
            }

            if (!ShapePath.is_stop(cmd))
            {
                ParentToChildTransform.transform(ref x, ref y);
            }
            return(cmd);
        }
예제 #5
0
        public IEnumerable <VertexData> Vertices()
        {
            currentProcessingArc.init(bounds.Left + leftBottomRadius.x, bounds.Bottom + leftBottomRadius.y, leftBottomRadius.x, leftBottomRadius.y, Math.PI, Math.PI + Math.PI * 0.5);
            foreach (VertexData vertexData in currentProcessingArc.Vertices())
            {
                if (ShapePath.is_stop(vertexData.command))
                {
                    break;
                }
                yield return(vertexData);
            }
            currentProcessingArc.init(bounds.Right - rightBottomRadius.x, bounds.Bottom + rightBottomRadius.y, rightBottomRadius.x, rightBottomRadius.y, Math.PI + Math.PI * 0.5, 0.0);
            foreach (VertexData vertexData in currentProcessingArc.Vertices())
            {
                if (ShapePath.is_move_to(vertexData.command))
                {
                    // skip the initial moveto
                    continue;
                }
                if (ShapePath.is_stop(vertexData.command))
                {
                    break;
                }
                yield return(vertexData);
            }

            currentProcessingArc.init(bounds.Right - rightTopRadius.x, bounds.Top - rightTopRadius.y, rightTopRadius.x, rightTopRadius.y, 0.0, Math.PI * 0.5);
            foreach (VertexData vertexData in currentProcessingArc.Vertices())
            {
                if (ShapePath.is_move_to(vertexData.command))
                {
                    // skip the initial moveto
                    continue;
                }
                if (ShapePath.is_stop(vertexData.command))
                {
                    break;
                }
                yield return(vertexData);
            }

            currentProcessingArc.init(bounds.Left + leftTopRadius.x, bounds.Top - leftTopRadius.y, leftTopRadius.x, leftTopRadius.y, Math.PI * 0.5, Math.PI);
            foreach (VertexData vertexData in currentProcessingArc.Vertices())
            {
                if (ShapePath.is_move_to(vertexData.command))
                {
                    // skip the initial moveto
                    continue;
                }
                if (ShapePath.is_stop(vertexData.command))
                {
                    break;
                }
                yield return(vertexData);
            }

            yield return(new VertexData(ShapePath.FlagsAndCommand.CommandEndPoly | ShapePath.FlagsAndCommand.FlagClose | ShapePath.FlagsAndCommand.FlagCCW, new Vector2()));

            yield return(new VertexData(ShapePath.FlagsAndCommand.CommandStop, new Vector2()));
        }
예제 #6
0
        public void CorrectlySetsBrushThicknessRectangleAndOptions()
        {
            img.Draw(brush, thickness, rectangle, noneDefault);

            Assert.NotEmpty(img.ProcessorApplications);
            DrawPathProcessor <Color> processor = Assert.IsType <DrawPathProcessor <Color> >(img.ProcessorApplications[0].processor);

            Assert.Equal(noneDefault, processor.Options);

            ShapePath shapepath = Assert.IsType <ShapePath>(processor.Path);

            Assert.NotEmpty(shapepath.Paths);

            SixLabors.Shapes.Rectangle rect = Assert.IsType <SixLabors.Shapes.Rectangle>(shapepath.Paths[0].AsShape());

            Assert.Equal(rect.Location.X, rectangle.X);
            Assert.Equal(rect.Location.Y, rectangle.Y);
            Assert.Equal(rect.Size.Width, rectangle.Width);
            Assert.Equal(rect.Size.Height, rectangle.Height);

            Pen <Color> pen = Assert.IsType <Pen <Color> >(processor.Pen);

            Assert.Equal(brush, pen.Brush);
            Assert.Equal(thickness, pen.Width);
        }
예제 #7
0
 public void end_poly(ShapePath.FlagsAndCommand flags)
 {
     if (ShapePath.is_vertex(vertices.last_command()))
     {
         vertices.AddVertex(0.0, 0.0, ShapePath.FlagsAndCommand.CommandEndPoly | flags);
     }
 }
예제 #8
0
        public void invert_polygon(int start)
        {
            // Skip all non-vertices at the beginning
            while (start < vertexDataManager.total_vertices() &&
                   !ShapePath.is_vertex(vertexDataManager.command(start)))
            {
                ++start;
            }

            // Skip all insignificant move_to
            while (start + 1 < vertexDataManager.total_vertices() &&
                   ShapePath.is_move_to(vertexDataManager.command(start)) &&
                   ShapePath.is_move_to(vertexDataManager.command(start + 1)))
            {
                ++start;
            }

            // Find the last vertex
            int end = start + 1;

            while (end < vertexDataManager.total_vertices() &&
                   !ShapePath.is_next_poly(vertexDataManager.command(end)))
            {
                ++end;
            }

            invert_polygon(start, end);
        }
예제 #9
0
 public void end_poly(ShapePath.FlagsAndCommand flags)
 {
     if (ShapePath.is_vertex(vertexDataManager.last_command()))
     {
         vertexDataManager.AddVertex(0.0, 0.0, ShapePath.FlagsAndCommand.EndPoly | flags);
     }
 }
예제 #10
0
        override public IEnumerable <VertexData> Vertices()
        {
            for (int i = 0; i < SourcPaths.Count; i++)
            {
                IVertexSource sourcePath = SourcPaths[i];
                bool          firstMove  = true;
                foreach (VertexData vertexData in sourcePath.Vertices())
                {
                    // skip the initial command if it is not the first path and is a moveto.
                    if (i > 0 &&
                        firstMove &&
                        ShapePath.is_move_to(vertexData.command))
                    {
                        continue;
                    }

                    // when we hit a stop move on to the next path
                    if (ShapePath.is_stop(vertexData.command))
                    {
                        break;
                    }
                    yield return(vertexData);
                }
            }

            // and send the actual stop
            yield return(new VertexData(ShapePath.FlagsAndCommand.CommandStop, new Vector2()));
        }
    void  Update()
    {
        if (Application.isEditor)
        {
            path = pointList.GetPathPoints();
            sp   = pointList.GetShapePath();

            DrawLinePoints(sp);
        }

        if (Application.isPlaying)
        {
            if (isPlayAnim && smooth)
            {
                target.transform.position = Vector3.Lerp(target.transform.position, targetPos, Time.deltaTime * damping);

                float dist = Vector3.Distance(target.transform.position, targetPos);
                //if(dist < 0.01f){
                if (dist < 0.1f && progress == 1.0f)
                {
                    isPlayAnim = false;
                }
            }
        }
    }
예제 #12
0
            public ClosedLoopGlyphData(VertexStorage source)
            {
                storage = new VertexStorage();

                var vertexData = source.Vertices().Where(v => v.command != ShapePath.FlagsAndCommand.FlagNone).ToArray();

                var previous = default(VertexData);

                for (var i = 0; i < vertexData.Length; i++)
                {
                    var current = vertexData[i];

                    // All MoveTo operations should be preceded by ClosePolygon
                    if (i > 0 &&
                        current.IsMoveTo &&
                        ShapePath.is_vertex(previous.command))
                    {
                        storage.ClosePolygon();
                    }

                    // Add original VertexData
                    storage.Add(current.position.X, current.position.Y, current.command);

                    // Hold prior item
                    previous = current;
                }

                // Ensure closed
                storage.ClosePolygon();
            }
예제 #13
0
 public void AddVertex(double x, double y, ShapePath.FlagsAndCommand cmd)
 {
     m_status = StrokeMath.status_e.initial;
     if (ShapePath.is_move_to(cmd))
     {
         m_src_vertices.modify_last(new VertexDistance(x, y));
     }
     else
     {
         if (ShapePath.is_vertex(cmd))
         {
             m_src_vertices.add(new VertexDistance(x, y));
         }
         else
         {
             if (ShapePath.is_end_poly(cmd))
             {
                 m_closed = (ShapePath.get_close_flag(cmd) == ShapePath.FlagsAndCommand.FlagClose);
                 if (m_orientation == ShapePath.FlagsAndCommand.FlagNone)
                 {
                     m_orientation = ShapePath.get_orientation(cmd);
                 }
             }
         }
     }
 }
예제 #14
0
 internal ShapeContent(LottieDrawable lottieDrawable, BaseLayer layer, ShapePath shape)
 {
     Name            = shape.Name;
     _lottieDrawable = lottieDrawable;
     _shapeAnimation = shape.GetShapePath().CreateAnimation();
     layer.AddAnimation(_shapeAnimation);
     _shapeAnimation.ValueChanged += OnValueChanged;
 }
예제 #15
0
 // Make path functions
 //--------------------------------------------------------------------
 public int start_new_path()
 {
     if (!ShapePath.is_stop(vertices.last_command()))
     {
         vertices.AddVertex(0.0, 0.0, ShapePath.FlagsAndCommand.CommandStop);
     }
     return(vertices.total_vertices());
 }
        public void ShapePathFromPathMaxIntersectionsProxyToShape()
        {
            ShapePath region = new ShapePath(pathMock1.Object);

            int i = region.MaxIntersections;

            pathMock1.Verify(x => x.MaxIntersections);
        }
        public void GetPointInfoCallSinglePathForPath()
        {
            ShapePath region = new ShapePath(pathMock1.Object);

            ImageSharp.Drawing.PointInfo info = region.GetPointInfo(10, 1);

            pathMock1.Verify(x => x.Distance(new Vector2(10, 1)), Times.Once);
            pathMock2.Verify(x => x.Distance(new Vector2(10, 1)), Times.Never);
        }
예제 #18
0
 public ShapePath.FlagsAndCommand vertex(out double x, out double y)
 {
     ShapePath.FlagsAndCommand cmd = VertexSource.vertex(out x, out y);
     if (ShapePath.is_vertex(cmd))
     {
         transformToApply.transform(ref x, ref y);
     }
     return(cmd);
 }
예제 #19
0
            public void AddVertex(double x, double y, ShapePath.FlagsAndCommand CommandAndFlags)
            {
                allocate_if_required(m_num_vertices);
                m_coord_x[m_num_vertices] = x;
                m_coord_y[m_num_vertices] = y;
                m_CommandAndFlags[m_num_vertices] = CommandAndFlags;

                m_num_vertices++;
            }
        public void ShapePathFromPathConvertsBoundsDoesNotProxyToShape()
        {
            ShapePath region = new ShapePath(pathMock1.Object);

            Assert.Equal(Math.Floor(bounds1.Left), region.Bounds.Left);
            Assert.Equal(Math.Ceiling(bounds1.Right), region.Bounds.Right);

            pathMock1.Verify(x => x.Bounds);
        }
예제 #21
0
        public override ShapePath.FlagsAndCommand vertex(out double x, out double y)
        {
            x = 0;
            y = 0;
            ShapePath.FlagsAndCommand cmd = ShapePath.FlagsAndCommand.LineTo;
            switch (m_idx)
            {
            case 0:
                if (m_vertex == 0)
                {
                    cmd = ShapePath.FlagsAndCommand.MoveTo;
                }
                if (m_vertex >= 4)
                {
                    cmd = ShapePath.FlagsAndCommand.Stop;
                }
                x = m_vx[m_vertex];
                y = m_vy[m_vertex];
                m_vertex++;
                break;

            case 1:
                if (m_vertex == 0 || m_vertex == 4)
                {
                    cmd = ShapePath.FlagsAndCommand.MoveTo;
                }
                if (m_vertex >= 8)
                {
                    cmd = ShapePath.FlagsAndCommand.Stop;
                }
                x = m_vx[m_vertex];
                y = m_vy[m_vertex];
                m_vertex++;
                break;

            case 2:
                cmd = m_curve_poly.vertex(out x, out y);
                break;

            case 3:
            case 4:
                cmd = m_curve_pnt.vertex(out x, out y);
                break;

            default:
                cmd = ShapePath.FlagsAndCommand.Stop;
                break;
            }

            if (!ShapePath.is_stop(cmd))
            {
                //OriginRelativeParentTransform.transform(ref x, ref y);
            }

            return(cmd);
        }
예제 #22
0
        public void concat_path(IVertexSource vs, int path_id)
        {
            double x, y;

            ShapePath.FlagsAndCommand PathAndFlags;
            vs.rewind(path_id);
            while (!ShapePath.is_stop(PathAndFlags = vs.vertex(out x, out y)))
            {
                vertices.AddVertex(x, y, PathAndFlags);
            }
        }
예제 #23
0
 public void flip_y(double y1, double y2)
 {
     for (int i = 0; i < vertexDataManager.total_vertices(); i++)
     {
         ShapePath.FlagsAndCommand PathAndFlags = vertexDataManager.vertex(i, out double x, out double y);
         if (ShapePath.is_vertex(PathAndFlags))
         {
             vertexDataManager.modify_vertex(i, x, y2 - y + y1);
         }
     }
 }
예제 #24
0
 public IEnumerable <VertexData> Vertices()
 {
     foreach (VertexData vertexData in VertexSource.Vertices())
     {
         VertexData transformedVertex = vertexData;
         if (ShapePath.is_vertex(transformedVertex.command))
         {
             transformToApply.transform(ref transformedVertex.position.x, ref transformedVertex.position.y);
         }
         yield return(transformedVertex);
     }
 }
예제 #25
0
 public void rel_to_abs(ref double x, ref double y)
 {
     if (vertices.total_vertices() != 0)
     {
         double x2;
         double y2;
         if (ShapePath.is_vertex(vertices.last_vertex(out x2, out y2)))
         {
             x += x2;
             y += y2;
         }
     }
 }
 private void DrawLinePoints(ShapePath sp)
 {
     /*
      * float split = sp.length / (sliceNum-1);
      *
      * LineRenderer lineRenderer = this.gameObject.GetComponent<LineRenderer>();
      * lineRenderer.SetVertexCount(sliceNum);
      * for(int i = 0; i < sliceNum; i++){
      *      Vector3 sPos = sp.getPointInfoVec3(split * i);
      *      lineRenderer.SetPosition(i, sPos);
      * }
      */
 }
예제 #27
0
        public void flip_y(double y1, double y2)
        {
            int    i;
            double x, y;

            for (i = 0; i < vertices.total_vertices(); i++)
            {
                ShapePath.FlagsAndCommand PathAndFlags = vertices.vertex(i, out x, out y);
                if (ShapePath.is_vertex(PathAndFlags))
                {
                    vertices.modify_vertex(i, x, y2 - y + y1);
                }
            }
        }
예제 #28
0
        // Flip all vertices horizontally or vertically,
        // between x1 and x2, or between y1 and y2 respectively
        //--------------------------------------------------------------------
        public void flip_x(double x1, double x2)
        {
            int    i;
            double x, y;

            for (i = 0; i < vertexDataManager.total_vertices(); i++)
            {
                ShapePath.FlagsAndCommand PathAndFlags = vertexDataManager.vertex(i, out x, out y);
                if (ShapePath.is_vertex(PathAndFlags))
                {
                    vertexDataManager.modify_vertex(i, x2 - x + x1, y);
                }
            }
        }
예제 #29
0
        public ShapePath.FlagsAndCommand vertex(out double x, out double y)
        {
            if (!ShapePath.is_stop(m_curve3.vertex(out x, out y)))
            {
                lastX = x;
                lastY = y;
                return(ShapePath.FlagsAndCommand.CommandLineTo);
            }

            if (!ShapePath.is_stop(m_curve4.vertex(out x, out y)))
            {
                lastX = x;
                lastY = y;
                return(ShapePath.FlagsAndCommand.CommandLineTo);
            }

            double ct2_x;
            double ct2_y;
            double end_x;
            double end_y;

            ShapePath.FlagsAndCommand cmd = VertexSource.vertex(out x, out y);
            switch (cmd)
            {
            case ShapePath.FlagsAndCommand.CommandCurve3:
                VertexSource.vertex(out end_x, out end_y);

                m_curve3.init(lastX, lastY, x, y, end_x, end_y);

                m_curve3.vertex(out x, out y);                            // First call returns path_cmd_move_to
                m_curve3.vertex(out x, out y);                            // This is the first vertex of the curve
                cmd = ShapePath.FlagsAndCommand.CommandLineTo;
                break;

            case ShapePath.FlagsAndCommand.CommandCurve4:
                VertexSource.vertex(out ct2_x, out ct2_y);
                VertexSource.vertex(out end_x, out end_y);

                m_curve4.init(lastX, lastY, x, y, ct2_x, ct2_y, end_x, end_y);

                m_curve4.vertex(out x, out y);                            // First call returns path_cmd_move_to
                m_curve4.vertex(out x, out y);                            // This is the first vertex of the curve
                cmd = ShapePath.FlagsAndCommand.CommandLineTo;
                break;
            }
            lastX = x;
            lastY = y;
            return(cmd);
        }
        public ShapePath AddPath(Point startPoint, List <Point> points, string color)
        {
            ShapePath path = new ShapePath(
                new Point(startPoint.X, 1 - startPoint.Y));

            Point[] sortedPoints = points.Select(
                point => new Point(point.X, 1 - point.Y)).ToArray();
            foreach (Point point in sortedPoints)
            {
                path.AddPoint(point);
            }
            path.Color = color;
            path.SetIsCurved(false);
            return(path);
        }
예제 #31
0
        public void CorrectlySetsPenPathAndOptions()
        {
            img.Draw(pen, path, noneDefault);

            Assert.NotEmpty(img.ProcessorApplications);
            DrawPathProcessor <Color> processor = Assert.IsType <DrawPathProcessor <Color> >(img.ProcessorApplications[0].processor);

            Assert.Equal(noneDefault, processor.Options);

            ShapePath shapepath = Assert.IsType <ShapePath>(processor.Path);

            Assert.Equal(path, shapepath.Path);

            Assert.Equal(pen, processor.Pen);
        }
예제 #32
0
        //--------------------------------------------------------------------
        public void transform_all_paths(Transform.Affine trans)
        {
            int index;
            int num_ver = vertices.total_vertices();

            for (index = 0; index < num_ver; index++)
            {
                double x, y;
                if (ShapePath.is_vertex(vertices.vertex(index, out x, out y)))
                {
                    trans.transform(ref x, ref y);
                    vertices.modify_vertex(index, x, y);
                }
            }
        }
예제 #33
0
    // Update is called once per frame
    void OnDrawGizmos()
    {
        if(points == null || points.Count < 1){ return; }

        // ShapePath
        pointList = new PointList();

        // ShapePath
        if (pointList != null) {
            shapePath = pointList.GetShapePath(points.ToArray(), rots.ToArray());

            for (int i = 0; i < num; i++) {
                float v = (float)i / num;

                Vector3 pt;
        //				pt = shapePath.getPointInfoVec3Percent(v);
                PathVector pv = shapePath.getPathInfo(v);
                pt = new Vector3(pv.x, pv.y, pv.z);

                Gizmos.color = color;
                Gizmos.DrawWireSphere(pt, 0.25f);

                Quaternion rot = pv.rot;

                //
                Gizmos.color = new Color(0, 0, 0, 0.25f);
                Gizmos.DrawRay(pt, rot * Vector3.up * 2);
                Gizmos.DrawRay(pt, rot * Vector3.right * 2);

                Quaternion q2 = GetQuaternionAt(v);
                Gizmos.color = Color.green;
                Gizmos.DrawRay (pt, q2* Vector3.up);
                Gizmos.color = Color.red;
                Gizmos.DrawRay (pt, q2* Vector3.right);
            }
        }
    }
예제 #34
0
 public void end_poly(ShapePath.FlagsAndCommand flags)
 {
     if (ShapePath.is_vertex(vertices.last_command()))
     {
         vertices.AddVertex(0.0, 0.0, ShapePath.FlagsAndCommand.CommandEndPoly | flags);
     }
 }
예제 #35
0
 public void Add(double x, double y, ShapePath.FlagsAndCommand flagsAndCommand)
 {
     vertices.AddVertex(x, y, flagsAndCommand);
 }
예제 #36
0
 public void modify_vertex(int index, double x, double y, ShapePath.FlagsAndCommand PathAndFlags)
 {
     vertices.modify_vertex(index, x, y, PathAndFlags);
 }
예제 #37
0
 public void modify_command(int index, ShapePath.FlagsAndCommand PathAndFlags)
 {
     vertices.modify_command(index, PathAndFlags);
 }
예제 #38
0
        // Arrange the orientation of a polygon, all polygons in a path, 
        // or in all paths. After calling arrange_orientations() or 
        // arrange_orientations_all_paths(), all the polygons will have 
        // the same orientation, i.e. path_flags_cw or path_flags_ccw
        //--------------------------------------------------------------------
        public int arrange_polygon_orientation(int start, ShapePath.FlagsAndCommand orientation)
        {
            if(orientation == ShapePath.FlagsAndCommand.FlagNone) return start;
            
            // Skip all non-vertices at the beginning
            while(start < vertices.total_vertices() && 
                  !ShapePath.is_vertex(vertices.command(start))) ++start;

            // Skip all insignificant move_to
            while(start+1 < vertices.total_vertices() && 
                  ShapePath.is_move_to(vertices.command(start)) &&
                  ShapePath.is_move_to(vertices.command(start+1))) ++start;

            // Find the last vertex
            int end = start + 1;
            while(end < vertices.total_vertices() && 
                  !ShapePath.is_next_poly(vertices.command(end))) ++end;

            if(end - start > 2)
            {
                if(perceive_polygon_orientation(start, end) != orientation)
                {
                    // Invert polygon, set orientation flag, and skip all end_poly
                    invert_polygon(start, end);
                    ShapePath.FlagsAndCommand PathAndFlags;
                    while(end < vertices.total_vertices() &&
                          ShapePath.is_end_poly(PathAndFlags = vertices.command(end)))
                    {
                        vertices.modify_command(end++, PathAndFlags | orientation);// Path.set_orientation(cmd, orientation));
                    }
                }
            }
            return end;
        }
예제 #39
0
 public int arrange_orientations(int start, ShapePath.FlagsAndCommand orientation)
 {
     if(orientation != ShapePath.FlagsAndCommand.FlagNone)
     {
         while(start < vertices.total_vertices())
         {
             start = arrange_polygon_orientation(start, orientation);
             if(ShapePath.is_stop(vertices.command(start)))
             {
                 ++start;
                 break;
             }
         }
     }
     return start;
 }
예제 #40
0
		public VertexData(ShapePath.FlagsAndCommand command, Vector2 position)
		{
			this.command = command;
			this.position = position;
		}
예제 #41
0
 public void modify_command(int index, ShapePath.FlagsAndCommand CommandAndFlags)
 {
     m_CommandAndFlags[index] = CommandAndFlags;
 }
예제 #42
0
 public void modify_vertex(int index, double x, double y, ShapePath.FlagsAndCommand CommandAndFlags)
 {
     m_coord_x[index] = x;
     m_coord_y[index] = y;
     m_CommandAndFlags[index] = CommandAndFlags;
 }
예제 #43
0
		public void AddVertex(double x, double y, ShapePath.FlagsAndCommand cmd)
		{
			m_status = StrokeMath.status_e.initial;
			if (ShapePath.is_move_to(cmd))
			{
				m_src_vertices.modify_last(new VertexDistance(x, y));
			}
			else
			{
				if (ShapePath.is_vertex(cmd))
				{
					m_src_vertices.add(new VertexDistance(x, y));
				}
				else
				{
					if (ShapePath.is_end_poly(cmd))
					{
						m_closed = (ShapePath.get_close_flag(cmd) == ShapePath.FlagsAndCommand.FlagClose);
						if (m_orientation == ShapePath.FlagsAndCommand.FlagNone)
						{
							m_orientation = ShapePath.get_orientation(cmd);
						}
					}
				}
			}
		}
예제 #44
0
 public void arrange_orientations_all_paths(ShapePath.FlagsAndCommand orientation)
 {
     if(orientation != ShapePath.FlagsAndCommand.FlagNone)
     {
         int start = 0;
         while(start < vertices.total_vertices())
         {
             start = arrange_orientations(start, orientation);
         }
     }
 }
예제 #45
0
 public void add_vertex(double x, double y, ShapePath.FlagsAndCommand unknown) { }
예제 #46
0
 public void close_polygon(ShapePath.FlagsAndCommand flags)
 {
     end_poly(ShapePath.FlagsAndCommand.FlagClose | flags);
 }