{"action":"created","issue":{"url":"https://api.github.com/repos/mikedh/trimesh/issues/262","repository_url":"https://api.github.com/repos/mikedh/trimesh","labels_url":"https://api.github.com/repos/mikedh/trimesh/issues/262/labels{/name}","comments_url":"https://api.github.com/repos/mikedh/trimesh/issues/262/comments","events_url":"https://api.github.com/repos/mikedh/trimesh/issues/262/events","html_url":"https://github.com/mikedh/trimesh/pull/262","id":384547008,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMzNzI0NTM4","number":262,"title":"Show camera as mesh","user":{"login":"wkentaro","id":4310419,"node_id":"MDQ6VXNlcjQzMTA0MTk=","avatar_url":"https://avatars2.githubusercontent.com/u/4310419?v=4","gravatar_id":"","url":"https://api.github.com/users/wkentaro","html_url":"https://github.com/wkentaro","followers_url":"https://api.github.com/users/wkentaro/followers","following_url":"https://api.github.com/users/wkentaro/following{/other_user}","gists_url":"https://api.github.com/users/wkentaro/gists{/gist_id}","starred_url":"https://api.github.com/users/wkentaro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wkentaro/subscriptions","organizations_url":"https://api.github.com/users/wkentaro/orgs","repos_url":"https://api.github.com/users/wkentaro/repos","events_url":"https://api.github.com/users/wkentaro/events{/privacy}","received_events_url":"https://api.github.com/users/wkentaro/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-26T22:58:43Z","updated_at":"2018-11-26T23:15:11Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/mikedh/trimesh/pulls/262","html_url":"https://github.com/mikedh/trimesh/pull/262","diff_url":"https://github.com/mikedh/trimesh/pull/262.diff","patch_url":"https://github.com/mikedh/trimesh/pull/262.patch"},"body":"```python\r\n#!/usr/bin/env python\r\n\r\nimport numpy as np\r\nimport trimesh\r\nimport trimesh.transformations as tf\r\n\r\n\r\ntrimesh.util.attach_to_log(level='WARNING')\r\n\r\n\r\ndef get_homography_rpy(roll, pitch, yaw, distance, center):\r\n    translation = tf.translation_matrix(center)\r\n    translation[2][3] += distance  # z from center\r\n    rotation = (\r\n        tf.rotation_matrix(roll, [1, 0, 0], point=center) @\r\n        tf.rotation_matrix(pitch, [0, 1, 0], point=center) @\r\n        tf.rotation_matrix(yaw, [0, 0, 1], point=center)\r\n    )\r\n    transform = translation @ rotation\r\n    return transform\r\n\r\n\r\ndef get_homography_lookat(eye, lookat):\r\n    # both are positions\r\n    assert len(eye) == 3\r\n    assert len(lookat) == 3\r\n\r\n\r\nif __name__ == '__main__':\r\n    extents = (0.5, 0.5, 0.5)\r\n    box = trimesh.creation.box(extents)\r\n    box.visual.face_colors = [255, 0, 0, 127]\r\n\r\n    scene = trimesh.Scene()\r\n    scene.add_geometry(box, node_name='box')\r\n\r\n    scene.add_geometry(trimesh.creation.axis())\r\n\r\n    roll, pitch, yaw = 0, 0, np.deg2rad(45)\r\n    distance = 0.9\r\n    center = (0, 0, 0)\r\n    transform = get_homography_rpy(roll, pitch, yaw, distance, center)\r\n    print('Using RPY (Red)')\r\n    print('Distance:', distance)\r\n    print('RPY:', (roll, pitch, yaw))\r\n\r\n    scene_camera = scene.copy()\r\n    camera = trimesh.scene.Camera(\r\n        resolution=(320, 240),\r\n        fov=(60, 45),\r\n        transform=transform\r\n    )\r\n    scene_camera.set_camera(camera=camera)\r\n    scene_camera.show(start_loop=False)\r\n\r\n    # this transform is necessary to get correct image\r\n    transform = transform @ tf.rotation_matrix(np.deg2rad(-180), [1, 0, 0])\r\n    camera.transform = transform\r\n    scene.add_geometry(camera.as_meshes())\r\n    scene.show()\r\n```\r\n\r\n<img width=\"820\" alt=\"screen shot 2018-11-26 at 22 54 44\" src=\"https://user-images.githubusercontent.com/4310419/49047260-c5452480-f1ce-11e8-917e-4a072404b15a.png\">\r\n"},"comment":{"url":"https://api.github.com/repos/mikedh/trimesh/issues/comments/441836954","html_url":"https://github.com/mikedh/trimesh/pull/262#issuecomment-441836954","issue_url":"https://api.github.com/repos/mikedh/trimesh/issues/262","id":441836954,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MTgzNjk1NA==","user":{"login":"coveralls","id":2354108,"node_id":"MDQ6VXNlcjIzNTQxMDg=","avatar_url":"https://avatars1.githubusercontent.com/u/2354108?v=4","gravatar_id":"","url":"https://api.github.com/users/coveralls","html_url":"https://github.com/coveralls","followers_url":"https://api.github.com/users/coveralls/followers","following_url":"https://api.github.com/users/coveralls/following{/other_user}","gists_url":"https://api.github.com/users/coveralls/gists{/gist_id}","starred_url":"https://api.github.com/users/coveralls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveralls/subscriptions","organizations_url":"https://api.github.com/users/coveralls/orgs","repos_url":"https://api.github.com/users/coveralls/repos","events_url":"https://api.github.com/users/coveralls/events{/privacy}","received_events_url":"https://api.github.com/users/coveralls/received_events","type":"User","site_admin":false},"created_at":"2018-11-26T23:15:11Z","updated_at":"2018-11-26T23:15:11Z","author_association":"NONE","body":"\n[![Coverage Status](https://coveralls.io/builds/20301787/badge)](https://coveralls.io/builds/20301787)\n\nCoverage decreased (-2.6%) to 81.374% when pulling **8de709f994530d715dfc19aec22ba451b922e4d1 on wkentaro:camera_mesh** into **1d1d76711c2179357c7acfa454390b72a99600de on mikedh:master**.\n"}}
{"actor":{"display_login":"coveralls"}}