Skip to content
Snippets Groups Projects
Commit e8e76717 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Fix incorrect camera transformations

parent 422f857e
No related branches found
No related tags found
1 merge request!109Resolves #173 remove voxel code
...@@ -44,8 +44,8 @@ struct __align__(16) Camera { ...@@ -44,8 +44,8 @@ struct __align__(16) Camera {
template <> __device__ template <> __device__
inline float2 ftl::rgbd::Camera::camToScreen<float2>(const float3 &pos) const { inline float2 ftl::rgbd::Camera::camToScreen<float2>(const float3 &pos) const {
return make_float2( return make_float2(
pos.x*fx/pos.z + cx, pos.x*fx/pos.z - cx,
pos.y*fy/pos.z + cy); pos.y*fy/pos.z - cy);
} }
template <> __device__ template <> __device__
...@@ -62,8 +62,8 @@ inline uint2 ftl::rgbd::Camera::camToScreen<uint2>(const float3 &pos) const { ...@@ -62,8 +62,8 @@ inline uint2 ftl::rgbd::Camera::camToScreen<uint2>(const float3 &pos) const {
__device__ __device__
inline float3 ftl::rgbd::Camera::screenToCam(uint ux, uint uy, float depth) const { inline float3 ftl::rgbd::Camera::screenToCam(uint ux, uint uy, float depth) const {
const float x = ((float)ux-cx) / fx; const float x = ((float)ux+cx) / fx;
const float y = ((float)uy-cy) / fy; const float y = ((float)uy+cy) / fy;
return make_float3(depth*x, depth*y, depth); return make_float3(depth*x, depth*y, depth);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment