Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is there any additional documentation available for how the `robomath.fitPlane()` method works?

1. What inputs does fitPlane expect? From the source code, it looks like it accepts anything array-like. However, it is not clear what dimensions it is looking for. (I expect one of the dimensions will need to be 3 but I am not sure which.)
2. What do the outputs mean? The source code shows `pplane` and `vplane` as outputs, but it is not clear what those are. The source code seems to indicate that the latter is a plane equation such that `b(1)*X + b(2)*Y +b(3)*Z + b(4) = 0`, but the meaning of the other output is not clear.
3. To test what this method returns, I attempted to call it with the 3x3 identity list of lists: `fitPlane([[1,0,0], [0,1,0], [0,0,1]])`.
However, I get an exception: `IndexError: index 3 is out of bounds for axis 0 with size 3`.
The exception occurs on line 1057: `B = v[3, :]  # Solution is last column of v`.
What is the issue with that call?
Okay, here is a specific unexpected behavior that I was able to reproduce with points on the Z=100 plane. Since all points are contained in the Z=100 plane, I would expect the normal vector to be the Z axis.

A set of points, all with Z coordinate 100 and other coordinates small: behaving as-expected
`robomath.fitPlane([ [1,0,100], [0,1,100], [2,0,100], [0,2,100] ])` --> normal of `[0,0,1]`

A set of points, all with Z coordinate 100 and other coordinates more random: not behaving as-expected
`robomath.fitPlane([ [57, 37, 100], [34, 37, 100], [11, 37, 100], [-11, 37, 100] ])` --> normal of `[0, 1, -0]`

What's going on here?
Update: I figured out what was going on.

All my points in the second set are along [x, 37, 100]. Here's a better example that still causes weird behavior:
`pts = [[57, 37, 100], [34, 37, 100], [11, -37, 100], [-11, 38, 100]]`

Using the modified set above, we still see weird results. This is because the numpy SVD method expects the points to be centered around 0. See this Stack Overflow answer:

Users browsing this thread:
1 Guest(s)