How can I draw a concave corner rectangle in WPF?
+2
A:
do you mean a rectangle with concave corners?, ie:
____________________
| |
__| |__
| |
| |
| |
|__ __|
| |
|____________________|
Given a rectangle of dimension w x h
with corner radius r
There are 4 corners:
A : 0,0
B : w,0
C : w,h
D : 0,h
There is an implicit minimum size of
w = 2r
h = 2r
There are 4 Circle Centers, A,B,C,D
And there's thus a grid of edge points:
(0,0)--(0+r,0)---(w-r,0)---(w,0)
| |
(0,0+r) (w,0+r)
| |
| |
(0,h-r) (w,h-r)
| |
(0,h)--(0+r,h)---(w-r,h)---(w,h)
Then its merely a case of computing the arc from one point to another.
Kent Fredric
2008-11-15 13:58:40
Thank you, I asked this question on a different forum and got the same solution by using the Path function in WPF.
Bob Kerlinger
2008-11-20 19:53:56
A:
I should point out that if it's concave, the four sides aren't both identical and straight; thus it's not a rectangle. But I digress.
tsilb
2008-11-16 00:29:18