Exemple #1
0
        public void DrawDots(System.Drawing.Graphics gContext, int w, int h)
        {
            cVertexList listcopy = new cVertexList();

            listcopy.SetVertex(list.head.Point.X, list.head.Point.Y);

            if (nlinks == 3)
            {
                /*for the first link:*/
                listcopy = MakePoints(0, firstlinks, firstlinks - 1, list.head, list.head.NextVertex, listcopy);
                /*set the middle link*/
                listcopy.SetVertex(list.head.NextVertex.Point.X, list.head.NextVertex.Point.Y);
                listcopy.SetVertex(list.head.NextVertex.NextVertex.Point.X, list.head.NextVertex.NextVertex.Point.Y);
                /* for the last link, the third one*/
                listcopy = MakePoints(firstlinks + 1, nlinksback, nlinksback, list.head.NextVertex.NextVertex, list.head.PrevVertex, listcopy);
            }

            else
            {
                if (nlinksback > 2)
                /*if we have any extra - points*/
                {
                    /*first link:*/
                    listcopy = MakePoints(0, firstlinks, firstlinks - 1, list.head, list.head.NextVertex, listcopy);
                    /*set the middle point:*/
                    listcopy.SetVertex(list.head.NextVertex.Point.X, list.head.NextVertex.Point.Y);
                    /*set the last link*/
                    listcopy = MakePoints(firstlinks, nlinksback + 1, nlinksback - 1, list.head.PrevVertex.PrevVertex, list.head.PrevVertex, listcopy);
                } //end if nlinksback > 2
            }     // end else
            /*set the last point and draw everything*/
            listcopy.SetVertex(list.head.PrevVertex.Point.X, list.head.PrevVertex.Point.Y);
            listcopy.DrawPoints(gContext, w, h);
        }
Exemple #2
0
        public void SetAChain(cPointd Jk, cPointi target)
        {
            cPointi vaux1;
            cPointi vaux2;

            vaux1 = new cPointi(list.head.Point.X, list.head.Point.Y);
            vaux2 = new cPointi(target.X, target.Y);
            list.ClearVertexList();
            list.SetVertex(vaux1.X, vaux1.Y);
            list.SetVertex((int)(Jk.x + .5), (int)(Jk.y + .5));
            list.SetVertex(vaux2.X, vaux2.Y);
        }
Exemple #3
0
        }//end TwoCircles00

        /*Method used for cretaing the "extra-points" that will be displayed
         * on the screen after the arm is straightened. Called from DrawPoints */

        public cVertexList MakePoints(int lo, int hi1, int hi2, cVertex first, cVertex last, cVertexList listcopy)
        {
            double xaux;                    //auxiliary variable for storin the info
            double lenaux = 0;              //auxiliary variable for storing the Length of the
            //current link
            cPointi v1 = new cPointi(0, 0); //aux variable for computing the values
            //of the new points
            double sum = 0;                 //the sum of the previous link Lengths

            for (i = lo; i < hi1; i++)
            {
                lenaux += linklenback[i];
            }
            sum = 0;

            for (i = lo; i < hi2; i++)
            {
                sum += linklenback[i];
                xaux = sum / (double)lenaux;
                v1.X = (int)(.5 + (1 - xaux) * first.Point.X + xaux * last.Point.X);
                v1.Y = (int)(.5 + (1 - xaux) * first.Point.Y + xaux * last.Point.Y);
                listcopy.SetVertex(v1.X, v1.Y);
            }//end for

            return(listcopy);
        }