Dot product error?

Dot product error?

mcw0
Advisor Advisor
1,283 Views
7 Replies
Message 1 of 8

Dot product error?

mcw0
Advisor
Advisor

I'm comparing the 3 vectors.  I want to know how closely 2 vectors match the first.  But my dot values are 0!  Please, what did I do wrong?  This has to work today.  😓

dot_error.png

Accepted solutions (1)
1,284 Views
7 Replies
Replies (7)
Message 2 of 8

mcw0
Advisor
Advisor

As an experiment, I created new vectors and the dot product worked.  But as soon as I plug in my earlier normalized vectors to the new dot node, I get a zero.  All input types are the same, Math::float3.  What's going on?

dot_01.png

0 Likes
Message 3 of 8

morten.bojsen-hansen
Autodesk
Autodesk

Please check what the watchpoint (to print_array1) is saying.

Message 4 of 8

mcw0
Advisor
Advisor

dot_wpt.png

So the print_array is returning incorrect values?  But only on some and not all?  How do I fix this?  I need to see the values to debug my graph.  If I have to resort to the watchpoint...OUCH!

0 Likes
Message 5 of 8

Grahame_Fuller
Autodesk
Autodesk

It looks like the final result (0.77) is correct but for some reason the first print_array node is showing an incorrect value for index 4. The result of normalizing (1, 0, 10) is (0.0995037, 0, 0.995037) not (.1, 0, 0) but if that incorrect value had actually been used for the dot product then the result would have been 0.071 not 0.77.

 

gray


Grahame Fuller
Learning Content Developer
Message 6 of 8

mcw0
Advisor
Advisor

Good catch!  I missed that.  So bottom line, I can't rely on the print_array results.

0 Likes
Message 7 of 8

Roland.Reyer
Alumni
Alumni

Please get the latest version of the PRINT_PACK.

There was a bug in the display of min/max.

 

Also, print_table is the better choice if you need to compare arrays.

 

RolandReyer_0-1676533023424.png

 

Message 8 of 8

Roland.Reyer
Alumni
Alumni
Accepted solution

When the floats are converted to string I truncate the decimal places to a number that you can set in the print node.

When you set "Float Precision" to 10.000 you would see 5 decimal places.