Opened 6 years ago
Closed 6 years ago
#2762 closed defect (wontfix)
Clip cap error with zero-length bond
| Reported by: | Tristan Croll | Owned by: | Tom Goddard |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Surface | Version: | |
| Keywords: | Cc: | Eric Pettersen | |
| Blocked By: | Blocking: | ||
| Notify when closed: | Platform: | all | |
| Project: | ChimeraX |
Description
The following bug report has been submitted:
Platform: Linux-3.10.0-1062.9.1.el7.x86_64-x86_64-with-centos-7.7.1908-Core
ChimeraX Version: 0.92 (2020-01-11)
Description
Obscure and only occurs under unusual circumstances, but reporting for the record:
If `geometry.cylinder_rotations()` is used to set the geometry of a bond where start and end points are the same, then setting `clip_cap=True` on the `Drawing` leads to a neverending stream of the following error:
Traceback (most recent call last):
File "/opt/UCSF/ChimeraX-daily/lib/python3.7/site-packages/chimerax/core/updateloop.py", line 133, in _redraw_timer_callback
drew = self.draw_new_frame()
File "/opt/UCSF/ChimeraX-daily/lib/python3.7/site-packages/chimerax/core/updateloop.py", line 62, in draw_new_frame
surface.update_clip_caps(view)
File "/opt/UCSF/ChimeraX-daily/lib/python3.7/site-packages/chimerax/surface/cap.py", line 27, in update_clip_caps
subdivision = settings.clipping_cap_subdivision)
File "/opt/UCSF/ChimeraX-daily/lib/python3.7/site-packages/chimerax/surface/cap.py", line 35, in show_surface_clip_caps
varray, narray, tarray = compute_cap(d, p, offset)
File "/opt/UCSF/ChimeraX-daily/lib/python3.7/site-packages/chimerax/surface/cap.py", line 92, in compute_cap
dp = d.scene_position.inverse()
File "/opt/UCSF/ChimeraX-daily/lib/python3.7/site-packages/chimerax/core/geometry/place.py", line 187, in inverse
self._inverse = Place(m34.invert_matrix(self._matrix))
File "/opt/UCSF/ChimeraX-daily/lib/python3.7/site-packages/chimerax/core/geometry/matrix.py", line 130, in invert_matrix
rinv[:, :] = matrix_inverse(r)
File "<__array_function__ internals>", line 6, in inv
File "/opt/UCSF/ChimeraX-daily/lib/python3.7/site-packages/numpy/linalg/linalg.py", line 551, in inv
ainv = _umath_linalg.inv(a, signature=signature, extobj=extobj)
File "/opt/UCSF/ChimeraX-daily/lib/python3.7/site-packages/numpy/linalg/linalg.py", line 97, in _raise_linalgerror_singular
raise LinAlgError("Singular matrix")
numpy.linalg.LinAlgError: Singular matrix
numpy.linalg.LinAlgError: Singular matrix
File "/opt/UCSF/ChimeraX-daily/lib/python3.7/site-packages/numpy/linalg/linalg.py", line 97, in _raise_linalgerror_singular
raise LinAlgError("Singular matrix")
Log:
Startup Messages
---
warning | 'clip' is a prefix of an existing command 'clipper'
UCSF ChimeraX version: 0.92 (2020-01-11)
© 2016-2019 Regents of the University of California. All rights reserved.
How to cite UCSF ChimeraX
OpenGL version: 3.3.0 NVIDIA 440.33.01
OpenGL renderer: TITAN Xp/PCIe/SSE2
OpenGL vendor: NVIDIA Corporation
Change History (2)
comment:1 by , 6 years ago
| Cc: | added |
|---|---|
| Component: | Unassigned → Surface |
| Owner: | set to |
| Platform: | → all |
| Project: | → ChimeraX |
| Status: | new → assigned |
| Summary: | ChimeraX bug report submission → Clip cap error with zero-length bond |
comment:2 by , 6 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | assigned → closed |
BondDrawing is unusual in that its position instance matrices can be singular, and are singular for zero-length bonds, thus cannot be inverted. The clip capping code wants to invert the matrix generating this error.
The easy solution is BondDrawing does not have clip caps.
Probably the clip cap code could be improved to catch singular position matrices. In general drawing positions are intended to be non-singular. But with instancing of cylinders where you need to allow the cylinder length to be zero it violates this rule. This could lead to problems in any code that assumes invertible position matrices. The current solution is to be careful about where these weird instanced models that allow geometry to be smashed to zero size. A better solution would be to really not allow singular position matrices. For bonds this would mean removing zero-length bonds from the rendered geometry. That could be done at the cost of complexity and speed. Does not seem worth it unless a more significant problem arises.
I'll document in the BondDrawing class that it may have singular position matrices.
Seems like the zero-length bond is the problem but maybe something better could be done, error-wise.