53 #ifndef __ophPointCloud_GPU_h 54 #define __ophPointCloud_GPU_h 58 #define __DEBUG_LOG_GPU_SPEC_ 61 #include <cuda_runtime_api.h> 62 #include <cuComplex.h> 64 #define __CUDA_INTERNAL_COMPILATION__ //for CUDA Math Module 65 #include <math_constants.h> 67 #include <vector_functions.h> 68 #undef __CUDA_INTERNAL_COMPILATION__ 70 #define OPH_CUDA_N_STREAM 100 71 static void HandleError(cudaError_t err,
74 if (err != cudaSuccess) {
75 printf(
"%s in %s at line %d\n", cudaGetErrorString(err),
81 #define HANDLE_ERROR( err ) (HandleError( err, __FILE__, __LINE__ )) 84 #define HANDLE_NULL( a ) {if (a == NULL) { \ 85 printf( "Host memory failed in %s at line %d\n", \ 86 __FILE__, __LINE__ ); \ 87 exit( EXIT_FAILURE );}} 114 const vec3 &scale_factor,
116 const ivec2 &pixel_number,
118 const vec2 &pixel_pitch,
125 this->scale_X = scale_factor[
_X];
126 this->scale_Y = scale_factor[
_Y];
127 this->scale_Z = scale_factor[
_Z];
131 this->pn_X = pixel_number[
_X];
132 this->pn_Y = pixel_number[
_Y];
135 this->offset_X = offset[
_X];
136 this->offset_Y = offset[
_Y];
139 this->pp_X = pixel_pitch[
_X];
140 this->pp_Y = pixel_pitch[
_Y];
143 this->half_ss_X = ss[
_X] / 2;
144 this->half_ss_Y = ss[
_Y] / 2;
159 const vec3 &scale_factor,
161 const ivec2 &pixel_number,
163 const vec2 &pixel_pitch,
170 double tx =
lambda / (2 * pixel_pitch[
_X]);
171 double ty =
lambda / (2 * pixel_pitch[
_Y]);
173 this->det_tx = tx / sqrt(1 - tx * tx);
174 this->det_ty = ty / sqrt(1 - ty * ty);
183 this->det_tx = tx / sqrt(1 - tx * tx);
184 this->det_ty = ty / sqrt(1 - ty * ty);
196 const vec3 &scale_factor,
198 const ivec2 &pixel_number,
200 const vec2 &pixel_pitch,
207 this->tx =
lambda / (2 * pixel_pitch[
_X]);
208 this->ty =
lambda / (2 * pixel_pitch[
_Y]);
223 const int& nBlocks,
const int& nThreads, cuDoubleComplex* dst, cuDoubleComplex* src,
int size
226 const int& nBlocks,
const int& nThreads,
Vertex* cuda_vertex_data, cuDoubleComplex* cuda_dst,
231 const int& nBlocks,
const int& nThreads,
Vertex* cuda_vertex_data, cuDoubleComplex* cuda_dst,
void cudaPointCloud_Fresnel(const int &nBlocks, const int &nThreads, Vertex *cuda_vertex_data, cuDoubleComplex *cuda_dst, const CudaPointCloudConfigFresnel *cuda_config, const uint &iColor, const uint &mode)
double lambda
Wave Number = (2 * PI) / lambda;.
_CudaPointCloudConfigRS(_CudaPointCloudConfig &cuda_config)
double pp_Y
Pixel pitch of SLM in x direction.
double ty
tx = lambda / (2 * pp_X)
double scale_Y
Scaling factor of x coordinate of point cloud.
_CudaPointCloudConfig(const int &n_points, const vec3 &scale_factor, const Real &offset_depth, const ivec2 &pixel_number, const ivec2 &offset, const vec2 &pixel_pitch, const vec2 &ss, const Real &k, const Real &lambda)
struct _CudaPointCloudConfig CudaPointCloudConfig
structure for 2-dimensional integer vector and its arithmetic.
double half_ss_Y
(pixel_x * nx) / 2
_CudaPointCloudConfigRS(const int &n_points, const vec3 &scale_factor, const Real &offset_depth, const ivec2 &pixel_number, const ivec2 &offset, const vec2 &pixel_pitch, const vec2 &ss, const Real &k, const Real &lambda)
ty / sqrt(1 - ty^2), ty = lambda / (2 * pp_Y)
int pn_X
Offset value of point cloud in z direction.
_CudaPointCloudConfigRS CudaPointCloudConfigRS
double k
(pixel_y * ny) / 2
double offset_depth
Scaling factor of z coordinate of point cloud.
structure for 2-dimensional Real type vector and its arithmetic.
int offset_X
Number of pixel of SLM in y direction.
_CudaPointCloudConfigFresnel CudaPointCloudConfigFresnel
double scale_Z
Scaling factor of y coordinate of point cloud.
structure for 3-dimensional Real type vector and its arithmetic.
_CudaPointCloudConfigFresnel(const int &n_points, const vec3 &scale_factor, const Real &offset_depth, const ivec2 &pixel_number, const ivec2 &offset, const vec2 &pixel_pitch, const vec2 &ss, const Real &k, const Real &lambda)
ty = lambda / (2 * pp_Y)
double det_ty
tx / sqrt(1 - tx^2), tx = lambda / (2 * pp_X)
_CudaPointCloudConfigFresnel(_CudaPointCloudConfig &cuda_config)
void sum_Kernel(const int &nBlocks, const int &nThreads, cuDoubleComplex *dst, cuDoubleComplex *src, int size)
double scale_X
number of point cloud
double half_ss_X
Pixel pitch of SLM in y direction.
int pn_Y
Number of pixel of SLM in x direction.
void cudaPointCloud_RS(const int &nBlocks, const int &nThreads, Vertex *cuda_vertex_data, cuDoubleComplex *cuda_dst, const CudaPointCloudConfigRS *cuda_config, const uint &iColor, const uint &mode)