How can I solve this problem?
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
Create a function (x,y,r) = InsideCircle (P1,P2), where P1 = (x1,y1) and P2 = (x2,y2) are the upper left and lower right corners of a rectangle. The output contains the 'x' and 'y' coordinates of the center of a circle with radius 'r' which is centered inside the input rectangle defined by (p1,p2) and touches only two sides. What is the value of 'x' , 'y' , 'r' if P1=(30,20) and P2=(10,10). Is the function header in correct format?
댓글 수: 0
답변 (1개)
Andrei Bobrov
2016년 9월 23일
편집: Andrei Bobrov
2016년 9월 23일
function [x,y,r] = InsideCircle (P1,P2)
d = (P1-P2)/2;
r = min(abs(d));
x = P2(1)+d(1);
y = P2(2)+d(2);
end
댓글 수: 0
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!