Show a Local OFF file

Navigation by Mouse and Keyboard

Left click a mouse and move it to rotate the object, normally in an intuitive way: it is as if you touch a ball an spin it. This way isn't implemented all the way through though, since I also wanted that if you return to your starting point and release the object should have its original orientation. It is also possible to rotate the object around an axis that sticks out of the canvas. This can be done by clicking and dragging along the edges of the canvas.

Because I also wanted the object to get back to its initial position when releasing it at the same spot, some strange effects can be seen when taking up the object in the centre of the canvas (by clicking) move it to a side, rotate it 180 degrees around an axis orthogonal to the canvas and then drag it back to the centre of the canvas.

Zooming can be done by pressing the shift and using the main mouse-click. Other actions:

By default concave polygons are supported by means of a stencil buffer. This means that two passes are required and all faces need to be considered separately. This isn't very efficient, so there is a way to optimise this for objects that only have convex faces: The key 'c' is used to toggle support for concave and convex faces.

Navigation by Touch Screen

The following actions are support for touch screen:

Show an Off-File from this Website

To show any off-file that is part of this domain add to the URL the string "?off_file=<URL>", where <URL> is the complete URL to the off-file, e.g. add ?off_file=http://tunnissen.eu/polyh/CubeCompounds.off/10A.A5xI.D3xI.off. For security reasons cross-origin requests are blocked, meaning that you only can do this for off-files with the exact same domain name as the base URL.

Set the Default Camera Distance

The default camera distance is set to 10. If you want another distance, e.g. 7, then you can specify this on the URL by adding "?distance=7" to the URL. If you use more then one parameter, then you will need to split them by '&' (and only use the '?' at the start of the parameters), try for instance: this link

Reference

The source code to the javascript that shows the off-files can be found here.