Skip to content

Commit

Permalink
added returning versions for umeyama
Browse files Browse the repository at this point in the history
  • Loading branch information
amock committed Sep 12, 2024
1 parent c3bb494 commit d574bcd
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 3 deletions.
15 changes: 14 additions & 1 deletion src/rmagine_core/include/rmagine/math/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,13 @@ void umeyama_transform(
const MemoryView<unsigned int, RAM>& n_meas
);

Memory<Transform, RAM> umeyama_transform(
const MemoryView<Vector3, RAM>& ds,
const MemoryView<Vector3, RAM>& ms,
const MemoryView<Matrix3x3, RAM>& Cs,
const MemoryView<unsigned int, RAM>& n_meas
);

/**
* @brief computes the optimal transformations according to Umeyama's algorithm
* for a list of partitions [(m,d,C,N), ...]
Expand All @@ -508,8 +515,14 @@ void umeyama_transform(
MemoryView<Transform, RAM>& Ts,
const MemoryView<Vector3, RAM>& ds,
const MemoryView<Vector3, RAM>& ms,
const MemoryView<Matrix3x3, RAM>& Cs);
const MemoryView<Matrix3x3, RAM>& Cs
);

Memory<Transform, RAM> umeyama_transform(
const MemoryView<Vector3, RAM>& ds,
const MemoryView<Vector3, RAM>& ms,
const MemoryView<Matrix3x3, RAM>& Cs
);


} // namespace rmagine
Expand Down
21 changes: 21 additions & 0 deletions src/rmagine_core/src/math/math.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,17 @@ void umeyama_transform(
}
}

Memory<Transform, RAM> umeyama_transform(
const MemoryView<Vector3, RAM>& ds,
const MemoryView<Vector3, RAM>& ms,
const MemoryView<Matrix3x3, RAM>& Cs,
const MemoryView<unsigned int, RAM>& n_meas)
{
Memory<Transform, RAM> ret(ds.size());
umeyama_transform(ret, ds, ms, Cs, n_meas);
return ret;
}

void umeyama_transform(
MemoryView<Transform, RAM>& Ts,
const MemoryView<Vector3, RAM>& ds,
Expand All @@ -761,5 +772,15 @@ void umeyama_transform(
}
}

Memory<Transform, RAM> umeyama_transform(
const MemoryView<Vector3, RAM>& ds,
const MemoryView<Vector3, RAM>& ms,
const MemoryView<Matrix3x3, RAM>& Cs)
{
Memory<Transform, RAM> ret(ds.size());
umeyama_transform(ret, ds, ms, Cs);
return ret;
}


} // namespace rmagine
16 changes: 15 additions & 1 deletion src/rmagine_cuda/include/rmagine/math/math.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,13 @@ void umeyama_transform(
const MemoryView<unsigned int, VRAM_CUDA>& n_meas
);

Memory<Transform, VRAM_CUDA> umeyama_transform(
const MemoryView<Vector3, VRAM_CUDA>& ds,
const MemoryView<Vector3, VRAM_CUDA>& ms,
const MemoryView<Matrix3x3, VRAM_CUDA>& Cs,
const MemoryView<unsigned int, VRAM_CUDA>& n_meas
);

/**
* @brief computes the optimal transformations according to Umeyama's algorithm
* for a list of partitions [(m,d,C,N), ...]
Expand All @@ -593,7 +600,14 @@ void umeyama_transform(
MemoryView<Transform, VRAM_CUDA>& Ts,
const MemoryView<Vector3, VRAM_CUDA>& ds,
const MemoryView<Vector3, VRAM_CUDA>& ms,
const MemoryView<Matrix3x3, VRAM_CUDA>& Cs);
const MemoryView<Matrix3x3, VRAM_CUDA>& Cs
);

Memory<Transform, VRAM_CUDA> umeyama_transform(
const MemoryView<Vector3, VRAM_CUDA>& ds,
const MemoryView<Vector3, VRAM_CUDA>& ms,
const MemoryView<Matrix3x3, VRAM_CUDA>& Cs
);


} // namespace rmagine
Expand Down
22 changes: 21 additions & 1 deletion src/rmagine_cuda/src/math/math.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1566,6 +1566,18 @@ void umeyama_transform(
RM_CUDA_DEBUG();
}

Memory<Transform, VRAM_CUDA> umeyama_transform(
const MemoryView<Vector3, VRAM_CUDA>& ds,
const MemoryView<Vector3, VRAM_CUDA>& ms,
const MemoryView<Matrix3x3, VRAM_CUDA>& Cs,
const MemoryView<unsigned int, VRAM_CUDA>& n_meas)
{
Memory<Transform, VRAM_CUDA> ret(ds.size());
umeyama_transform(ret, ds, ms, Cs, n_meas);
return ret;
}


__global__ void umeyama_transform_kernel(
Transform* Ts,
const Vector3* ds,
Expand All @@ -1592,6 +1604,14 @@ void umeyama_transform(
RM_CUDA_DEBUG();
}


Memory<Transform, VRAM_CUDA> umeyama_transform(
const MemoryView<Vector3, VRAM_CUDA>& ds,
const MemoryView<Vector3, VRAM_CUDA>& ms,
const MemoryView<Matrix3x3, VRAM_CUDA>& Cs)
{
Memory<Transform, VRAM_CUDA> ret(ds.size());
umeyama_transform(ret, ds, ms, Cs);
return ret;
}

} // namespace rmagine

0 comments on commit d574bcd

Please sign in to comment.