Skip to content

Commit

Permalink
update gitignore and improve comments for generating bounding box images
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeroberts3000 committed Aug 25, 2021
1 parent 900e8fe commit 37dd335
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
__pycache__
code/cpp/system_config.inc
code/cpp/bin
code/python/_system_config.py
code/python/tools/libcgauth.dylib
code/python/tools/libvray.dylib
code/python/tools/libvrayopenimageio.dylib
code/python/tools/libvrayosl.dylib
code/python/tools/libVRaySDKLibrary.dylib
code/python/tools/plugins
5 changes: 4 additions & 1 deletion code/python/tools/scene_generate_images_bounding_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,16 @@ def generate_fragment(p1_obj, p2_obj, n_obj, color):
fragments_p1_screen.append(p1_screen.A1)
fragments_p2_screen.append(p2_screen.A1)
fragments_color.append(color)

def generate_fragments_for_line(p1_obj, p2_obj, n_obj, color):
p1_screen, p1_ndc, p1_clip, p1_cam, p1_world = transform_point_screen_from_obj(p1_obj)
p2_screen, p2_ndc, p2_clip, p2_cam, p2_world = transform_point_screen_from_obj(p2_obj)
p1_inside_frustum = all(p1_ndc == clip(p1_ndc,-1,1))
p2_inside_frustum = all(p2_ndc == clip(p2_ndc,-1,1))

# strictly speaking this frustum culling test is incorrect, because it will discard lines
# that pass through the frustum but whose endpoints are both outside the frustum; but this
# is a rare case, and frustum culling in this way is a lot faster, so we do it anyway
if p1_inside_frustum or p2_inside_frustum:
num_pixels_per_line = linalg.norm(p2_screen - p1_screen)
num_fragments_per_line = int(ceil(num_pixels_per_line*num_fragments_per_pixel))
Expand Down

0 comments on commit 37dd335

Please sign in to comment.