def drawCircle3d(center3d, axis3d, radius, color, npoints=32): axis3d.normalize() d1 = Vector.cross(axis3d, Vector([0, 0, 1])).direction() d2 = Vector.cross(axis3d, d1) glColor(*color) glBegin(GL_TRIANGLE_FAN) glVertex(*center3d._e) for i in xrange(npoints + 1): th = (i / float(npoints)) * 2 * math.pi p = center3d + (d1 * math.sin(th) + d2 * math.cos(th)) * radius glVertex(*p._e) glEnd()
def test_cross(self): v1,v2 = self.new_vector_and_copy() try: v3 = Vector.cross(v1,v2) failed = False except: failed = True self.assertEqual(failed, True)
def vectorVectorCrossProduct(self, v1, v2): return Vector.cross(v1, v2)
def rotationVectorCrossProduct(self, rotation, vec): return Vector.cross(rotation, vec)
def vectorVectorCrossProduct(self, v1, v2): return Vector.cross(Space2D.vecTo3D(v1), Space2D.vecTo3D(v2)).z