How to create a line around the earth map and then getting the location of a specific point on it?

조회 수: 10 (최근 30일)
How to create a line on the earth map starting from any given point. That line should complete the rotation at any given angle through the origin point of the earth, and then shows the location of any point on that line.
For example, let's see the image attached. The red point is our starting user-defined point. We have three lines (orange with angle alpha, green with angle beta, and pink with angle gamma). How to find the location of the center or middle point of each line?
Thank you so much

채택된 답변

darova
darova 2020년 5월 4일
Here is a start:
  • draw sphere, draw circle. Pick the point you want
  • Now you need axis of rotation to rotate your circle - use cross
  • figure out the angle of rotation
p = p/norm(p); % 'p' is your point (vector of size 1x3)
v = cross(p,[0 0 1])); % axis of rotation
h = plot(...); % your circle
rotate(h,v,a,[0 0 0]) % 'a' is angle at which circle should be rotated (degrees)
  • use copyobj to copy rotated circle and rotate it again by 'point' axis
h1 = copyobj(h);
rotate(h1,p,30,[0 0 0]);
set(h1,'color','r') % change color
see more: rotate, cross
  댓글 수: 2
Sitra
Sitra 2020년 5월 5일
Great code .. Thank you so much for sharing it here
The problem is: earth is not an ideal sphere, which means that the middle point of each line will not intersect with others!
There are some special commands to deal with "world map", but I struggling to draw lines like equator around earth
darova
darova 2020년 5월 5일
Maybe surfaceIntersection will help. Just create Earth and get intersection of it with some plane

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by