{"action":"created","issue":{"url":"https://api.github.com/repos/vispy/vispy/issues/647","labels_url":"https://api.github.com/repos/vispy/vispy/issues/647/labels{/name}","comments_url":"https://api.github.com/repos/vispy/vispy/issues/647/comments","events_url":"https://api.github.com/repos/vispy/vispy/issues/647/events","html_url":"https://github.com/vispy/vispy/issues/647","id":50199659,"number":647,"title":"Improvements to cameras ","user":{"login":"almarklein","id":3015475,"avatar_url":"https://avatars.githubusercontent.com/u/3015475?v=3","gravatar_id":"","url":"https://api.github.com/users/almarklein","html_url":"https://github.com/almarklein","followers_url":"https://api.github.com/users/almarklein/followers","following_url":"https://api.github.com/users/almarklein/following{/other_user}","gists_url":"https://api.github.com/users/almarklein/gists{/gist_id}","starred_url":"https://api.github.com/users/almarklein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/almarklein/subscriptions","organizations_url":"https://api.github.com/users/almarklein/orgs","repos_url":"https://api.github.com/users/almarklein/repos","events_url":"https://api.github.com/users/almarklein/events{/privacy}","received_events_url":"https://api.github.com/users/almarklein/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/vispy/vispy/labels/component:%20scene","name":"component: scene","color":"89B9F0"},{"url":"https://api.github.com/repos/vispy/vispy/labels/type:%20enhancement","name":"type: enhancement","color":"bfe5bf"},{"url":"https://api.github.com/repos/vispy/vispy/labels/type:%20question","name":"type: question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2014-11-26T16:32:06Z","updated_at":"2015-01-23T15:48:01Z","closed_at":null,"body":"I already made some changes to the cameras in #612, and I have some further ideas for improvements.\r\n\r\n1) **Bounds** The Visual class has a `bounds` method which subclasses must implement to expose their \"coverage area\". We should use these to automatically set the camera to show all the content in the scene. The SubScene object hasa `get_scene_bounds()` method that calculates the total bounds of the scene. The camera uses this when `camera.reset()` is called. A reset takes place the first time that a camera is associated with a viewbox. This means that if you first put visuals in the scene, and then assign a camera, things Just Work.\r\n\r\n2) **Zoom direction** We should decide whether scrolling up or down zooms in. Similarly zooming with RMB. These two should also be consistent.\r\n\r\n3) **scale_factor** on all cameras. In #612 I gave the BaseCamera a `scale_factor` property, which is initially determined from the range (in `set_range`), but can subsequently be modified to modify the scale. For the turntable camera this directly corresponds to zooming. For the Fly camera this determines the speed of the vessel. I did not apply this to the PanZoomCamera yet, but it should also directly correspond to zooming. Actually, I think we could bind the scroll wheel to this attribute in the base camara class.\r\n\r\n4) **center** on all cameras. All camera's have *some* aspect of the center. The center of rotation for turntable, the center of the visible area for panzoom, and for the fly camera the position of the vessel. The center can be determined in `set_range()`\r\n\r\n5) **fov** on all camera. Some visuals (like Volume), need this info, is convenient that its always there. Correction: Only PerspectiveCamera and derived classes need this parameter.\r\n\r\n6) **Multiple cameras / multiple scenes**. Would be good to make it easy to have multiple cameras in one scene, and also to have one camera be used by multiple scenes. Both now works per #612. \r\n\r\n7) **aspect ratio** of the scene. The scene or viewbox should have an `aspect_ratio` property, which is a 3-element tuple that defines the scaling of each dimension. Negative values indicate flipping of that dimension. Camera's should deal with this, and e.g. plots should be zoomable in two dimensions (unless this is disabled). I got this working pretty well in visvis (and I remember it was painful to implement :( )\r\n\r\nChecklist (for what we agree on):\r\n\r\n* [x] bounds / limts\r\n* [x] zoom scroll direction\r\n* [x] scale factor\r\n* [x] center\r\n* [x] fov\r\n* [x] Multiple cameras / multiple scenes\r\n* [x] aspect ratio\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/vispy/vispy/issues/comments/71212724","html_url":"https://github.com/vispy/vispy/issues/647#issuecomment-71212724","issue_url":"https://api.github.com/repos/vispy/vispy/issues/647","id":71212724,"user":{"login":"almarklein","id":3015475,"avatar_url":"https://avatars.githubusercontent.com/u/3015475?v=3","gravatar_id":"","url":"https://api.github.com/users/almarklein","html_url":"https://github.com/almarklein","followers_url":"https://api.github.com/users/almarklein/followers","following_url":"https://api.github.com/users/almarklein/following{/other_user}","gists_url":"https://api.github.com/users/almarklein/gists{/gist_id}","starred_url":"https://api.github.com/users/almarklein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/almarklein/subscriptions","organizations_url":"https://api.github.com/users/almarklein/orgs","repos_url":"https://api.github.com/users/almarklein/repos","events_url":"https://api.github.com/users/almarklein/events{/privacy}","received_events_url":"https://api.github.com/users/almarklein/received_events","type":"User","site_admin":false},"created_at":"2015-01-23T15:48:01Z","updated_at":"2015-01-23T15:48:01Z","body":"Ok, I fixed most issues mentioned by Luke:\r\n\r\n- fov is property of the BaseCamera\r\n- camera.reset() -> set_range()\r\n- camera has get_state() and set_state() methods\r\n- camera has link() method to link cameras in different scenes\r\n- camera is now associated with 0 or 1 viewboxes, not more. Simpler code!\r\n- grid.py fixed\r\n\r\nRemaining points:\r\n\r\n* I am not sure about having PanZoom subclass Perspective. In my view Perspective is a \"3D\" camera. If PanZoom would inherit from it, we might as well do Perspective == BaseCamera.\r\n* I did not do a Camera.zoom() yet. PanZoomCamera already has a method `zoom(center, scale_factor)`. Should we rename this one? Also I realized that `camera.zoom(x)` would simply do `camera.scale_factor *= x`. Do we need a function for that?\r\n* The sensitivity of the zooming can easily be adjusted with a constant in the top of the module. Maybe we should fiddle with that in Paris. \r\n"}}