Re: Lipid Bilayer Protein

jon klein <[email protected]> Wed, 19 Jan 2005 09:18:04 -0500
Newsgroups gmane.comp.breve
Message-ID <[email protected]>
On Jan 18, 2005, at 2:25 PM, Cindy Chan wrote:

> Hi
> You may not remember me as I have previously sent an email asking for 
> help, but as a refresher, I am trying to write a simulation based on 
> protein interactions. Basically, what I am trying to do is simulate 
> the formation of a lipid bilayer protein on a 2-dimensional surface. 
> At present, I am wondering if it is possible for Breve to calculate 
> the difference in distance from one sphere to another in 3-dimensional 
> space and if so, how can I display this information? Is it possible to 
> select a sphere and then for Breve to automatically give me the exact 
> location (or co-ordinates) of the sphere itself?

To get the distance between one sphere and another, you subtract one's 
location from the other, and then take the magnitude of the resulting 
vector:

		distance = | (thisSphere get-location) - (thatSphere get-location) |.

You can then display this information (to the output log) using "print".

When you say you want to "select" a sphere and get the location, I'm 
assuming you mean "select" as in "click on".  To specify a "click on" 
behavior, you can override the method "click" in your controller 
object.  The method "click" is automatically called when a selection 
changes, so you can use that to print out the object's location.  Note 
that selectedObject can be NULL (no object) when the "click" event is a 
deselection event.

	+ to click on selectedObject (object):
		# first print the object location, if the object is valid
		if selectedObject: print (selectedObject get-location).

		# then let the superclass handle the actual selection
		super click on selectedObject.

- jon klein

_______________________________________________
breve mailing list
[email protected]
http://lists.spiderland.org/mailman/listinfo/breve