A graph shows an ellipse contained within -4<x<4 and -3<y<3, providing the search area.
fimplicit(@(x,y)2*x.^2+2*x.*y+5*y.^2-20);
grid
for x=-4:4
for y=-3:3
if 2*x^2+2*x*y+5*y^2==20
disp([x y])
end
end
end
>> polygonPerimeter
-2 2
0 -2
0 2
2 -2
(-2,2) to (0,2) and (0,-2) to (2,-2) provide two segments of length 2.
(-2,2) to (0,-2) and (0,2) to (2,-2) provide two segments of length sqrt(20).
The perimeter is 2*(2 + sqrt(20)) =~ 12.9442719099992.
|
Posted by Charlie
on 2024-02-19 09:04:33 |