cgo.py (pymol-v2.1.0.tar.bz2) | : | cgo.py (pymol-open-source-2.2.0) | ||
---|---|---|---|---|
skipping to change at line 391 | skipping to change at line 391 | |||
input.readline() | input.readline() | |||
elif ( n != 9 ): | elif ( n != 9 ): | |||
# don't read another line if render object type 0 | # don't read another line if render object type 0 | |||
input.readline() | input.readline() | |||
self.append_last() | self.append_last() | |||
if self.tri_flag: | if self.tri_flag: | |||
self.obj.append(END) | self.obj.append(END) | |||
input.close() | input.close() | |||
def torus(center=(0., 0., 0.), normal=(0., 0., 1.), radius=1., color='', | def torus(center=(0., 0., 0.), normal=(0., 0., 1.), radius=1., color='', | |||
cradius=.25, samples=20, csamples=20): | cradius=.25, samples=20, csamples=20, _self=cmd): | |||
''' | ''' | |||
Generate and return a torus CGO with given center, normal | Generate and return a torus CGO with given center, normal | |||
and ring radius. | and ring radius. | |||
''' | ''' | |||
from math import cos, sin, pi | from math import cos, sin, pi | |||
if color and isinstance(color, str): | if color and isinstance(color, str): | |||
color = list(cmd.get_color_tuple(color)) | color = list(_self.get_color_tuple(color)) | |||
obj = [] | obj = [] | |||
axis = cpv.cross_product(normal, (0., 0., 1.)) | axis = cpv.cross_product(normal, (0., 0., 1.)) | |||
angle = -cpv.get_angle(normal, (0., 0., 1.)) | angle = -cpv.get_angle(normal, (0., 0., 1.)) | |||
matrix = cpv.rotation_matrix(angle, cpv.normalize(axis)) | matrix = cpv.rotation_matrix(angle, cpv.normalize(axis)) | |||
obj_vertex = lambda x, y, z: obj.extend([VERTEX] + cpv.add(center, | obj_vertex = lambda x, y, z: obj.extend([VERTEX] + cpv.add(center, | |||
cpv.transform(matrix, [x, y, z]))) | cpv.transform(matrix, [x, y, z]))) | |||
obj_normal = lambda x, y, z: obj.extend([NORMAL] + | obj_normal = lambda x, y, z: obj.extend([NORMAL] + | |||
cpv.transform(matrix, [x, y, z])) | cpv.transform(matrix, [x, y, z])) | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added |