Re: [script] Comparing two transforms

Date : Fri, 12 Jan 2007 20:01:25 -0500
To : XSI(at)Softimage.COM
From : François Painchaud <francois.painchaud(at)sympatico.ca>
Subject : Re: [script] Comparing two transforms
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

Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.