Ribbon engine and spline curves

Hi,

Over the last week I have been trying to figure out the best way of
implementing ribbon view support. I have been researching what kind of curves
might be best to use and testing new painter functions to implement the
needed primitives. I have been using Bezier curves and GL_LINE_STRIPS to get
to grips with getting the lines right, and will move on to painting a ribbon.

Can I expect the elements of a residue to be in the order they should be
connected? So I can iterate through residues and for each residue draw
between each atom in that residue in order? Then it is a case of finding the
best method of smoothing the ribbon between atoms before extending the line
to a ribbon (GL_TRIANGLE_STRIP) or possibly a cylinder or something similar.

It may be that ultimately this will be better taken care of by a suitable
meshing library, but right now I was just trying to figure out the best way
of interpolating between the lines and getting the path the ribbon needs to
follow - that will be needed whatever we use.

Thanks,

Marcus

Can I expect the elements of a residue to be in the order they
should be
connected?

Yes. If it’s not in the correct order, then it’s a bug in Open Babel.

So I can iterate through residues and for each residue draw between
each atom in that residue in order? Then it is a case of finding
the best method of smoothing the ribbon between atoms before
extending the line to a ribbon (GL_TRIANGLE_STRIP) or possibly a
cylinder or something similar.

My understanding is that ribbons are drawn between the Calpha atoms
of each residue. So it’s not all atoms in the residue, it’s the one
marked Ca. (i.e., the connection between the two amino acids).

http://www.macresearch.org/drawing_protein_ribbons

As far as smoothing, I think it’ll take some experimentation to get
the right “tricks.” I know some programs define a spline curve made
up of all of the carbon coordinates and the graphics library takes it
from there. I can probably dig up some OpenGL calls if you need them.

Cheers,
-Geoff