how to join highlighted points by curve in 3D

8 views (last 30 days)
I want to join two highlighted points using curve.the radius of bottom spiral is small than other spirals.So, we need to jont highlighed points using a curve who's radis will gradually increase.

Accepted Answer

Thiago Henrique Gomes Lobato
For you to join those points with a radius that will gradually increase you first need to define what exactly is "gradually increase". For your case, however, it seems that what you want is to fullfill the spiral in a reasonable way, for this you can define an analytical spiral model (check for example: http://mathworld.wolfram.com/LogarithmicSpiral.html), get the parameters that define it and then interpolate in between points. This can be done as follows:
P1 = [36.05,0,20];
P2 = [-43.603,33.523,22];
[th1,r1,z1] = cart2pol(P1(1),P1(2),P1(3));
[th2,r2,z2] = cart2pol(P2(1),P2(2),P2(3));
% Logarithmic spiral Parameters ( r = a*exp(b*theta))
a = r1; % Simplyfication since th1 = 0
b = log(r2/(a))/th2;
thetas = linspace(th1,th2,10);
zs = linspace(z1,z2,10); % Linear z
Rs = a*exp(b*thetas);
[x,y,z] = pol2cart(thetas,Rs,zs);
plot3(x,y,z),hold on
plot3(P1(1),P1(2),P1(3),'r*')
plot3(P2(1),P2(2),P2(3),'r*')
untitled.jpg
  3 Comments
Thiago Henrique Gomes Lobato
I don't know SCILAB but it should be actually pretty straight forward. The only functions that may be missing are the coordinate conversions which you can easily find online (indeed the Matlab documentation page for them has the implementation in the Algorithms section).

Sign in to comment.

More Answers (0)

Categories

Find more on App Building in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!