Filling in the area around an ellipse?
17 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!