Skip to content

Instantly share code, notes, and snippets.

View atontini's full-sized avatar
🍕

Andrea Tontini atontini

🍕
View GitHub Profile
@atontini
atontini / remove-all-dependencies-pip
Last active December 29, 2022 13:31
Remove all depencencies using Windows command line
for /f "delims=" %i in ('pip freeze') do pip uninstall -y %i
@atontini
atontini / fitCameraToCenteredObject
Last active October 1, 2022 21:28
Mirror of the three.js function to set the camera from here: https://wejn.org/2020/12/cracking-the-threejs-object-fitting-nut/
const fitCameraToCenteredObject = function (camera, object, offset, orbitControls ) {
const boundingBox = new THREE.Box3();
boundingBox.setFromObject( object );
var middle = new THREE.Vector3();
var size = new THREE.Vector3();
boundingBox.getSize(size);
// figure out how to fit the box in the view:
// 1. figure out horizontal FOV (on non-1.0 aspects)