Le 2007-01-12 18:26, Joe Laffey a écrit :
On Fri, 12 Jan 2007, Bernard Lebel wrote:
def compare4( oT1, oT2, oMatrixA, oMatrixB ):
for i in range(0, 4):
for j in range(0, 4):
if abs( oMatrixA.Value(i, j) - oMatrixB.Value(i,j) ) <
0.0001:
return False
return True
Now if your are REALLY trying to make things fast, for something so
short as 16 elements you could easily unroll the loops into a series of
if statements like in the other functions. This avoids the (very
slight) overhead of setting up the loop, and reading from / writing to
the iterator variables...
Excellent suggestion! This way, you can order the "if" statements to
first test the values that will most likely change in your homogeneous
matrix: the 3 (or 4) translation values, then the 6 rotation/scaling
values, then the rest.
François
|