-
Notifications
You must be signed in to change notification settings - Fork 25
Add new primitive: TORUS 🍩 #419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
fa3fc7d
✨ Add function to solve a cubic & quartic equation
e0da6c2
✨ Add torus primitive firstly
ff9efcc
✏️ fix typo
3f4eff8
🎨 change to use descartes-euler methd
b266689
🎨 alter solvers for cubic and quartic
bd9e062
🐛 fix bug code
b1842c6
🎨 add sorting function
16ab94a
🎨 add torus class to __init__ file
7ff6788
💩 🎨 improve code and some bugs remain
efe111d
🐛 Fix ray-torus interection implementation
6143bdc
✨ add demo script using a torus primitive
3019130
🩹 fix spectral rays in camera settings
893c4eb
🎨 ✏️ Fix formatting and typos in utility.pyx and torus.pyx
45f63d5
🐛 Fix intersection caching and indexing in Torus class
munechika-koyo 052718c
Update documentation to include Parabola and Torus in geometric primi…
munechika-koyo 28e605d
Add demo script for raysect geometric primitives.
munechika-koyo 4c5c481
Update raysect_primitives.png image for including all geometric primi…
munechika-koyo b46559a
move raysect_primitives.py to demos/primitives
munechika-koyo e30c18f
Merge branch 'raysect:master' into feature/torus
munechika-koyo 3453be6
Merge branch 'development' into feature/torus
munechika-koyo def00d1
Merge branch 'development' into feature/torus
munechika-koyo 22aa40c
Add torus.pyx and torus.pxd to source files in meson.build
munechika-koyo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| from matplotlib import pyplot as plt | ||
|
|
||
| from raysect.optical import ConstantSF, Point3D, World, d65_white, rotate, translate | ||
| from raysect.optical.library.metal import Copper | ||
| from raysect.optical.material import Lambert, UniformSurfaceEmitter | ||
| from raysect.optical.observer import PinholeCamera, RGBAdaptiveSampler2D, RGBPipeline2D | ||
| from raysect.primitive import Box, Cylinder, Torus | ||
|
|
||
| world = World() | ||
|
|
||
| # Torus | ||
| torus = Torus( | ||
| 1.0, | ||
| 0.5, | ||
| world, | ||
| transform=translate(0, 0.0, 0.6), | ||
| material=Copper(), | ||
| ) | ||
|
|
||
| # floor | ||
| Box( | ||
| Point3D(-100, -100, -10), | ||
| Point3D(100, 100, 0), | ||
| parent=world, | ||
| material=Lambert(ConstantSF(1.0)), | ||
| ) | ||
|
|
||
| # emitter | ||
| Cylinder( | ||
| 3.0, | ||
| 100.0, | ||
| parent=world, | ||
| transform=translate(0, 0, 8) * rotate(90, 0, 0) * translate(0, 0, -50), | ||
| material=UniformSurfaceEmitter(d65_white, 1.0), | ||
| ) | ||
|
|
||
| # camera | ||
| rgb = RGBPipeline2D(display_unsaturated_fraction=0.995) | ||
| sampler = RGBAdaptiveSampler2D(rgb, min_samples=500, fraction=0.1, cutoff=0.01) | ||
| camera = PinholeCamera( | ||
| (512, 512), | ||
| parent=world, | ||
| transform=rotate(0, 45, 0) * translate(0, 0, 5) * rotate(0, -180, 0), | ||
| pipelines=[rgb], | ||
| frame_sampler=sampler, | ||
| ) | ||
| camera.spectral_bins = 21 | ||
| camera.spectral_rays = 21 | ||
| camera.pixel_samples = 250 | ||
| camera.ray_max_depth = 10000 | ||
| camera.ray_extinction_min_depth = 3 | ||
| camera.ray_extinction_prob = 0.01 | ||
|
|
||
|
|
||
| # start ray tracing | ||
| plt.ion() | ||
| for p in range(0, 1000): | ||
| print(f"Rendering pass {p}...") | ||
| camera.observe() | ||
| print() | ||
|
|
||
| plt.ioff() | ||
| rgb.display() | ||
| plt.show() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.