Hi @mogh I'm not able to reproduce our issue, here it's reliable, would it be possible to share with us a scene?
Just in case the __eq__ is the magic method for the == operator, so you could use obj.GetMg() == obj.GetUp().GetMg()
EDIT: After checking internal code, the == operator of Matrix, use the == operator of the Vector which then use the == operator of the C++ double. But due to Floating Point Issue this operation could fail.
So the best way to compare a Matrix is to manually check for each Vector component like so:
import c4d
import math
def compare_vec(v1, v2, eps=1e-5):
values_to_compare = [(v1.x, v2.x), (v1.y, v2.y), (v1.z, v2.z)]
for value_v1, value_v2 in values_to_compare:
if not math.isclose(value_v1, value_v2, rel_tol=eps):
return False
return True
def compare_matrix(m1, m2, eps=1e-5):
values_to_compare = [(m1.v1, m2.v1), (m1.v2, m2.v2), (m1.v3, m2.v3), (m1.off, m2.off)]
for value_m1, value_m2 in values_to_compare:
if not compare_vec(value_m1,value_m2, eps):
return False
return True
def main():
print(compare_matrix(op.GetMg(), op.GetUp().GetMg()))
# Execute main()
if __name__=='__main__':
main()
Documentation will be improved in this regards.
Cheers,
Maxime.