How can I create a solid cylinder along a spline?

I'm trying to create a solid cylinder along a random spline with at least 3 segments in order to represent cnts with high aspect ratio.

4 Comments

"Cylinders" are defined as straight tubes. How do you define "along a spline" exactly? What is a random spline? Do you have the coordinates already? Should the spline or the cylinder have at least 3 segments and what is a "segment"? What are "cnts" and what does "aspect ration" means here?
You see: I do not undestand any part of the sentence. Please post, what you have tried so far and explain, which problems occur.
What I am trying to simulate is a random distribution of curved cylinders into a volume. The centers of the cylinders will be based on random points. However, I would like to model the cylinder based on 4 random points (3 segments) creating a curved cylinder. The reason is to calculate the local volumetric density at many subvolumes. My problem is to simulate the cylinder as curved. Is it possible? Thank you for your answer.
It is not clear to me, what "model the cylinder based on 4 random points (3 segments)" means.
  • What are the inputs you have?
  • What ios the wanted output? Do you want to draw it or to get the corrdinates? Should the "cylinder" be a curved tube? If so, do you want to create it by plane patch objects or are you looking for e.g. splines which define the surface?
Again: Please post, what you have tried so far and explain, which problems occur.
This is not a MATLAB question, but only a vague statement of your goals.
For example, a solid cylinder does not exist in MATLAB. Nothing truly exists, except for a few flipped bits. All that matters is how you will interpret some numbers in MATLAB. The variable
x = 3;
means nothing, unless you put some context around it. Is x a poor approximation to pi? Is it the number of apples in your hand, or how many pounds of apples you need to make applesauce?
So, as for this solid cylinder. Are you just looking to make a pretty picture? Will you do some computations using "it"? What you will do with some object that you will conceptually create in MATLAB will impact how you need to store that creation.
As for a "random spline", this is something that has no meaning, just as it is meaningless to ask for a random integer. Without a distribution over the set of the integers, a random integer is impossible to choose. This is true for a random spline too.
"cnts" and "aspect ratio"? More meaningless words, jargon written without definition, said without placing any context around them. My guess is those words are meaningless to us, since they are probably irrelevant to the real question you have here. But if they are irrelevant, then why tell us?
The point is, you need to turn these vague words into meaningful concepts. That starts in your brain, because only you know what you mean by those words, and only you know (so far) what you will do with the result.
If you want help on a MATLAB question, the best way to get help is to start writing MATLAB code, then show what you are doing and ask a clear question about it. If you ask only a vague question out of context, then nobody knows if you have even half a clue as to what a spline is, or how it might be represented. So does someone need to teach you everything about a spline, including how it might possible by representable in MATLAB? What you will do with that vaguely cylindrical curved tube will depend on how it is created, how it will be stored, if it will be stored at all.
What happens if what someone tries to teach you would not be in a useful form for your problem? Then they have wasted their time and yours.
https://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer

Sign in to comment.

Answers (1)

John D'Errico
John D'Errico on 30 May 2017
Edited: John D'Errico on 30 May 2017
After I wrote my comment, I saw this:
"The centers of the cylinders will be based on random points."
So generate some random points. WTP?
"However, I would like to model the cylinder based on 4 random points (3 segments) creating a curved cylinder. ... My problem is to simulate the cylinder as curved."
You don't need to simulate anything. Generate some points. Interpret them as the break points of a spline in 3 dimensions. A point would be inside a tube around a curved path through space (a spline in 3-dimensions) if the distance from the point to that curve is less than a specified value. That would be the radius of the cylinder.
So it appears your question MAY BE how to know if the distance from a point to a smooth curve in 3 dimensions (a spline) is less than a given radius. You may find my distance2curve tool of use, as posted on the file exchange.
Would that solve your problem? Who knows? You are still using wild jargon without definition. For example, "The reason is to calculate the local volumetric density at many subvolumes." What does that mean?
(I'll probably be sorry I waded into this question, because it is one that looks as if it will be diverging in random directions. Vague questions are often that way, since the person does not really know/understand what they want to do. They have only a vague idea, ergo the vague question. Sorry, but true.)

Categories

Edited:

on 30 May 2017

Community Treasure Hunt

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

Start Hunting!