Thijser
Thijser

Reputation: 2633

putting a patch into a 2d matrix

I have a patch generated by the following code:

t=0:2*pi;
x=cos(t)*50+100;
y=sin(t)*50+100;
f1_h=fill(x,y,'r');

and would like to put the output of this patch into a 2D double matrix. This so I can use it to experiment on with other code (not for displaying purposes).

So this would be something like

d=zeros(1000,1000);
d=d.+patchToImage(f1_h)

except that patchToImage does not appear to exist.

Upvotes: 0

Views: 81

Answers (1)

flawr
flawr

Reputation: 11628

I recommend using meshgrid and then applying inpolygon.

Upvotes: 1

Related Questions