Changeset 7971:66ae86c46978
- Timestamp:
- 01/05/08 05:03:25 (5 years ago)
- Branch:
- default
- Location:
- sage/plot/plot3d
- Files:
-
- 2 edited
-
shapes2.py (modified) (5 diffs)
-
transform.pyx (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sage/plot/plot3d/shapes2.py
r7970 r7971 9 9 10 10 from texture import Texture 11 12 TACHYON_PIXEL = 1/200.0 11 13 12 14 from shapes import Text, Sphere … … 27 29 if len(points) < 2: 28 30 raise ValueError, "there must be at least 2 points" 31 for i in range(len(points)): 32 x, y, z = points[i] 33 points[i] = float(x), float(y), float(z) 29 34 if radius is None: 30 35 # make a zoom-invariant line 31 return Line(points, thickness=thickness, **kwds)36 return Line(points, thickness=thickness, arrow_head=arrow_head, **kwds) 32 37 else: 33 38 v = [] … … 231 236 def __init__(self, (x,y,z), size=1, **kwds): 232 237 PrimitiveObject.__init__(self, **kwds) 233 self.loc = x, y, z238 self.loc = float(x), float(y), float(z) 234 239 self.size = size 235 240 … … 243 248 else: 244 249 cen = transform.transform_point(self.loc) 245 return "Sphere center %s %s %s Rad %s %s" % (cen[0], cen[1], cen[2], self.size , self.texture.id)250 return "Sphere center %s %s %s Rad %s %s" % (cen[0], cen[1], cen[2], self.size * TACHYON_PIXEL, self.texture.id) 246 251 247 252 def jmol_repr(self, render_params): … … 293 298 cmds = [] 294 299 px, py, pz = self.points[0] if T is None else T(self.points[0]) 300 radius = self.thickness * TACHYON_PIXEL 295 301 for P in self.points[1:]: 296 302 x, y, z = P if T is None else T(P) 297 cmds.append("FCylinder base %s %s %s apex %s %s %s rad %s %s" % (px, py, pz, 298 x, y, z, 299 self.thickness, 300 self.texture.id)) 303 if self.arrow_head and P is self.points[-1]: 304 A = shapes.Arrow((px, py, pz), (x, y, z), radius = radius, texture = self.texture) 305 render_params.push_transform(~T) 306 cmds.append(A.tachyon_repr(render_params)) 307 render_params.pop_transform() 308 else: 309 cmds.append("FCylinder base %s %s %s apex %s %s %s rad %s %s" % (px, py, pz, 310 x, y, z, 311 radius, 312 self.texture.id)) 301 313 px, py, pz = x, y, z 302 print cmds303 314 return cmds 304 315 -
sage/plot/plot3d/transform.pyx
r7967 r7971 108 108 return Transformation(m = self.matrix * other.matrix) 109 109 110 def __invert__(Transformation self): 111 return Transformation(m=~self.matrix) 112 110 113 def __call__(self, p): 111 114 return self.transform_point(p) … … 115 118 self._svd = self.matrix.submatrix(0,0,3,3).SVD() 116 119 return self._svd[1][0,0] 120 121 def avg_scale(self): 122 if self._svd is None: 123 self._svd = self.matrix.submatrix(0,0,3,3).SVD() 124 return (self._svd[1][0,0] * self._svd[1][1,1] * self._svd[1][2,2]) ** (1/3.0) 117 125 118 126
Note: See TracChangeset
for help on using the changeset viewer.
