重複の可能性:
円線の衝突検出
直線と円の交点を見つける方法を教えてください。
theta=0:.01:2*pi;
x1=4*cos(theta)+4;
y1=4*sin(theta)+4;
x=[0 1 3 5 8]
y=[0 1 1 3 3]
for i=2:length(x)
s(i)=(y(i)-y(i-1))/(x(i)-x(i-1));
end
s
inter=y
plot([x],[y],x1,y1,'-')
axis([0 10 0 10])