Draw rotated rectangle with rounded edge
11 ビュー (過去 30 日間)
古いコメントを表示
I found the answer to drawing rotated rectangles using the solution provided here by Y Yoon. However, I am not sure how to integrate curvature to the rectangle at the edges like it can be done in the function rectangle. Any other solution will also be highly appreciated. Thanks in advance.
4 件のコメント
採用された回答
Adam Danz
2021 年 1 月 9 日
編集済み: Adam Danz
2021 年 1 月 11 日
I created a function to extend the capabilities of Matlab's rectangle() but with these additional features:
- Position rectangles by their center points rather than by their lower left coordinate.
- Supports creation of multiple rectangles with independent properties
- Outputs handles to patch object rather than rectangle
- Outputs rectangles parameters including vertices
- Option to rotate rectangles about their centers
5 件のコメント
Adam Danz
2021 年 1 月 10 日
編集済み: Adam Danz
2021 年 1 月 11 日
It now includes an example file and show how to apply different color to the rectangles. Note that you can also specify FaceColor to set the color of all rectangles.
The drawnow is required to update the properties that I'm pulling the curvature data from and as you said, it slows things down a bit. It's unavoidable with this method although I'll think about changing methods some time in the future.
Adam Danz
2021 年 1 月 11 日
Please download vs 2.0.0 which I just updated.
It fixes some minor potential errors but it also adds a lot of flexibility to set multiple rectangle properties (see example file).
I don't plan for any further updates unless errors are reported. At some point I may get around to figuring out how Matalb creates the curved edges rather than using the rectangle function to create them.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Graphics Performance についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!