AnsweredAssumed Answered

split comp operation by "planar surfaces"?

Question asked by Abele_Giandoso on Sep 25, 2018
Latest reply on May 10, 2020 by Abele_Giandoso

Hi All

I posted a Suggestion in the Idea section, 

comp operation by "flat island" in CityEngine 

but I thought maybe there is a way to do just that already and I haven't thought about it.


If you ppl have some sugestions it would be amazing! And if you like the suggestion please vote for it  so it maybe gets implemented. 

It is a problem I encounter all the times, as I work with imported FBX assets, lots created from curved streets, L, U and O shapes, so very irregular base shapes. 


My question:

Is there a way to do a Comp by islandcomp split that separates objects into "islands", or "flat shells" as long as they are continuous, so if the angle between faces does not exceed a certain amount. Independently from the number of faces this "island" contains. 


Take this example, where bot the C faces and A faces are orientated in the same way, let's say parallel to the object front, while the B faces are at 70 degrees . 


comp(f) { front= X} would produce a single mesh composed of A and C, thus not creating a flat surface.


comp(f) { front: X} will create 18  separates faces (12 in A plus 6 in B)


I suggest adding a comp(i) operation so that writing


comp(i) { front: X} produces 2 separated meshes, A and C.


I think it could be very useful especially with the buildings created from L, U and O shapes.

There could be an extra parameter defining what is the angle between faces in degree that is the limit to consider a shell "flat", like a threshold parameter. So that if there is an angle of 3 degrees between 2 faces and I type "4" in this parameter, the 2 faces will still be considered as part of the same shell.



If this is not possible, is there any method, taking the above example, AFTER doing

comp(f) { front= X} 

therefore eliminating surface B, to separate surface A from Surface C without splitting them into 18 microfacets?


UPDATE I see there is a function called geometry.isPlanar, maybe something involving that..  :/