Forráskód Böngészése

added GoldenRectangle

Darren Ranalli 19 éve
szülő
commit
208dfd2d94
1 módosított fájl, 11 hozzáadás és 0 törlés
  1. 11 0
      direct/src/showbase/PythonUtil.py

+ 11 - 0
direct/src/showbase/PythonUtil.py

@@ -2569,10 +2569,21 @@ def logMethodCalls(cls):
     __logMethodCall__ = None
     return cls
 
+# http://en.wikipedia.org/wiki/Golden_ratio
+GoldenRatio = (1. + math.sqrt(5.)) / 2.
+class GoldenRectangle:
+    @staticmethod
+    def getLongerEdge(shorter):
+        return shorter * GoldenRatio
+    @staticmethod
+    def getShorterEdge(longer):
+        return longer / GoldenRatio
+
 import __builtin__
 __builtin__.Functor = Functor
 __builtin__.Stack = Stack
 __builtin__.Queue = Queue
+__builtin__.Enum = Enum
 __builtin__.SerialNumGen = SerialNumGen
 __builtin__.ScratchPad = ScratchPad
 __builtin__.uniqueName = uniqueName