Ejemplo n.º 1
0
	def rot(self, cen, ang):
		"""Returns this point rotated around a center a given number of cw revolutions."""
	
		if abs(ang) < 0.000001:
			return copy.copy(self)
		a = util.rev2rad(ang) #Convert to ccw radians
		h = cen.dist_to(self) #Radius of circle
		b = util.rev2rad(cen.ang_to(self))
		return Point(h*math.cos(a+b)+cen[0], -1*h*math.sin(a+b)+cen[1])
Ejemplo n.º 2
0
    def _set_ode_ang(self, odething):
        """Sets the angle in an ODE object (body or geom) from the GameObj's angle.
		
		Converts from GameObj angles (cw revolutions) to ODE angles (ccw radians).
		"""
        a = util.rev2rad(self._ang)
        s = math.sin(a)
        c = math.cos(a)
        rotmatr = (c, s, 0.0, -s, c, 0.0, 0.0, 0.0, 1.0)
        odething.setRotation(rotmatr)