Changeset 7898:f2d02e4db6a9
- Timestamp:
- 12/30/07 08:31:59 (5 years ago)
- Branch:
- default
- Location:
- sage/plot/plot3d
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sage/plot/plot3d/base.pyx
r7897 r7898 249 249 def _transform_to_bounding_box(self, xyz_min, xyz_max, frame, axes, thickness): 250 250 a_min, a_max = self.bounding_box() 251 251 252 # Rescale in each direction 252 scale = [(xyz_max[i] - xyz_min[i]) / max(0.00 1, a_max[i] - a_min[i]) for i in range(3)]253 scale = [(xyz_max[i] - xyz_min[i]) / max(0.0001, a_max[i] - a_min[i]) for i in range(3)] 253 254 X = self.scale(scale) 255 a_min, a_max = X.bounding_box() 256 257 254 258 # Translate so lower left corner of original bounding box 255 259 # is in the right spot 256 a_min, a_max = X.bounding_box() 257 if axes: 258 from shapes import LineSegment 259 X += LineSegment((min(0, a_min[0]*1.1), 0, 0), (max(0,a_max[0]*1.1), 0,0), 260 thickness, color="blue") 261 X += LineSegment((0,min(0,a_min[1]*1.1), 0), (0, max(0,a_max[1]*1.1), 0), 262 thickness, color="blue") 263 X += LineSegment((0, 0, min(0,a_min[2]*1.1)), (0, 0, max(0,a_max[2]*1.1)), 264 thickness, color="blue") 265 Y = X.translate([xyz_min[i] - a_min[i] for i in range(3)]) 266 a_min, a_max = Y.bounding_box() 260 T = [xyz_min[i] - a_min[i] for i in range(3)] 261 X = X.translate(T) 267 262 if frame: 263 a_min, a_max = X.bounding_box() 268 264 from shapes2 import frame3d 269 265 F = frame3d(a_min, a_max, opacity=0.5, color=(0,0,0), thickness=thickness) 270 return Y + F 271 return Y 272 266 X += F 267 268 if axes: 269 # draw axes 270 from shapes import Arrow 271 A = (Arrow((min(0,a_min[0]),0, 0), (max(0,a_max[0]), 0,0), 272 thickness, color="blue"), 273 Arrow((0,min(0,a_min[1]), 0), (0, max(0,a_max[1]), 0), 274 thickness, color="blue"), 275 Arrow((0, 0, min(0,a_min[2])), (0, 0, max(0,a_max[2])), 276 thickness, color="blue")) 277 X += sum(A).translate([-z for z in T]) 278 279 return X 273 280 274 281 def show(self, viewer="jmol", filename=None, verbosity=0, figsize=5, -
sage/plot/plot3d/bugs.txt
r7897 r7898 9 9 then rescale everything into a 10x10x10 square. 10 10 We should draw axis and allow for aspect ratios. 11 * Invalid color doesn't yield an error message, e.g., Icosahedron(texture="yello") 12 * color --> rgbcolor 11 13 12 14 Jmol todo:
Note: See TracChangeset
for help on using the changeset viewer.
