How i will draw circle around specific point in 3D model

13 views (last 30 days)
I have this function creating 3d model of the Earth
function EARTH_SPHERE(BGCOLOR,GRID)
load EARTH_MAP.mat
a = 6378137; % Horizontial radius
b = 6356752.31424518; % Vertical radius
th=repmat((0:.25:180)'*pi/180,[1 1441]);
ph=repmat((-180:.25:180)*pi/180,[721 1]);
s.children(1).properties.XData = a*sin(th).*cos(ph);
s.children(1).properties.YData = a*sin(th).*sin(ph);
s.children(1).properties.ZData = b*cos(th);
s.children(1).properties.CData = double(c)/255;
if strcmp(GRID,'on')== 1
for n=6:8
s.children(n).properties.XData = a*s.children(n).properties.XData;
s.children(n).properties.YData = a*s.children(n).properties.YData;
s.children(n).properties.ZData = b*s.children(n).properties.ZData;
end;
end;
figure;
struct2handle(s,gcf);
axis equal
axis vis3d
set(gcf,'color',BGCOLOR,'renderer','zbuffer','inverthardcopy','off');
set(gcf,'Position', [0 0 1024 1024]);
on second program I callback that function
EARTH_SPHERE([1 1 1],'on');
and I would like to create a circle on surface around certain point with specified by me radius
Something like that:

Accepted Answer

Christopher McCausland
Christopher McCausland on 21 May 2021
Hi Radoslaw,
There are a couple of similar questions that answer your question. Here is a link as to how to plot circles.
I am also wondering if you need to account for the curvature, if so it should be possiable to draw the circle first and then project it onto "EARTH_SPHERE" again i'm not sure if you require this or not.
Christopher
  2 Comments
Radoslaw Fulek
Radoslaw Fulek on 24 May 2021
How it would look like without curvature of sphere, because now I have no clue about projecting pre-drawn circle into sphere's exact point with good lean angle towards surface?
Christopher McCausland
Christopher McCausland on 26 May 2021
Hi Rasoslaw,
Appologies I didn't see your reply sooner. Without considering the curvature you would get a perfect circle, considering the curvature I imagine the shape would be slightly more oval shaped. Whether to consider this curvature completly depends what you need. Let me know if you got the convetional circle in okay and if that does what you need it too. If not we can have a think about the sphere projection.
Christopher

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!