Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gable roofs generation #12

Closed
Andrej730 opened this issue Mar 14, 2023 · 5 comments
Closed

Gable roofs generation #12

Andrej730 opened this issue Mar 14, 2023 · 5 comments

Comments

@Andrej730
Copy link

@polarkernel

Is it possible to make gable roofs with bpypolyskel?

The best idea I currently came up with is just generating hiped roof from the footprint and moving it's top vertices towards the edges that I want to be flattened.

I tried to hack into bpypolyskel.polygonize and alter a part of the skeleton from Subtree(source=Vector((0.0, -1.0)), height=1.0, sinks=[Vector((-1.0, -2.0)), Vector((1.0, -2.0))] to Subtree(source=Vector((0.0, 1.0)), height=1.0, sinks=[Vector((1.0, 2.0)), Vector((-1.0, 2.0))]) and setting height for the skeleton_node3D that's created from that subtree so it wouldn't be zero.

But the result was poly2FacesGraph.faces() returning inccorrect faces where same vertex appears more than once:
[[0, 1, 5, 4], [3, 0, 4], [2, 1, 0, 3, 2, 5, 1, 2, 3, 4, 5]]
(expected something like [[0, 1, 5, 4], [3, 0, 4], [2, 3, 4, 5], [1, 2, 5]])

Any suggestions?

@vvoovv did this need occur on Blender-OSM? how were you solving that problem?

@polarkernel
Copy link
Collaborator

It is difficult for me to answer without having the original data of your attempt. However, I don't think it is a good idea to tweak bpypolyskel to create gabled roofs, you will always run in special cases. There are easier algorithms for gabled roofs. I think, @vvoovv can give you some hints on how he did it in blender-osm.

@Andrej730
Copy link
Author

I can provide the data I was using with polygonize:

kwargs = {'faces': None,
 'firstVertIndex': 0,
 'height': 0.0,
 'holesInfo': None,
 'numVerts': 4,
 'tan': 0.0,
 'unitVectors': None,
 'verts': [Vector((-1.0, -2.0, 0.0)),
           Vector((1.0, -2.0, 0.0)),
           Vector((1.0, 2.0, 0.0)),
           Vector((-1.0, 2.0, 0.0))]}

@costika1234
Copy link
Contributor

costika1234 commented Mar 14, 2023

That's just a very simple roof with 2 planes that can be generated using simpler methods. As @polarkernel said, it's not even worth trying to think about adapting a hip roof for the general case due to so many corner cases. At some point you will have to have hips and valleys, and trying to figure out which parts can turn into gables is insanely difficult.

If you have an application that allows you to manually edit the position of the vertices using some sort of drag tool, then it is quite easy to adapt the geometry and end up with gables in the desired locations. However, it sounds like you are trying to generate this automatically and have as many gables as possible, right?

@Andrej730
Copy link
Author

Andrej730 commented Mar 14, 2023

That was just an example, I need it for much more complex shapes and polygonize does good job for creating this type of roof except I need to add some gables to it. I'm looking for a way to do it automatically from the roof footprint and list of edges of that footprint that suppose to have a gable.

@vvoovv
Copy link
Member

vvoovv commented Mar 14, 2023

That was already discussed in #9. The way to go would be to postprocess the results provided by bpypolyskel. It is not implemented in Blender-OSM

@vvoovv vvoovv closed this as completed Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants