Code Duplication    Length = 11-14 lines in 4 locations

ed2d/physics/gjk.py 4 locations

@@ 200-213 (lines=14) @@
197
            else:
198
                simplex.remove(b)
199
                self.direction = acd
200
        elif(abd.isInSameDirection(aO)):
201
            if(vector.cross(abd, ab).isInSameDirection(aO)):
202
                simplex.remove(b)
203
                simplex.remove(d)
204
                self.direction = vector.cross(vector.cross(ab, aO), ab)
205
            elif(vector.cross(ab, abd).isInSameDirection(aO)):
206
                simplex.remove(b)
207
                simplex.remove(c)
208
                self.direction = vector.cross(vector.cross(ad, aO), ad)
209
            else:
210
                simplex.remove(c)
211
                self.direction = abd
212
        else:
213
            return True
214
        return False
215
216
@@ 142-154 (lines=13) @@
139
                    simplex.remove(c)
140
                    self.direction = aO
141
        else:
142
            if (abNormal.isInSameDirection(aO)):
143
                if(ab.isInSameDirection(aO)):
144
                    simplex.remove(c)
145
                    self.direction = vector.cross(vector.cross(ab, aO), ab)
146
                else:
147
                    simplex.remove(b)
148
                    simplex.remove(c)
149
                    self.direction = aO
150
            else:
151
                if(abc.isInSameDirection(aO)):
152
                    self.direction = vector.cross(vector.cross(abc, aO), abc)
153
                else:
154
                    self.direction = vector.cross(vector.cross(-abc, aO), -abc)
155
        return False
156
157
    def processTetrehedron(self, simplex):
@@ 189-199 (lines=11) @@
186
                simplex.remove(d)
187
                self.direction = abc
188
        elif (acd.isInSameDirection(aO)):
189
            if (vector.cross(acd, ad).isInSameDirection(aO)):
190
                simplex.remove(b)
191
                simplex.remove(c)
192
                self.direction = vector.cross(vector.cross(ad, aO), ad)
193
            elif(vector.cross(ac, acd).isInSameDirection(aO)):
194
                simplex.remove(b)
195
                simplex.remove(d)
196
                self.direction = vector.cross(vector.cross(ac, aO), ac)
197
            else:
198
                simplex.remove(b)
199
                self.direction = acd
200
        elif(abd.isInSameDirection(aO)):
201
            if(vector.cross(abd, ab).isInSameDirection(aO)):
202
                simplex.remove(b)
@@ 177-187 (lines=11) @@
174
        aO = -a
175
176
        if (abc.isInSameDirection(aO)):
177
            if (vector.cross(abc, ac).isInSameDirection(aO)):
178
                simplex.remove(b)
179
                simplex.remove(d)
180
                self.direction = vector.cross(vector.cross(ac, aO), ac)
181
            elif(vector.cross(ab, abc).isInSameDirection(aO)):
182
                simplex.remove(c)
183
                simplex.remove(d)
184
                self.direction = vector.cross(vector.cross(ab, aO), ab)
185
            else:
186
                simplex.remove(d)
187
                self.direction = abc
188
        elif (acd.isInSameDirection(aO)):
189
            if (vector.cross(acd, ad).isInSameDirection(aO)):
190
                simplex.remove(b)