Calculating a distance between a point and a contour along an axis

조회 수: 2 (최근 30일)
Minyoung Hong
Minyoung Hong 2022년 6월 30일
댓글: Minyoung Hong 2022년 7월 4일
I would like to implement an code to realiyze the calculation between a point and a countour of an cloud point along the x axis in 2D (blue line).
The lines are drawn with line() and the redpoint is only temporary.
After that, I would like to make a code to calculate a distance with any angle (green line).
Could anyone give me a tip or help me for that?
Thank you in advance.

채택된 답변

KSSV
KSSV 2022년 6월 30일
Let O(x,y) be your red point.
You can get the blue line intersecting the contour using knnsearch.
If you want to draw a line of length L with angle a w.r.t horizontal i.e. blue line.
%L is the length of line and a is angle
x2=x+(L*cos(a));
y2=y+(L*sin(a));
plot([x x2],[y y2])
  댓글 수: 7
Matt J
Matt J 2022년 6월 30일
@Minyoung Hong if KSSV's answer led to a solution for you, you should Accept-click it.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by