Title: Following rays along the way of their multiple intersections · Issue #41 · rnd-team-dev/plotoptix · GitHub
Open Graph Title: Following rays along the way of their multiple intersections · Issue #41 · rnd-team-dev/plotoptix
X Title: Following rays along the way of their multiple intersections · Issue #41 · rnd-team-dev/plotoptix
Description: Good day, I need to follow a ray along its path and acquire information of all its multiple intersections. To this end, I'm considering the following example involving the scattering from a corner reflector: import numpy as np from ploto...
Open Graph Description: Good day, I need to follow a ray along its path and acquire information of all its multiple intersections. To this end, I'm considering the following example involving the scattering from a corner ...
X Description: Good day, I need to follow a ray along its path and acquire information of all its multiple intersections. To this end, I'm considering the following example involving the scattering from a cor...
Opengraph URL: https://github.com/rnd-team-dev/plotoptix/issues/41
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Following rays along the way of their multiple intersections","articleBody":"Good day,\r\nI need to follow a ray along its path and acquire information of all its multiple intersections. To this end, I'm considering the following example involving the scattering from a corner reflector:\r\n\r\n```\r\nimport numpy as np\r\nfrom plotoptix import TkOptiX\r\nfrom plotoptix import NpOptiX\r\nimport matplotlib.pyplot as plt\r\n\r\nnu = 7\r\nnv = 7\r\n \r\ndef displayResults(rt):\r\n\r\n print(\"Launch finished.\")\r\n\r\n hitPositionsData = rt._hit_pos\r\n xHitPositions = hitPositionsData[:, :, 0]\r\n yHitPositions = hitPositionsData[:, :, 1]\r\n zHitPositions = hitPositionsData[:, :, 2]\r\n dHitPositions = hitPositionsData[:, :, 3]\r\n\r\n hitTriangle = rt._geo_id[:, :, 1].reshape(rt._height, rt._width)\r\n\r\n print(\"Shape of rays array is {}.\".format(xHitPositions.shape))\r\n\r\n xHitPositions = xHitPositions[hitTriangle \u003c 0xFFFFFFFF]\r\n yHitPositions = yHitPositions[hitTriangle \u003c 0xFFFFFFFF]\r\n dHitPositions[np.where(hitTriangle \u003e= 0xFFFFFFFF)] = -1\r\n hitTriangle[np.where(hitTriangle \u003e= 0xFFFFFFFF)] = 10\r\n\r\n print(dHitPositions)\r\n \r\n print(\"Shape of hitting rays array is {}.\".format(xHitPositions.shape))\r\n\r\n plt.plot(xHitPositions, yHitPositions, 'bo')\r\n plt.show()\r\n\r\n plt.imshow(dHitPositions)\r\n plt.colorbar()\r\n plt.show()\r\n\r\n plt.imshow(hitTriangle)\r\n plt.colorbar()\r\n plt.show()\r\n\r\n plt.draw()\r\n\r\n\r\n#verticesTriangle = np.array([[-2, -2, 0], [2, -2, 0], [-2, 2, 0], [2, 2, 0]])\r\n#faceTriangle = np.array([[0, 1, 2], [1, 2, 3]])\r\n#verticesTriangles = np.array([[-1, -1, 0], [1, -1, 0], [-1, 1, 0], [1, 1, 0], [-1, 1, 2], [1, 1, 2]])\r\n#faceTriangles = np.array([[0, 1, 2], [1, 2, 3], [2, 3, 4], [3, 4, 5]])\r\nverticesTriangles = np.array([[0, 1, 0], [0, -1, 0], [0.5 * np.sqrt(2), 1, 0.5 * np.sqrt(2)], [0.5 * np.sqrt(2), -1, 0.5 * np.sqrt(2)], [-0.5 * np.sqrt(2), 1, 0.5 * np.sqrt(2)], [-0.5 * np.sqrt(2), -1, 0.5 * np.sqrt(2)]])\r\nfaceTriangles = np.array([[0, 1, 2], [1, 2, 3], [0, 1, 4], [1, 4, 5]])\r\n\r\nrt = NpOptiX(on_rt_accum_done = displayResults, width = nu, height = nv)\r\n#rt = NpOptiX(width = nu, height = nv)\r\n\r\nrt.set_mesh(\"Mesh\", verticesTriangles, faceTriangles)\r\n\r\nu = np.linspace(-1.9, 2.1, nu)\r\nv = np.linspace(-2, 2, nv)\r\nV, U = np.meshgrid(v, u)\r\nW = np.full((nu, nv), -1)\r\noriginsTexture = np.stack((U, V, W, np.zeros((nu, nv)))).T\r\n\r\nrt.set_texture_2d(\"origins\", originsTexture)\r\n \r\ncx = np.zeros((nu, nv))\r\ncy = np.zeros((nu, nv))\r\ncz = np.ones((nu, nv))\r\nr = np.full((nu, nv), 200)\r\ndirectionsTexture = np.stack((cx, cy, cz, r)).T\r\n\r\nrt.set_texture_2d(\"directions\", directionsTexture)\r\n \r\nrt.setup_camera(\"custom_cam\", cam_type = \"CustomProjXYZtoDir\", textures = [\"origins\", \"directions\"])\r\n\r\nrt.set_param(max_accumulation_frames = 1)\r\n\r\nrt.set_uint(\"path_seg_range\", 1, 4)\r\n\r\nrt.start()\r\n\r\n#rt.close()\r\n```\r\n\r\nI have the following questions:\r\n\r\n1) I'm setting `path_seg_range` to enable multiple reflections. However, it seems the line does not have an effect. If I comment it out, the results seem to be the same.\r\n2) I access the hit positions and hit distances by the `rt._hit_pos` array. However, for my purposes, I need to know all the hit positions and distances _per ray_. Is that possible by PlotOptiX?","author":{"url":"https://github.com/vitalitylearning2021","@type":"Person","name":"vitalitylearning2021"},"datePublished":"2023-02-08T18:29:40.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/41/plotoptix/issues/41"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:aeaeb94f-6647-d4f9-112a-a3963c0b8b7e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D49A:147F26:CADC47:118CE0F:6A4BE0F1 |
| html-safe-nonce | 610c7071bf5cff23e82ee68bce3e6ccc6febc0b02ec7df1a8f09361efa0b1a42 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENDlBOjE0N0YyNjpDQURDNDc6MTE4Q0UwRjo2QTRCRTBGMSIsInZpc2l0b3JfaWQiOiIyMzg0ODIxOTY5NDcyNjM3MzAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 6e59c6825fb20e4f007e4a598ea12e82ada487b82e25716147fc518a7235a006 |
| hovercard-subject-tag | issue:1576605594 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/rnd-team-dev/plotoptix/41/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bd8866d2f71818415ab121a85dfc8244912bcc94da3d971d92b2a25a9f2a0753/rnd-team-dev/plotoptix/issues/41 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bd8866d2f71818415ab121a85dfc8244912bcc94da3d971d92b2a25a9f2a0753/rnd-team-dev/plotoptix/issues/41 |
| og:image:alt | Good day, I need to follow a ray along its path and acquire information of all its multiple intersections. To this end, I'm considering the following example involving the scattering from a corner ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vitalitylearning2021 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0f5d3ba365b3985d75c32a5957c8635488d58dcf027ae6ae958eee7edaa306a2 |
| turbo-cache-control | no-preview |
| go-import | github.com/rnd-team-dev/plotoptix git https://github.com/rnd-team-dev/plotoptix.git |
| octolytics-dimension-user_id | 49209042 |
| octolytics-dimension-user_login | rnd-team-dev |
| octolytics-dimension-repository_id | 177851202 |
| octolytics-dimension-repository_nwo | rnd-team-dev/plotoptix |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 177851202 |
| octolytics-dimension-repository_network_root_nwo | rnd-team-dev/plotoptix |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 253920ac2dc35b0849cca4633895f1f2e5f03051 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width