Skip to content
Snippets Groups Projects
Commit ce93ac14 authored by BATON Theau's avatar BATON Theau
Browse files

Correct linear curve GPU sided

parent 902f8338
No related branches found
No related tags found
No related merge requests found
......@@ -10,21 +10,32 @@ namespace ct::gpu {
: StreamedGenerator() {}
__host__ Point LinearGenerator::generate(const thrust::universal_vector<Point> & ctrlPoint, const float t) const {
if(ctrlPoint.empty()) {
return Point(0.0);
}
size_t max_size = ctrlPoint.size();
if(max_size == 1) {
return Point(ctrlPoint[0].x, ctrlPoint[0].y, ctrlPoint[0].z);
}
float range = 1.f/static_cast<float>(max_size);
size_t current = 0;
for(float i = 0.f; i <= t; i += range) {
for(float i = 0.f; i < t; i += range) {
++current;
}
if(current == max_size) {
--current;
if(current == 0) {
++current;
}
if(current >= max_size) {
current = max_size-1;
}
Point p1 = ctrlPoint[current];
Point p2 = ctrlPoint[current+1];
Point p1 = ctrlPoint[current-1];
Point p2 = ctrlPoint[current];
Point r, * d_r;
cudaMalloc(&d_r, sizeof(Point));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment