last day (14 days later) » 

1:27 PM
1
A: Filling the space between two rectangles

TaWHere is a solution for the top left corner. I didn't use your shapes, just two rectangles and an arc/ellipse to create a rounded corner. GraphicsPath GP = new GraphicsPath(); private void button1_Click(object sender, EventArgs e) { Rectangle R1 = new Rectangle(10, 20, 40, 200); Recta...

 
The rectangles all move at a fixed pace so they all move at the same time, but in the time when one rectangle is moving up to its next destination the next rectangle (its child) has to move to the x position before it can start going up. Essentially the time in which a shape changes movement direction causes a gap between two shapes, which is what I want to fill. I will play around with that code shortly, thanks for your help! :D
 
TaW
please see the changed code, should be much more helpful now.
 
How would I do the other corners? Edit: Yeah I copied the code and the circles are huge, about 5x the size of the rectangles.
 
TaW
I have corrected the code once more; I'll add the other corners tomoroow - we have a heat wavt that is getting to me..
 
Okay, thanks for all your help! Much appreciated.
 
TaW
1:27 PM
See my simlipfied solution!
 
It's throwing argument exception because rGap height is 0. rGap {X = 249 Y = 272 Width = 64 Height = 0} rec {X = 249 Y = 272 Width = 32 Height = 32} rec2 {X = 281 Y = 272 Width = 32 Height = 32}
 
TaW
Yes, you can't have a Shape with either height or width=0; since your rex1&2 sit on the same y position (272) the gap is zero. For these cases you don't actually need the whole gap-filling, right? You'll have to check rGap.Height*rGap.Width!=0 and skip the filling routine!
 
Okay I fixed that, but this still only works when you're going up and you start going right, otherwise it draws on the wrong side. IE: It is moving down and it turns right, it draws on the inside corner not the outside
I changed it to rectangles so that I can comprehend the maths (I'd still like to use circles for it though) and tested a bit. It seems the only way to make this work is to have specific maths for every movement direction. Any idea what the maths would be for say going from down to going left?
 
TaW
1:54 PM
Hi, I just took a shower and was cool enough for a few minutes to add code for the missing corners. I also changed the expression to make it more transparent X is the same as Left and Y as Top. you still will have to decide when to draw which of the corners. With just two Rectangles there are usually two opposing inset gaps..
 
2:09 PM
Going up and then going right is still the only one that works as intended, the others either put the circle in a completely incorrect place or draw it on the inner side of the turn rather than the outer
 
TaW
I'll give it a try..
 
TaW
2:31 PM
Ah, I see. I'll fix it in a few minutes..
 
Okay thankyou. Going to update the OP with what I've just done, I got it working with rectangles so it just needs converting now. Thanks for everything man / women.
 
TaW
3:09 PM
Man ;-) Got it nicely working now including two pictures. I have taken out the variations for 90° arcs since I dont think you'll need it. I have changes the names and created a function. Check it out!
 
3:26 PM
It worked beautifully, thankyou!
 
TaW
Good. Now back to the shower.
 

last day (14 days later) »