How to use the cjio.geom_help function in cjio

To help you get started, we’ve selected a few cjio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cityjson / cjio / cjio / convert.py View on Github external
elif (
                    comType == "Bridge" or comType == "BridgePart" or comType == "BridgeInstallation" or comType == "BridgeConstructionElement"):
                matid = 7
            elif (comType == "Tunnel" or comType == "TunnelPart" or comType == "TunnelInstallation"):
                matid = 8
            elif (comType == "GenericCityObject"):
                matid = 9
            material_ids.append(matid)

            for geom in j['CityObjects'][theid]['geometry']:
                poscount = poscount + 1
                if geom['type'] == "Solid":
                    triList = []
                    for shell in geom['boundaries']:
                        for face in shell:
                            tri = geom_help.triangulate_face(face, vertexlist)
                            for t in tri:
                                triList.append(list(t))
                    trigeom = (flatten(triList))

                elif (geom['type'] == 'MultiSurface') or (geom['type'] == 'CompositeSurface'):
                    triList = []
                    for face in geom['boundaries']:
                        tri = geom_help.triangulate_face(face, vertexlist)
                        for t in tri:
                            triList.append(t)
                    trigeom = (flatten(triList))
                flatgeom = trigeom
                forimax.append(flatgeom)

            #----- buffer and bufferView
            flatgeom = flatten(forimax)
github cityjson / cjio / cjio / convert.py View on Github external
for geom in j['CityObjects'][theid]['geometry']:
                poscount = poscount + 1
                if geom['type'] == "Solid":
                    triList = []
                    for shell in geom['boundaries']:
                        for face in shell:
                            tri = geom_help.triangulate_face(face, vertexlist)
                            for t in tri:
                                triList.append(list(t))
                    trigeom = (flatten(triList))

                elif (geom['type'] == 'MultiSurface') or (geom['type'] == 'CompositeSurface'):
                    triList = []
                    for face in geom['boundaries']:
                        tri = geom_help.triangulate_face(face, vertexlist)
                        for t in tri:
                            triList.append(t)
                    trigeom = (flatten(triList))
                flatgeom = trigeom
                forimax.append(flatgeom)

            #----- buffer and bufferView
            flatgeom = flatten(forimax)
            vtx_np = np.zeros((len(flatgeom), 3))
            vtx_idx_np = np.zeros(len(flatgeom))
            # need to reindex the vertices, otherwise if the vtx index exceeds the nr. of vertices in the
            # accessor then we get "ACCESSOR_INDEX_OOB" error
            for i,v in enumerate(flatgeom):
                vtx_np[i] = vertexlist[v]
                vtx_idx_np[i] = i
            bin_vtx = vtx_np.astype(np.float32).tostring()