Changeset 732
- Timestamp:
- 10/28/03 18:10:04 (5 years ago)
- Files:
-
- trunk/RBRapier/RBRapier/Renderer/Environment/Selection.py (modified) (1 diff)
- trunk/RBRapier/RBRapier/Tools/Geometry/Curves.py (modified) (5 diffs)
- trunk/RBRapier/RBRapier/Tools/Projections.py (modified) (3 diffs)
- trunk/RBRapier/RBRapier/Tools/Quaternion.py (modified) (6 diffs)
- trunk/RBRapier/RBRapier/Tools/Transformations.py (modified) (4 diffs)
- trunk/RBRapier/RBRapier/Tools/Transformations2d.py (modified) (5 diffs)
- trunk/RBRapier/RBRapier/Tools/Vector.py (modified) (3 diffs)
- trunk/RBRapier/demo/Cube/cubescene.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/RBRapier/RBRapier/Renderer/Environment/Selection.py
r703 r732 53 53 return "<Selection z=%s names=%s>" % (self.GetZRange(), self.namepath) 54 54 55 def GetName(self): 56 return self.GetNamePath()[-1] 57 def GetNamePath(self): 58 return self.namepath 59 55 60 def GetZRange(self): 56 61 maxvalue = 0xffffffffL trunk/RBRapier/RBRapier/Tools/Geometry/Curves.py
r692 r732 3 3 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 4 5 import math 5 6 import Numeric 6 7 … … 9 10 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 10 11 11 _rad2deg = 180.0/Numeric.pi12 _deg2rad = Numeric.pi/180.013 12 _2pi = 2 * Numeric.pi 14 13 … … 182 181 """ 183 182 if inDegrees: 184 xrotation *= _deg2rad183 xrotation = math.radians(xrotation) 185 184 fromxy = Numeric.asarray(fromxy, klass.NumericType) 186 185 toxy = Numeric.asarray(toxy, klass.NumericType) … … 244 243 245 244 def SetSweepAngles(self, startangle, endangle): 246 self.SetSweep( _deg2rad*startangle, _deg2rad*endangle)245 self.SetSweep(math.radians(startangle), math.radians(endangle)) 247 246 def SetSweep(self, startradians, endradians): 248 247 self.sweep = [startradians, endradians] … … 251 250 252 251 def SetXRotationAngle(self, xrotationAngle): 253 self.SetXRotation( _deg2rad*xrotationAngle)252 self.SetXRotation(math.radians(xrotationAngle)) 254 253 def SetXRotation(self, xrotationRadians): 255 254 self.xrotation = xrotationRadians trunk/RBRapier/RBRapier/Tools/Projections.py
r703 r732 24 24 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 25 25 26 from Transformations import TransformPrimitive3dh, _deg2rad, _rad2deg 26 import math 27 27 import Numeric 28 import math28 from Transformations import TransformPrimitive3dh 29 29 30 30 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 304 304 """Derived from OpenGL Red Book""" 305 305 Frustum.__init__(self,-1.,1.,-1.,1.,near,far) 306 self.SetViewAngleAndRatio( _deg2rad*viewangle, float(aspectratio))306 self.SetViewAngleAndRatio(math.radians(viewangle), float(aspectratio)) 307 307 308 308 def __repr__(self): … … 310 310 311 311 def GetViewAngle(self): 312 return _rad2deg*2.*math.atan(self.Height/(2.*self.Near))312 return math.degrees(2.*math.atan(self.Height/(2.*self.Near))) 313 313 def SetViewAngle(self, value): 314 self.SetViewRadians( _deg2rad * value)314 self.SetViewRadians(math.radians(value)) 315 315 ViewAngle = property(GetViewAngle, SetViewAngle) 316 316 trunk/RBRapier/RBRapier/Tools/Quaternion.py
r703 r732 37 37 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 38 38 39 from Transformations import TransformPrimitive3dh, _deg2rad, _rad2deg 39 import math 40 import Numeric 41 42 from Transformations import TransformPrimitive3dh 40 43 from Vector import DotCross3 as _VectorDotCross3 41 import Numeric42 import math43 44 44 45 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 312 313 29.999999999999986 313 314 """ 314 return _rad2deg * self.DeltaRadians(other)315 return math.degrees(self.DeltaRadians(other)) 315 316 316 317 def DeltaRadians(self, other): … … 333 334 """ 334 335 try: 335 return 2. * _rad2deg * Numeric.arccos(self._array[0])336 return math.degrees(2.*Numeric.arccos(self._array[0])) 336 337 except ValueError: return 0. 337 338 def setAngle(self, value): … … 344 345 59.999999999999986 345 346 """ 346 self.setRadians( value * _deg2rad)347 self.setRadians(math.radians(value)) 347 348 Angle = property(getAngle, setAngle) 348 349 … … 445 446 <Quaternion: 0.965925826289 + 0.0i + 0.0j + 0.258819045103k> 446 447 """ 447 return Klass(Klass._SVfromRadianAxis( Angle * _deg2rad, Axis))448 return Klass(Klass._SVfromRadianAxis(math.radians(Angle), Axis)) 448 449 fromAngleAxis = classmethod(fromAngleAxis) 449 450 … … 497 498 """ 498 499 Radian, Axis = self.toRadianAxis() 499 return Radian * _rad2deg, Axis500 return math.degrees(Radian), Axis 500 501 501 502 def toRadianAxis(self): trunk/RBRapier/RBRapier/Tools/Transformations.py
r731 r732 24 24 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 25 25 26 import math 26 27 import Numeric 27 28 import LinearAlgebra 28 29 from Vector import * 29 30 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~31 #~ Constants / Variables / Etc.32 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~33 34 _rad2deg = 180.0/Numeric.pi35 _deg2rad = Numeric.pi/180.036 30 37 31 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 455 449 456 450 def _getRadians(self): 457 return self.Angle * _deg2rad451 return math.radians(self.Angle) 458 452 def _setRadians(self, value): 459 self.Angle = value * _rad2deg453 self.Angle = math.degrees(value) 460 454 Radians = property(_getRadians, _setRadians) 461 455 … … 571 565 572 566 def _SetRhoThetaPhi(self, (row,theta,fi)): 573 self.RhoThetaPhiRadians = row, theta * _deg2rad, fi * _deg2rad567 self.RhoThetaPhiRadians = row, math.radians(theta), math.radians(fi) 574 568 def _GetRhoThetaPhi(self): 575 569 row, theta, fi = self.RhoThetaPhiRadians 576 return row, theta * _rad2deg, fi * _rad2deg570 return row, math.degrees(theta), math.degrees(fi) 577 571 RhoThetaPhi = property(_GetRhoThetaPhi, _SetRhoThetaPhi) 578 572 … … 646 640 result = {} 647 641 for key,value in kw.iteritems(): 648 result[key] = Numeric.tan( value * _deg2rad)642 result[key] = Numeric.tan(math.radians(value)) 649 643 return result 650 644 trunk/RBRapier/RBRapier/Tools/Transformations2d.py
r731 r732 24 24 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 25 25 26 import math 26 27 import Numeric 27 28 import LinearAlgebra … … 29 30 30 31 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 31 #~ Constants / Variables / Etc.32 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~33 34 _rad2deg = 180.0/Numeric.pi35 _deg2rad = Numeric.pi/180.036 37 38 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~39 32 #~ Definitions 40 33 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 41 34 35 def From3x3to4x4(matrix): 36 result = Numeric.identity(4, matrix.typecode()) 37 result[:2,:2] = matrix[:2,:2] 38 result[ 3,:2] = matrix[ 2,:2] 39 result[:2, 3] = matrix[:2, 2] 40 return result 41 42 42 class TransformPrimitive2dh(object): 43 43 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 52 52 53 53 def asArray3x3(self): 54 """Returns the transformation in 3x3 Numeric array form. 55 """ 56 return Numeric.identity(3) 54 """Returns the transformation in 3x3 Numeric array form.""" 55 return Numeric.identity(3, self.NumericType) 57 56 58 57 def asInverse3x3(self): 59 """Returns the inverse transformation in 3x3 Numeric array form. 60 """ 58 """Returns the inverse transformation in 3x3 Numeric array form.""" 61 59 return LinearAlgebra.inverse(self.asArray3x3()) 60 61 def asArray4x4(self): 62 """Returns the transformation in 4x4 Numeric array form.""" 63 return From3x3to4x4(self.asArray3x3()) 64 65 def asInverse4x4(self): 66 """Returns the inverse transformation in 4x4 Numeric array form.""" 67 return From3x3to4x4(self.asArray3x3()) 62 68 63 69 def Collapse(self): … … 316 322 317 323 def _getRadians(self): 318 return self.Angle * _deg2rad324 return math.radians(self.Angle) 319 325 def _setRadians(self, value): 320 self.Angle = value * _rad2deg326 self.Angle = math.degrees(value) 321 327 Radians = property(_getRadians, _setRadians) 322 328 … … 368 374 else: 369 375 for key,value in kw.iteritems(): 370 result[key] = Numeric.tan( value * _deg2rad)376 result[key] = Numeric.tan(math.radians(value)) 371 377 return result 372 378 trunk/RBRapier/RBRapier/Tools/Vector.py
r703 r732 24 24 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 25 25 26 import math 26 27 import Numeric 27 28 from RBFoundation.IndexedProperty import IndexedProperty … … 31 32 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 32 33 33 _rad2deg = 180.0/Numeric.pi34 _deg2rad = Numeric.pi/180.035 34 _NumericType = Numeric.Float32 36 35 … … 288 287 289 288 def DeltaAngle(self, other): 290 return _rad2deg * self.DeltaRadians(other)289 return math.degrees(self.DeltaRadians(other)) 291 290 292 291 def DeltaRadians(self, other): trunk/RBRapier/demo/Cube/cubescene.py
r705 r732 40 40 from RBRapier.Renderer.View import Viewport 41 41 from RBRapier.Renderer.View import Transformations 42 from RBRapier.Renderer.View import TransformationSettings43 42 44 43 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 201 200 202 201 def OnMouse(self, evt): 202 evt.Skip() 203 if not self.Initialized: 204 return 203 205 self.pickmatrix.PickEnabled = True 204 206 if self.IsPickingEnabled(): … … 209 211 self.pickmatrix.MapFrom.SetPts(pos0, pos1) 210 212 211 evt.Skip()212 213 213 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 214 214 #~ Main
