VladGribinchuk / FoundationBuilder

Application for calculation a stand(foundation) for 3d models
0 stars 0 forks source link

Discuss the algorithm of creation of a fundament for figure #18

Closed IlliaHryshchuk closed 4 years ago

IlliaHryshchuk commented 4 years ago
VladGribinchuk commented 4 years ago

Looks like this task is interconnected a bit with #17. @1m8o5s @okrdima @IlliaHryshchuk but please let me know if some of you guys have additional questions

IlliaHryshchuk commented 4 years ago

I have an idea:

  1. read an stl figure
  2. move all points to a plane, to get a shape of a figure (all z coordinates =0, or even move all points to 2d polygon (by moving only x and y coodrinates). In this way we will get something like proection of a figure (imagine that we are watching on the figure perpendicularly from the top)
  3. use Polygon::convexHull() to reject inner points
  4. use Polygon::simplify() to reject redundant points
  5. expand it somehow (idk how, but the foundation must be a little bit wider, than figure)
  6. triangulate it
  7. clone it a little bit higher or lower (the same plane, but z coordinate +=height of a foundation)
  8. now we have a bottom and a top. Unite it somehow (create walls)
  9. Move the foundation under a stl figure (find AABB of a figure, and move the foundation to aabb.pmin().z)
  10. write a foundation and a figure to the file

could it be "workable"? or the better algorythms exist?

IlliaHryshchuk commented 4 years ago

Looks like this task is interconnected a bit with #17.

It is a little bit detailed algorithm, perhaps, it would be better if we have created one issue for it, i agree

VladGribinchuk commented 4 years ago

Yes, in general, I imagine the whole idea in the same way. @1m8o5s please follow algorithm described here during implementation of #21.

But maybe I didn't understand the 2 step, or you made a typo. Why should we make y-coordinates 0? Do you want to make XZ projection of model? From my point of view we need XY projection. Of course, if Z component is considered as a height of the model, and XY are lenght and width. About 5 step we should think a bit more to find good and lightweight solution. Any ideas shoul be described in the appropriate issue #22.

IlliaHryshchuk commented 4 years ago

Why should we make y-coordinates 0?

In my imagination is the same: z coordinate have to move a figure up and down. But i have tried to move an stl figure by editing askii file, and when i change third coordinate - the figure moves up and down. When i change second coordinate - figure moves closer and further. First coordinate - lefter and righter. So that is why i decided that we should do "y=0". Is it wrong?

VladGribinchuk commented 4 years ago

Looks like our imagination of 3D space and 3D coordinates are the same. Which is good. But I feel I am breaking my brain... so, break also yours by looking at the picture below) I was painting it in my phone by fingers. 20200525_223644

How do you think what type of projection do we need? I think it is XY (green). This is why, all that you have written about Y=0, i.e. XZ projection, confuses me and makes no sense.

Does my point of view make sense to you? Or I dont understand something?)

IlliaHryshchuk commented 4 years ago

Oh, it is my mistake, i have understood. I will re-write the algorithm now

VladGribinchuk commented 4 years ago

Looks like we can close this, don't we? Since related task was done.