strayrobots / 3d-annotation-tool

A graphical user interface to annotate point clouds and 3D data.
MIT License
76 stars 8 forks source link

Rotate bbox #23

Closed hietalajulius closed 3 years ago

hietalajulius commented 3 years ago

https://user-images.githubusercontent.com/4254623/124757126-f31da880-df35-11eb-8fb7-4b0b6a918673.mp4

Works reasonably well, making the disk mesh more dense could maybe help with the raytracing perf, currently it's a bit unstable if there are many meshes on top of each other -> unexpected behavior

hietalajulius commented 3 years ago

What is going on at the end of the video?

Looks good . Doesn't seem like the rotation logic is quite correct yet though. Sometimes rotates in the wrong direction, sometimes around the wrong axis.

Looks like it was due to angles being nans, added checking for those. Also the logic for prioritizing ray trace hits was not great, made it now so that the closest hit to camera "counts".

The logic for the direction is as follows: First drag: if the dot product between the rotation axis and the cross product of initial click point and drag point is positive, then the direction is positive. Following drags: if dot product between the cross product of previous initial drag point and previous current drag point and cross product of current initial drag point and current current drag point is negative, then the direction changed from previous drag.

EDIT: after sleeping on it, the first drag logic should apply for consecutive drags as well, I'll simplify

Imo works a bit better now, let me know if it still does not work well enough :D

https://user-images.githubusercontent.com/4254623/124820476-3992f780-df76-11eb-9a85-3af004cc06cc.mp4