ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Okay, if I can summarise what you've said to make sure I understand it properly. The input to your process is a vector defined by it's start and end points. From this information you want to generate a set of vectors parallel to this input vector but spaced in a square grid formation if viewed along the direction of the input vector. Is this correct?
As you've found the main challenge here is finding the two direction vectors which are orthogonal to the input vector, when you have these you can easily create the sets of start and end points you want.
If I've understood the problem correctly then it's not fully defined, the rotation of the square grids around the input vector is not determined. So the solution I'm about to describe assumes any rotation is acceptable.
The tool we're going to use is the vector cross product, if you calculate this product for any non-parallel vectors the result will be a vector orthogonal to both input vectors with a length which is the scalar produce of the lengths of the two input vectors. This is available to you in the tf::Vector3::Cross method.
You can now use the two orthogonal direction vectors along with the original start and end points to create the grid of vectors you need. Hope this helps you get this working.
2 | No.2 Revision |
Okay, if I can summarise what you've said to make sure I understand it properly. The input to your process is a vector defined by it's start and end points. From this information you want to generate a set of vectors parallel to this input vector but spaced in a square grid formation if viewed along the direction of the input vector. Is this correct?
As you've found the main challenge here is finding the two direction vectors which are orthogonal to the input vector, when you have these you can easily create the sets of start and end points you want.
If I've understood the problem correctly then it's not fully defined, the rotation of the square grids around the input vector is not determined. So the solution I'm about to describe assumes any rotation is acceptable.
The tool we're going to use is the vector cross product, if you calculate this product for any non-parallel vectors the result will be a vector orthogonal to both input vectors with a length which is the scalar produce of the lengths of the two input vectors. This is available to you in the tf::Vector3::Cross method.
You can now use the two orthogonal direction vectors along with the original start and end points to create the grid of vectors you need. Hope this helps you get this working.