Notifications
Clear all

[Closed] Comparison of values problem

The problem is:

  • i try to compare two .transform.row3 values
  • max prints that the values are equal
  • but when I use If statement, max prints that the values are not equal

The code:

(
 	detPoly = $Object01
 	
 	tempP = point()
 	tempP.transform = detPoly.transform
 	format "point.dir: % 
" tempP.transform.row3
 	format "face1.dir: % 
" (matrixFromNormal ( polyop.getFaceNormal detPoly 1)).row3
 	if tempP.transform.row3 != (matrixFromNormal ( polyop.getFaceNormal detPoly 1)).row3 do print "the two dir are not equal"
 )

The scene that I use is in the attachment(max2009 file).

This solved my problem, but

	if (tempP.transform.row3 as string) != ( (matrixFromNormal ( polyop.getFaceNormal detPoly 1)).row3 as string ) do print "the two dir are not equal"
 

where is my mistake?

Thank you.

2 Replies
 lo1

float values are problematic to compare.
Write your own matrix3 equality function, which either uses close_enough function or abs(a-b) < threshold

Float, float, but MAX prints them as integer.
Thank you for the suggestion.