Skip to content

Instantly share code, notes, and snippets.

View hugoledoux's full-sized avatar

Hugo Ledoux hugoledoux

View GitHub Profile
@hugoledoux
hugoledoux / fix.py
Last active October 26, 2022 15:44
fix collapsed triangles
import sys
import point_cloud_utils as pcu
import numpy as np
def main():
# Load vertices and faces for a mesh
# mv, mf = pcu.load_mesh_vf("./cube2.obj")
mv, mf = pcu.load_mesh_vf("./filled_SM_dataset_4.obj")
@hugoledoux
hugoledoux / geogeek.md
Last active October 19, 2022 07:31
computing literacy topics

Basic of computing

  • filesystem

C++

  • CLion
  • Using WSL
  • CMake help
@hugoledoux
hugoledoux / cjps.py
Created September 27, 2022 14:05
cityjson & polyscope
import polyscope as ps
import json
import sys
import numpy as np
import math
def recusionvisit(a, vs):
for each in a:
@hugoledoux
hugoledoux / tu3djson.md
Last active August 6, 2021 09:35
tu3djson

Option 1:

{
  "type": "tu3djson",
  "features": [
    {
      "type": "Building",
      "geometry": {
@hugoledoux
hugoledoux / val.py
Last active March 30, 2021 10:19
some tests for tempfile and schema validation
import jsonschema_rs
import json
import sys
import urllib.request
# try:
js = json.loads(open("/Users/hugo/temp/hhh/test.ext.json").read())
print("yessss")
@hugoledoux
hugoledoux / fastjsonschema.py
Last active March 25, 2021 19:44
fastjsonschema tests
# import jsonschema
# import json
# s = json.loads(open("/Users/hugo/projects/cityjson-specs/schemas/cityjson.min.schema.json").read())
# i = json.loads(open("/Users/hugo/data/cityjson/v1.1/denhaag/DenHaag_01.city.json").read())
# # i = json.loads(open("/Users/hugo/data/cityjson/v1.1/denhaag/b32.city.json").read())
# isValid = True
# es = []
# myvalidator = jsonschema.Draft7Validator(s, format_checker=jsonschema.FormatChecker())
# for err in sorted(myvalidator.iter_errors(i), key=str):
@hugoledoux
hugoledoux / cjbinary.py
Created February 26, 2021 14:57
convert json to binary msgpack/cbor
import json
import msgpack
import cbor2
# filename = '/Users/hugo/temp/c++11/data/DenHaag_01.json'
# filename = '/Users/hugo/data/cityjson/examples/vienna/v100/Vienna_102081.json'
filename = '/Users/hugo/data/cityjson/examples/zurich/Building_LoD2_V10.json'
fin = open(filename)
j = json.loads(fin.read())
@hugoledoux
hugoledoux / Cargo.toml
Last active January 21, 2021 19:16
fix wrong "lod" in CityJSON PDOK files
[package]
name = "fixcjpdok"
version = "0.1.0"
authors = ["Hugo Ledoux <h.ledoux@tudelft.nl>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
@hugoledoux
hugoledoux / cppinstall.md
Last active September 9, 2020 08:44
how to install C++ compiler

NOTE: There are usually many options to set up a development environment on each operating system. What proposed here is not the only option, but I try to minimize your effort. Besides, you may skip some of the steps if they have been properly set up already. Or if you know what you're doing, you're allowed to use any C++ you want. As long as you know how to deal with a CMake project, it's good.

Here's a small test project with one C++ unit (hello.cpp) and a CMake file (the project file to tell the compiler how to compile the project).

Windows

Install Microsoft Visual Studio Community 2019, and not Visual Studio Code.

@hugoledoux
hugoledoux / move_to_origin.py
Created August 15, 2019 10:09
Blender move to origin
from random import random
def move_obj(infile, outfile, translate=(0,0,0), delimiter=' ', standard_building_height=None):
tx,ty,tz = translate
with open(outfile,'w') as fo:
with open(infile,'r') as f:
for i, line in enumerate(f):
if line.startswith('v'):
columns = line.split(delimiter)