Skip to content

Commit c3cd9fa

Browse files
committed
simplify camera vectors for rectangular camera
1 parent cd40b51 commit c3cd9fa

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

include_rt_kernels/raytracer_kernels_bw.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ struct Camera
6969
if (camera.cam_type != 0)
7070
{
7171
const Vector<Float> dir_tmp = {1, 0, 0};
72+
const Vector<Float> dir_up = {0, 0, 1};
73+
7274
const Vector<Float> dir_cam = normalize(Vector<Float>({dot(camera.mx,dir_tmp), dot(camera.my,dir_tmp), dot(camera.mz,dir_tmp)}));
73-
const Vector<Float> dir_up_tmp = {0, 0, 1};
74-
const Vector<Float> dir_up = normalize(Vector<Float>({dot(camera.mx,dir_up_tmp), dot(camera.my,dir_up_tmp), dot(camera.mz,dir_up_tmp)}));
7575

76+
cam_height = normalize(Vector<Float>({dot(camera.mx, dir_up), dot(camera.my,dir_up), dot(camera.mz,dir_up)}));
7677
cam_width = Float(-1) * normalize(cross(dir_cam, dir_up));
77-
cam_height = normalize(cross(dir_cam, cam_width));
7878
cam_depth = dir_cam / tan(fov/Float(180)*M_PI/Float(2.));
7979

8080
if (camera.nx > camera.ny)

python/image_from_xyz.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@
7272

7373
# reshape RGB array
7474
RGB = RGB.reshape((3, ny, nx))
75-
RGB = RGB.swapaxes(0,2).swapaxes(0,1)[::-1,:]
76-
75+
RGB = RGB.swapaxes(0,2).swapaxes(0,1)[:,:]
76+
7777
# plot
7878
fig,ax = pl.subplots(figsize=(nx/args.dpi, ny/args.dpi), frameon=False)
7979
ax.grid(False)

0 commit comments

Comments
 (0)