How to find distance from point to a grid line?
조회 수: 1 (최근 30일)
이전 댓글 표시
I need to calculate the percentage of the circle in each rectangular region. The rectangular regions are meant to be a grid lines. To do so, I need to find the distance from a data point within the circle to each grid line (the three lines from the point in the green region). Is there any way to solve this? I have no idea how to approach this so any help would be great. Thanks!
댓글 수: 0
답변 (1개)
KSSV
2017년 5월 17일
편집: KSSV
2017년 5월 17일
Two options:
1. If you have image as the input:
I = imread('mathworksqn.jpg') ;
imshow(I);
axis on
h = imdistline ;
Move the line to the points where you want the distance. This will give you distance.
2. If you have data in hand:
You can calculate the distance using the distance formula on knowing the data points.
If you have data in your hand...then you must be having coordinates of the grid and circle..then you can get the area of the part you want using polyarea, trapz. Read about them.
댓글 수: 2
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!