Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small matrix calc speedup in collision_distance_field_types #666

Merged
merged 4 commits into from
Oct 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ class PosedDistanceField : public distance_field::PropagationDistanceField
double getDistanceGradient(double x, double y, double z, double& gradient_x, double& gradient_y, double& gradient_z,
bool& in_bounds) const
{
Eigen::Vector3d rel_pos = pose_.inverse() * Eigen::Vector3d(x, y, z);
// Transpose of a rotation matrix equals its inverse, but computationally cheaper
Eigen::Vector3d rel_pos = pose_.linear().transpose() * Eigen::Vector3d(x, y, z);
double gx, gy, gz;
double res = distance_field::PropagationDistanceField::getDistanceGradient(rel_pos.x(), rel_pos.y(), rel_pos.z(),
gx, gy, gz, in_bounds);
Expand Down