Select to view content in your preferred language

overlapping OBJ buildings

882
3
05-16-2023 06:37 PM
GunSikKim
Emerging Contributor

GunSikKim_0-1684286803543.png

Hello,
I'm populating building OBJ on the lots with insert function,

one very important restriction is,
I want to keep the size of source OBJ (keepSizeAlignPosition)

I'm wondering if there's way to get rid of overlapping between geometry

potential solution would be

- detect the volume of the OBJ file than create Lot shape based on it (This might be the best for me)

- pick a OBJ file that fits perfectly inside of given lot

- if overlapping happens, NIL


-------------

villa_bldg_1 -->
innerRectangle(edge) {shape : letsoffsetResidential | remainder = NIL}
 
letsoffsetResidential -->
offset(bldOffset*-1)
comp(f) { inside : villa_bldg_1_i | border : NIL }
 
villa_bldg_1_i  -->
alignScopeToAxes(y) s('1,0,'1)
i(getInstanceNameResidential, yUp, keepSizeAlignPosition)
0 Kudos
3 Replies
GunSikKim
Emerging Contributor

GunSikKim_0-1684346775138.png

update - 
I'm switching LOD by user-created attribute

I found that 

Test --> case overlaps(all) : Red
else : Green

Red --> color(1,0,0)
Green --> color(0,1,0)

occlusion detection on bounding box (which is still box OBJ files) works great
but not with high-poly OBJ like img below

GunSikKim_1-1684346903005.png

It only detects if model touches street

0 Kudos
JonasObertuefer
Esri Contributor

Hi @GunSikKim,

Quoting from the inside / overlaps / touches function cga reference:


In any case, tests are only performed against geometries which form a closed surface (i.e. a waterproof mesh which has no boundary edges).

So you need to simplify your inserted buildings first somehow. One possible solution would be to create a footprint out of the imported building, extrude the footprint and then do the occlusion query:

 

Lot -->
	i("myBuilding.obj", yUp, keepSizeAlignPosition)
	footprint()
	extrude(20)
	Test
	
Test --> 
	case touches(all) : Red
	else : Green

Red --> color(1,0,0)
Green --> color(0,1,0)

 

Also in your case its probably enough to test using touches() instead of overlaps()

Hope this helps!

Best,
Jonas

0 Kudos
CherylLau
Esri Regular Contributor

You could use assetInfo() to get the size of an obj or assetsSortSize() to sort a list of obj files according to how well they match your current scope.  assetsSortRatio() also exists which sorts files by how well they match the reference ratio, but this may or may not be helpful in your case.

https://doc.arcgis.com/en/cityengine/latest/cga/cga-asset-info-function.htm

https://doc.arcgis.com/en/cityengine/latest/cga/cga-assets-sort-size-function.htm

 

0 Kudos