How do I find intersection of a straight line and a surface?
조회 수: 4 (최근 30일)
이전 댓글 표시
I have a surface generated via 'fit' function and a straight line which intersects the surface, how do i find this intersection?
Thanks
댓글 수: 0
답변 (1개)
Matt J
2017년 12월 31일
편집: Matt J
2018년 1월 1일
One way would be to use fzero. If the parametric equations for your line are L(t)=L0+t*D, the t that gives the intersection could be obtained as,
t_intersection = fzero(@(t) objective(t,L0,D,fitobj), t0)
function difference=objective(t,L0,D,fitobj)
L=L0+t*D;
x=L(1); y=L(2); z=L(3);
difference = z-fitobj(x,y);
end
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Interpolation에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!