speed up point cloud rendering

this is mostly caching some computations and using proper loop iterations