Set constraint for plot with two points that force him to go through a circle

Hello everyone,
I have three 3D-plots (two in red, one in blue) with a Start and End point and I want them to run through a circle (red). As you can see in the picture one already runs through it anyways, but i would like to set a constraint to force every plot through the circle. Could someone please help me with this problem?
Thank you very much,
Theresa

6 Comments

but i would like to set a constraint to force every plot through the circle.
A constraint on what? Are these randomly generated points? If you want plots running through a circle, why not just choose points that lie in the circle?
I would like the constraint on the plots, so that the line runs through the circle. No they are landmarks on a bone mesh that need to be in this position. Sorry I forgot to mention that.
But what is the current, unconstrained process for generating the points on these plots? As far as we know, the landmarks are chosen manually by you, so why not just choose some landmarks that lie inside the circle?
the upper three points on the left picture are landmarks on the pelvis, whereas the lower one is on the femur. The lines should represent muscle fibers that start and end at these points. The problem is, the muscle fibres bundle up at the region of the femoral head. Thats why I created a circle with a circumference that normally represent that of the muscle fibers. Now I want the muscle fibers to start and end at the landmarks and create a condition, that they also run through the circle.
But you still haven't shown us any code or input data for the process you are trying to modify. What do you have control over and what is fixed and given?
% I have the following input data that is fixed:
% 4 Points
P1= [-18.595112081112493,1.050302529300339e+02,-72.160383747947350]; % Start of 1.Line
P2= [33.280761272099184,64.282548752279580,8.327339983303744]; % Start of 2. Line
P3= [-29.745995709741415,1.145338848480899e+02,-9.097115579889248]; % Start of 3. Line
P4 = [-11.916110584480336,-41.022716293079160,1.740268777920562]; % End of every Line
% Circle through which the plot has to pass / xunit;yunit;zunit being the
% coordinates of the circle (also fixed)
x= 32;
z= 0;
r=14;
th = 0:pi/50:2*pi;
xunit = r * cos(th) + x;
zunit = r * sin(th) + z;
yunit = zeros([1 length(xunit)]);
% It doesn't matter where the plot passes through the circle, as long as it
% does

Sign in to comment.

 Accepted Answer

% I have the following input data that is fixed:
% 4 Points
P{1}= [-18.595112081112493,1.050302529300339e+02,-72.160383747947350]; % Start of 1.Line
P{2}= [33.280761272099184,64.282548752279580,8.327339983303744]; % Start of 2. Line
P{3}= [-29.745995709741415,1.145338848480899e+02,-9.097115579889248]; % Start of 3. Line
P4 = [-11.916110584480336,-41.022716293079160,1.740268777920562]; % End of every Line
% Circle through which the plot has to pass / xunit;yunit;zunit being the
% coordinates of the circle (also fixed)
x= 32;
z= 0;
r=14;
th = 0:pi/50:2*pi;
xunit = r * cos(th) + x;
zunit = r * sin(th) + z;
yunit = zeros([1 length(xunit)]);
scatter3(xunit,yunit, zunit); hold on
for i=1:3
args=num2cell([P{i}; [x,z,0] ; P4],1);
line(args{:});
end
hold off; view(120,40)

3 Comments

Thank you a lot for your answer! I'm sorry that it took me so long to respond.
This already helps a lot! I also would like to know, wheter it is also possible to find one point for each plot instead of one point for all of the plots?
So that it looks more like the figure on the right hand side, than on the left?
Thank you very much!
I'm sorry, here you can see it
Yes, in this line
args=num2cell([P{i}; [x,z,0] ; P4],1);
you would just change [x,z,0] to the different point on the circle where you want the line to touch.

Sign in to comment.

More Answers (0)

Categories

Products

Release

R2023a

Asked:

on 29 Sep 2023

Commented:

on 2 Oct 2023

Community Treasure Hunt

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

Start Hunting!