Skip to content
This repository has been archived by the owner on Feb 11, 2024. It is now read-only.

Add rounded cube primitive #142

Open
Henry00IS opened this issue Jun 6, 2018 · 5 comments
Open

Add rounded cube primitive #142

Henry00IS opened this issue Jun 6, 2018 · 5 comments
Labels
type: feature The issue is a feature request. up-for-grabs Perfect issue for new contributors.

Comments

@Henry00IS
Copy link
Collaborator

Henry00IS commented Jun 6, 2018

Such polygons, much smooth! #141

Rounded cube example

There is an algorithm here that you could take inspiration from.

@Henry00IS Henry00IS added type: feature The issue is a feature request. up-for-grabs Perfect issue for new contributors. labels Jun 6, 2018
@ghost
Copy link

ghost commented Jun 6, 2018

I suppose that could be used as a bevel feature?

@Falagard
Copy link

Falagard commented Jun 7, 2018

I wonder if it works well with just one segment.

@Falagard
Copy link

Falagard commented Jun 7, 2018

https://catlikecoding.com/unity/tutorials/rounded-cube/

@iamarkadyt
Copy link

iamarkadyt commented Jun 20, 2018

I would like to try my hand on this.
Already started reading related code.
Update:
Pass; sorry.

@Henry00IS
Copy link
Collaborator Author

I created #160 specifically to deal with this PR. You can now chamfer a cube into smithereens.

PolygonFactory:

bool ChamferPolygons(List<Polygon> polygons, List<Edge> edges, float distance, int iterations, out List<Polygon> resultPolygons)

Now that this method is available it should be a lot easier to build this primitive type. The advantage over just chamfering manually is that the size of the edges will remain consistent with the bounds tool... maybe. I found #141 to be quite a challenge.

We have to make some fundamental changes to how SabreCSG tells brushes about invalidations because not every call to Invalidate() is an appropriate moment to update our geometry (like a position change, which causes movement to slow down to a stuttering crawl). It would be great to add another argument like this:

void Invalidate(bool polygonsChanged, InvalidateReason reason)

Then any reasons can inherit from the base abstract class InvalidateReason and possibly even provide additional information through public properties. This is a lot more future-proof than an enum reason as we may run out of flags.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature The issue is a feature request. up-for-grabs Perfect issue for new contributors.
Projects
None yet
Development

No branches or pull requests

3 participants