gabrielelanaro / chemview

The new generation molecular viewer for IPython notebook
GNU Lesser General Public License v2.1
81 stars 17 forks source link

Labels and ArcballControls.js access #29

Closed tam10 closed 8 years ago

gabrielelanaro commented 8 years ago

Excellent PR! Some minor naming changes plus the colors issues to make it consistent with the rest of the application.

For the rest it's good for merge

tam10 commented 8 years ago

Hi Gabriele,

Do you want me to make the changes and push them again? I'm actually not too sure how to move forward at this point (got a lot of help from Clyde Fare about GitHub last week).

Another thing I'm finding useful with the text is that I can overlay axes with code:

av=np.average(mv.coordinates,0) l=max([np.linalg.norm(x-av) for x in mv.coordinates]) starts=np.array([av,av,av]) ends=np.array([av+[l,0,0],av+[0,l,0],av+[0,0,l]]) axis_labels_coords=np.array([av+[l_1.05,0,0],av+[0,l_1.05,0],av+[0,0,l*1.05]])

a_rep=mv.add_representation('cylinders',{"startCoords":starts, "endCoords":ends, "colors":[0xff0000,0x00ff00,0x0000ff], "radii":[0.01,0.01,0.01]})

t_rep=mv.add_representation('labels',{"coordinates":axis_labels_coords, "labels":['X','Y','Z'], "colors":[{"r":255,"g":0,"b":0,"a":1}, {"r":0,"g":255,"b":0,"a":1}, {"r":0,"g":0,"b":255,"a":1}]})

I didn't want to add this to chemview as I think it's more of a cookbook thing, but it seems fairly useful.

Best regards, Tristan

On 16 Apr 2016, at 01:21, Gabriele Lanaro notifications@github.com<mailto:notifications@github.com> wrote:

Excellent PR! Some minor naming changes plus the colors issues to make it consistent with the rest of the application.

For the rest it's good for merge

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHubhttps://github.com/gabrielelanaro/chemview/pull/29#issuecomment-210695569

gabrielelanaro commented 8 years ago

Yes, if you apply changes to your fork and they will appear automatically here. If you're having problems with some changes I suggested, you can also leave it like this, I can finish off the work (but remember to pull again from your fork when I'm done).

Regarding the axis feature I think this is pretty useful and can be added to MolecularViewer. Something like:

    mv.axes()

I'm opening a new issue ( #30 ) for that.

Also, I wanted to ask you permission to add your name to the list of contributors, if you wish.

gabrielelanaro commented 8 years ago

Good to merge thanks!