Opened 7 years ago
Closed 7 years ago
#1371 closed defect (fixed)
Geometry coming out incorrect on first attempt
Reported by: | Tristan Croll | Owned by: | Tom Goddard |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | Graphics | Version: | |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Notify when closed: | Platform: | all | |
Project: | ChimeraX |
Description
This is something new (code has been working perfectly for months). The applied code that is coming out wrong is my rotamer annotation (the whole drawing gets hidden inside the "dot" of the exclamation mark), but the below is a minimal example.
def exclamation_mark(radius = 0.1, height = 2, nc=8, color = [255,0,0,255]): ''' An exclamation mark for annotating rotamer outliers ''' from chimerax.surface.shapes import cone_geometry, sphere_geometry2 from chimerax.core.geometry import translation, scale import numpy stem = cone_geometry(radius=radius, height=height, nc=nc, caps=True) spheres = list(sphere_geometry2(nc*4)) spheres[0] = scale(radius*0.7).moved(spheres[0]) v, n, t = stem vbottom = translation((0,0, height/2+radius*1.5)).moved(spheres[0]) t = numpy.concatenate((t, spheres[2]+len(v))) v = numpy.concatenate((v, vbottom)) n = numpy.concatenate((n, spheres[1])) return v, n, t from chimerax.core.models import Model, Drawing m = Model('test', session) d = Drawing('test') m.add_drawing(d) d.set_geometry(*exclamation_mark()) session.models.add([m])
The sphere will be much too large (looks like it's still unit radius, as if the scale was not applied).
d.set_geometry(*exclamation_mark())
... and the drawing now looks as expected. Similarly, if I repeat the whole of the above script (creating a new Model), then the geometry comes out correct this time around. Loading and displaying an AtomicStructure *first* (with atoms displayed - ribbon only isn't sufficient) also seems to correct it.
Change History (2)
comment:2 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fixed.
My matrix optimizations reuse Place instances and their numpy arrays when they are no longer referenced. There was a bug where a the scale() function produced a Place that was flagged as being the identity matrix even though it was not an identity matrix.