#! /usr/bin/env python3 #command line arguments: # --help, -h, outputs usage of the program # -x, -y, outputs width and hight of the output image # --output, -o, name of output file. if there are multiple input files, there will be a number prepended to this. # after all comamnd line arguments, file or files(space seperated) to process. import numpy as np import sys, argparse, laspy, logging import seaborn as sns; sns.set_theme() import matplotlib.pyplot as plt from PIL import Image logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO) def sort(array): #sort by zDim column, first to last. logging.debug(f'zDim sliced points is\n{array[:,zDim]}') #the [::-1] reverses the resulting array, so that sortedPoints will be from biggest to smallest. ind = np.argsort(array[:,zDim])[::-1] sortedPoints = array[ind] logging.debug(f'sortedPoints is\n{sortedPoints}') return sortedPoints def scale(array, xRange, yRange, maxX, maxY): logging.debug(f'xRange is {xRange} and yRange is {yRange}') xScale = maxX/xRange yScale = maxY/yRange scaledArray = sortedPoints[:, 0:3] scaledArray[:,xDim]=scaledArray[:,xDim]-mins[xDim] scaledArray[:,xDim]=scaledArray[:,xDim]*xScale logging.debug(f'xmin in scaledArray is {scaledArray[:,xDim].min()}') logging.debug(f'xmin in scaledArray is {scaledArray[:,xDim].max()}') scaledArray[:,yDim]=scaledArray[:,yDim]-mins[yDim] scaledArray[:,yDim]=scaledArray[:,yDim]*yScale logging.debug(f'ymin in scaledArray is {scaledArray[:,yDim].min()}') logging.debug(f'ymin in scaledArray is {scaledArray[:,yDim].max()}') logging.debug(f'scaledArray is\n{scaledArray}') return scaledArray def isInxyRange(xMin, xMax, yMin, yMax, xVal, yVal): return (xMin<=xVal) and (xVal