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 Whether to Use the Stencil Buffer

Non-concave faces should be drawn by using the a stencil buffer. By default this is turned of when loading objects through URL. This can be enabled by adding "&stencil=true", e.g. for

Set Background Colour

You can set the background colour by setting the parameter "&bg_col=0xrrggbb" where 0xrrggbb is a hexidecimal number for the red (rr), green (gg) and blue (bb) chanals. E.g. for this model

Reference

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