comparison engine/python/fife/extensions/fife_math.py @ 495:ae9f5383f5b1

Added a new log module called Script. This should be used by the python modules. Did some code cleanup and comment cleanup. Added some more visible log modules to the shooter demo for fun.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Tue, 11 May 2010 21:30:55 +0000
parents e241d7553496
children c0c3f64bfc2d
comparison
equal deleted inserted replaced
494:e241d7553496 495:ae9f5383f5b1
19 # License along with this library; if not, write to the 19 # License along with this library; if not, write to the
20 # Free Software Foundation, Inc., 20 # Free Software Foundation, Inc.,
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 # #################################################################### 22 # ####################################################################
23 23
24 from fife import fife
25 import math
26
27 """ 24 """
28 Math Library 25 Math Library
29 ================================== 26 ==================================
30 27
31 This is a collection of useful 2D math functions/classes. 28 This is a collection of useful 2D math functions/classes.
32 """ 29 """
33 30
31 from fife import fife
32 import math
34 33
35 def normalize(vector): 34 def normalize(vector):
36 """ 35 """
37 Helper function to normalize a 2D vector 36 Helper function to normalize a 2D vector
38 37
143 142
144 def rotatePoint(origin, point, angle): 143 def rotatePoint(origin, point, angle):
145 """ 144 """
146 Rotates a point around the specified origin. 145 Rotates a point around the specified origin.
147 146
148 @param origin: A L{fife.DoublePoint} specifying the origin. 147 @param origin: A point specifying the origin.
149 @type origin: L{fife.DoublePoint} 148 @type origin: L{fife.DoublePoint}
150 @param point: A L{fife.DoublePoint} to be rotated. 149 @param point: The point to be rotated.
151 @type point: L{fife.DoublePoint} 150 @type point: L{fife.DoublePoint}
152 @param angle: The angle in which to rotate the point. 151 @param angle: The angle in which to rotate the point.
153 @type angle: C{int} or C{float} 152 @type angle: C{int} or C{float}
154 153
155 @return: A L{fife.DoublePoint} representing the rotated point. 154 @return: The rotated point.
156 @rtype: L{fife.DoublePoint} 155 @rtype: L{fife.DoublePoint}
157 """ 156 """
158 newp = fife.DoublePoint(0,0) 157 newp = fife.DoublePoint(0,0)
159 158
160 theta = (angle * math.pi)/180 159 theta = (angle * math.pi)/180