Faster numpy cartesian to spherical coordinate conversion?

This is similar to Justin Peel’s answer, but using just numpy and taking advantage of its built-in vectorization: import numpy as np def appendSpherical_np(xyz): ptsnew = np.hstack((xyz, np.zeros(xyz.shape))) xy = xyz[:,0]**2 + xyz[:,1]**2 ptsnew[:,3] = np.sqrt(xy + xyz[:,2]**2) ptsnew[:,4] = np.arctan2(np.sqrt(xy), xyz[:,2]) # for elevation angle defined from Z-axis down #ptsnew[:,4] = np.arctan2(xyz[:,2], np.sqrt(xy)) # … Read more

Java: What is a good data structure for storing a coordinate map for an infinite game world?

1) Instead of an array you could use a Map<Integer, Map<Integer, Tile>> or Map<Point, Tile>, which would of course allow negative indexes 2) If you know the dimensions of your world from the start you could just modify your getter to allow the API to accept negatives and [linearly] transform them into positives. So for … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)