Adding or combining two or more patches (or faces) and creating one new solid 2D patch with new vertices

6 views (last 30 days)
Hello everyone,
I need a help with adding two patches together (such as shown) and generating one new larger patch with known vertices. In other words, I want to create a new 2D patch by overlaying smaller segment patches on top of each other. My goal is to calculate the overall area of the larger patch. Here is an example of two single patches that I would like to combine:
>> x=[0 1 3 2];y=[1 0 2 3];
x1=[0 1 3 2];y1=[2 3 1 0];
A=patch(x,y,[0 0 1]);
B=patch(x1,y1,[0 0 1]);
axis equal
I would like to have all 12 vertices or the area of the combined patch
Thank you

Answers (1)

KSSV
KSSV on 1 Oct 2016
Edited: KSSV on 1 Oct 2016
From the figure the twelve vertices are (0,1),(1,0),(1.5,0.5),(2,0),(3,1),(2.5,1.5),(3,2),(2,3),(1.5,2.5),(1,3),(0,2),(0.5,1.5).
If you have vertices, you can calculate area using polyarea. doc polyarea
  1 Comment
Farzad Hosseinali
Farzad Hosseinali on 1 Oct 2016
Yes Sir,
Thank you for your response. However, I am trying to find a general solution for multiple (maybe ~1000) patches that overlap each other in random directions. This is just an example for one overlap between two geometries. Once there are 1000 overlaps , I cannot manually find the vertices.
Regards

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!