Creating a rock shape

4 views (last 30 days)
Mücahit Gürbüz
Mücahit Gürbüz on 24 Dec 2014
Commented: Adam Danz on 22 Oct 2022
Hi everyone,
I need to define a rock shape like 3D Object. The dimensions and inputs types are not important. To sum up, I have to a rock shape in graph like the picture below. Thank you!
  1 Comment
Adam Danz
Adam Danz on 22 Oct 2022
See the example file in the craters file exchange submission.

Sign in to comment.

Accepted Answer

Sean de Wolski
Sean de Wolski on 24 Dec 2014
% My Rock
x = randn(1000,1);
y = randn(1000,1);
z = randn(1000,1);
% Alpha Shape and plot
as = alphaShape(x,y,z,4);
plot(as,'FaceColor',[218 136 86]./255,'EdgeAlpha',0)
title('My Rock')
lighting gouraud
light('Position',[2 -4 2],'Style','local')
A little pointy, but hey, I'm from New England and granite is pointy!!
  11 Comments
Mücahit Gürbüz
Mücahit Gürbüz on 25 Dec 2014
Ok I solved the problem with alphaShape, thank you!
Mücahit Gürbüz
Mücahit Gürbüz on 27 Dec 2014
Can you help me on, smoothing the edges of the rock?

Sign in to comment.

More Answers (1)

John D'Errico
John D'Errico on 24 Dec 2014
Edited: John D'Errico on 24 Dec 2014
The best material model of a cat is another, or preferably the same, cat.
Philosophy of Science (1945) (N. Wiener, A. Rosenblueth)
That observation would also apply to rocks.
You don't really say why you need a MATLAB rock. What are your goals for this rock? A model of a rock must have a purpose, otherwise one can clearly choose many ways to create said model. So, with no better information about your goals, I would start with a spherical rock. There is also a joke about spherical cows, in case you missed the reference, though spherical rocks may be a decent approximation for many problems. And since any model is an approximation, I don't know how good of a model you need.
Perhaps the picture was supposed to be a subtle hint. If so, then why not say what you will need it for? How good of a rock shape model do you need? For example, the picture shown shows vaguely irregular rocks, but not terribly so. But they also have cracks in them. A simple model of an irregular shape is easy enough. Go out into your yard, and pick up some rocks. Make careful measurements of said rock in 3-d. Input said data into MATLAB, then use an alpha shape to create a 3-d tessellation of said rock. Repeat with as many rocks as you can find. (When done with the rocks, drop them off in my yard, as I want some spare rocks for landscaping.) You might also use 3-d imaging to create very nice rocks. So it might help to know what you can use to build said rock models.
Do these "rocks" really need to be just simple things you can pack? Note that even sphere packing is not a trivial mathematical task. But you could start with a tessellation of a spherical rock, then add essentially fractal noise to the surface.
Or if you really need a rock model that includes cracks, dirt on the faces, etc., you need to do more work. (From my tenure as an ME, I recall that modeling crack propagation can be a difficult but interesting thing to do well.) So when you have a question, explain it. Explain your needs, your goals. And of course, it helps to know what your capabilities might be. Otherwise, we can do no better than go back to the quote I started with.
  8 Comments
John D'Errico
John D'Errico on 24 Dec 2014
I thought the next question would end up being packing.
As I said before, even sphere packing can be non-trivial. The packing of general shapes into a tight complex is a very non-trivial thing to do. So, again, I really think you need to explain your final goals.
Why? Because for example, if in the end all you want is a pretty picture of some rocks, then find an artist who is willing to draw a picture of some rocks! Even easier, pile up some rocks, and take a picture of the pile.
However, if you need a complex of aggregated "rocks" for some other purpose, then what you need to tell us is the purpose of your project. What you will do with the result is crucial to knowing how to best build that result. And in the end, I would return you to that quote I started with. If you need a perfect model, then start with a pile of real rocks.
Mücahit Gürbüz
Mücahit Gürbüz on 25 Dec 2014
Ok John, you are right again. My project is about right placement of geogrids. Geogrid is a material that improve stability of the ground. In the ground, I will have randomly shaped rocks, and to have right placement for my geogrid, rocks should be exact fit in spacing. Because when we try to pull out geogrid, rocks must be prevent it. But if rocks don't fit in grid, then pulling out geogrids will be so easy and geogrids will become useless. To sum up, I will try to get best fitting positions of rocks in to geogrid.
So when I go a ground and take dimension of aggregas, then I can came up a fitting positions of it with this matlab codes. Then I can decide where should I place my geogrid.
Thank you for your help!

Sign in to comment.

Categories

Find more on Computational Geometry in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!