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),
80 #define HANDLE_ERROR( err ) (HandleError( err, __FILE__, __LINE__ )) 83 #define HANDLE_NULL( a ) {if (a == NULL) { \ 84 printf( "Host memory failed in %s at line %d\n", \ 85 __FILE__, __LINE__ ); \ 86 exit( EXIT_FAILURE );}} 113 const vec3 &scale_factor,
115 const ivec2 &pixel_number,
117 const vec2 &pixel_pitch,
124 this->scale_X = scale_factor[
_X];
125 this->scale_Y = scale_factor[
_Y];
126 this->scale_Z = scale_factor[
_Z];
130 this->pn_X = pixel_number[
_X];
131 this->pn_Y = pixel_number[
_Y];
134 this->offset_X = offset[
_X];
135 this->offset_Y = offset[
_Y];
138 this->pp_X = pixel_pitch[
_X];
139 this->pp_Y = pixel_pitch[
_Y];
142 this->half_ss_X = ss[
_X] / 2;
143 this->half_ss_Y = ss[
_Y] / 2;
158 const vec3 &scale_factor,
160 const ivec2 &pixel_number,
162 const vec2 &pixel_pitch,
169 double tx =
lambda / (2 * pixel_pitch[
_X]);
170 double ty =
lambda / (2 * pixel_pitch[
_Y]);
172 this->det_tx = tx / sqrt(1 - tx * tx);
173 this->det_ty = ty / sqrt(1 - ty * ty);
182 this->det_tx = tx / sqrt(1 - tx * tx);
183 this->det_ty = ty / sqrt(1 - ty * ty);
195 const vec3 &scale_factor,
197 const ivec2 &pixel_number,
199 const vec2 &pixel_pitch,
206 this->tx =
lambda / (2 * pixel_pitch[
_X]);
207 this->ty =
lambda / (2 * pixel_pitch[
_Y]);
222 const int& nBlocks,
const int& nThreads,
Vertex* cuda_vertex_data, cuDoubleComplex* cuda_dst,
227 const int& nBlocks,
const int& nThreads,
Vertex* cuda_vertex_data, cuDoubleComplex* cuda_dst,
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.
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)
_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)
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.
double k
(pixel_y * ny) / 2
_CudaPointCloudConfigRS CudaPointCloudConfigRS
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)
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.
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)
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.
_CudaPointCloudConfigFresnel CudaPointCloudConfigFresnel
struct _CudaPointCloudConfig CudaPointCloudConfig