This project is read-only.

1 point draw 4 lines

Feb 21, 2013 at 9:58 AM
Hello
I fell over Live Geometry project in a Microsoft group.
And I must say that I am impressed :-)

Now I have started to play around with the package, and would like to draw a shape consisting of several lines and a height and width with a mouse click and then specify the height and width.

I just can not quite figure out how I make the last 3 points...
 protected override IEnumerable<IFigure> CreateFigures()
        {
            var p1 = FoundDependencies[0] as IPoint;
            
            var p2 = new Point(p1.Coordinates.X + 10, p1.Coordinates.Y);
            var p3 = new Point(p1.Coordinates.X + 10, p1.Coordinates.Y + 10);
            var p4 = new Point(p1.Coordinates.X, p1.Coordinates.Y + 10);
            
            
            var side0 = Factory.CreateSegment(Drawing, p1, p2);
            var side1 = Factory.CreateSegment(Drawing, p2, p3);
            var side2 = Factory.CreateSegment(Drawing, p3, p4);
            var side3 = Factory.CreateSegment(Drawing, p4, p1);
            var midpoint0 = Factory.CreateMidPoint(Drawing, side0);
            var midpoint1 = Factory.CreateMidPoint(Drawing, side1);
            var midpoint2 = Factory.CreateMidPoint(Drawing, side2);
            var midpoint3 = Factory.CreateMidPoint(Drawing, side3);

            var added = new IFigure[]
            {
                side0, 
                side1,
                side2,
                side3,
            };


            foreach (var item in added)
            {
                yield return item;
            }
        }
So I would like even control the coordinates of points B, C and D

Can you help me started?

Thank you in advance

//OleZen