Last active
December 5, 2018 06:46
-
-
Save KudoLayton/d8418b694d8cbc099bc2bf17830da816 to your computer and use it in GitHub Desktop.
Random Point Cloud Box Generator (pts file)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import colorsys | |
import random | |
import numpy as np | |
inputs = 3_000_000 | |
square = 300 | |
length = 300 | |
past = 0 | |
with open('generate.pts', 'w') as outFile: | |
outFile.write(f'{inputs}\n') | |
for i in range(inputs): | |
color = colorsys.hsv_to_rgb(i / inputs, 1, 1) | |
outFile.write(f'{random.random() * square} {random.random() * square} {np.random.normal(i * length / inputs, 5)} {int(color[0] * 255)} {int(color[1] * 255)} {int(color[2] * 255)}\n') | |
current = int(i / inputs * 100) | |
if past != current: | |
past = current | |
if current % 10 == 0: | |
print(f'{current}% done!') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment