10 |
for i in range(0, len(src)): |
for i in range(0, len(src)): |
11 |
failIf(abs(dst[i]-dstlist[i]) > delta, str([srclist, dstlist, dst, i, dst[i], dstlist[i]])) |
failIf(abs(dst[i]-dstlist[i]) > delta, str([srclist, dstlist, dst, i, dst[i], dstlist[i]])) |
12 |
|
|
13 |
|
def checkInterp(c1, c2, i, fract, cs, srclist, dstlist, delta=0): |
14 |
|
src = array(srclist, 'f') |
15 |
|
dst = zeros(len(src), 'f') |
16 |
|
failUnless(c1.transformPoints3_interp(i, c2, fract, 0, cs, src, dst)) |
17 |
|
for i in range(0, len(src)): |
18 |
|
failIf(abs(dst[i]-dstlist[i]) > delta, str([srclist, dstlist, dst, i, dst[i], dstlist[i]])) |
19 |
|
|
20 |
|
|
21 |
def testTransform(): |
def testTransform(): |
22 |
c = GLVobCoorder() |
c = GLVobCoorder() |
91 |
|
|
92 |
checkInverse(c, cs_dist) |
checkInverse(c, cs_dist) |
93 |
|
|
94 |
|
interp = zeros(1000, 'i') |
95 |
|
interp[0] = 999 |
96 |
|
c1 = GLVobCoorder() |
97 |
|
c2 = GLVobCoorder() |
98 |
|
|
99 |
|
def testInterpolateTranslation(): |
100 |
|
|
101 |
|
cs_trans1 = c1.translate(0, 10, 10) |
102 |
|
cs_trans2 = c2.translate(0, 100, 20) |
103 |
|
|
104 |
|
interp[cs_trans1] = cs_trans2 |
105 |
|
checkInterp(c1, c2, interp, .5, cs_trans1, |
106 |
|
[0, 0, 0], |
107 |
|
[55, 15, 0] |
108 |
|
) |
109 |
|
|
110 |
|
def testInterpolateBuoy(): |
111 |
|
|
112 |
|
cs_anchor = c1.translate(0, 10, 0) |
113 |
|
cs_b1 = c1.buoyOnCircle(0, cs_anchor, 0, 0, 20, -20, 0, 1) |
114 |
|
|
115 |
|
checkTrans(c1, cs_b1, |
116 |
|
[0, 0, 0], |
117 |
|
[20, 0, 0], |
118 |
|
.1) |
119 |
|
|
120 |
|
cs_b2t = c2.affineCoordsys(0, 0, 200, 200, 1, 0, 0, 1) |
121 |
|
interp[cs_b1] = cs_b2t |
122 |
|
|
123 |
|
checkInterp(c1, c2, interp, .5, cs_b1, |
124 |
|
[0, 0, 0], |
125 |
|
[110, 100, 0], |
126 |
|
.1) |