Filling in the area around an ellipse?
20 次查看(过去 30 天)
显示 更早的评论
I currently have an ellipse inscribed inside a square. I would like to find a way to fill in the area around the ellipse inside the rectangle, a given color. Any hints would be deeply appreciated--my code is below.
clc;clear all;imtool close all;
figure
t=linspace(0,2*pi);
ellipse_y=(128)-(160/2)*cos(t);%defines the height and width of the ellipse
ellipse_x=(128)-(232/2)*sin(t);
x1=0;x2=256;y1=0;y2=256;%creates a square frame around the entire output image
x_frame=[x1,x2,x2,x1,x1];
y_frame=[y1,y1,y2,y2,y1];
hold on
frame=plot(x_frame,y_frame,'r');%plots square frame around the entire output image
ellipse=plot(ellipse_x,ellipse_y,'r');%plots the ellipse
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!