patmo141 / object_alignment

picked points and ICP alignment addon for Blender
GNU General Public License v3.0
63 stars 24 forks source link

Duplicate default cube align attempt throws ValueError #21

Closed devadk closed 5 years ago

devadk commented 5 years ago

Hi patmo, I've been using your addon for years now, i absolutely love your work. I hadn't reinstalled the addon for quite some time and was trying to figure out which Blender/ipc-alignment combo works. By the way, if you have a roadmap of todos for the addon i'd love to contribute where i can.

This may be a minor issue - but had me thinking for a while that the addon wasn't working right.

Trying to verify the addon working after install from file - i duplicated the default cube and tried to align it. Sometimes it would align to 2 surfaces and then get stuck, other times it would throw this error. Finally i figured it may have to do with too little available geometry so - Once i tried it with a torus, i wouldn't get that issue.

happened identically on 2.79b/master install as well as 2.80 release/280 branch:

2.79

Traceback (most recent call last):
  File "C:\Users\me\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\object_alignment-master\operators\icp_align.py", line 102, in execute
    M = affine_matrix_from_points(A, B, shear=False, scale=False, usesvd=True)
  File "C:\Users\me\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\object_alignment-master\functions\general.py", line 156, in affine_matrix_from_points
    raise ValueError("input arrays are of wrong shape or type")
ValueError: input arrays are of wrong shape or type

location: <unknown location>:-1

2.80

Traceback (most recent call last):
  File "C:\Users\me\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\object_alignment-b_280\operators\icp_align.py", line 102, in execute
    M = affine_matrix_from_points(A, B, shear=False, scale=False, usesvd=True)
  File "C:\Users\me\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\object_alignment-b_280\functions\general.py", line 156, in affine_matrix_from_points
    raise ValueError("input arrays are of wrong shape or type")
ValueError: input arrays are of wrong shape or type

location: <unknown location>:-1
patmo141 commented 5 years ago

It's likely that a cube with only a few vertices might not generate a list of points, especially if minimum starting distance is small. Can you show images of initial positions?

devadk commented 5 years ago

You were right! This is one of the positions that catches the error screen

whereas an increased minimum starting distance seems to have fixed it, although the ICP algorithm doesn't get the last bit of rotation. Probably due to the Target_Translation setting? minimumstartingdistance

I hadn't noticed that setting before. Now I know better... Do you have any documentation on this addon? I'd like to commit a readme.md at some point.