Animation of a Cosine graph – any ideas?

think I’ve fixed it, or at least made it better.

Animation looks reasonable straightforward (from the help file – andnbsp;I’m not going to try it)

Tried to make churros con chocolate with a star in the shape of a bell curve, but didn’t work. andnbsp;Corkscrews are ok.

Looks sorta like my neighbors dog <!– s:D –><img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy" /><!– s:D –>
Are you wanting a cloud or cluster to grow or just a bar graph like a cylinder that expands? Or like a stereo equalizer? I’d like to fool around with it if you don’t mind, could you send me the molecule, or I could make a non-descript one just to mess with. KB

Here’s the graph for a different molecule (picture on the graph) but it’s completely analogous for the iodopropane pictured above. This is data that is calculated using HyperChem, a powerful computational chemistry program.

The first thing to notice are the axes. andnbsp;The verticle axis is the potential energy and the horizontal axis is in degrees… at 0 degrees we get electron cloud overlap between the t-butyl goup (everything to the left of the oxygen (red ball) and the CH3 (far right of the molecule) and you get high energy at 0 degrees. andnbsp;As you rotate the molecule, you can see that at certain angles you get energy minima (at 60, 180, and 300 degrees) and more maxima (120, 240 degrees). andnbsp;

It is this graph, I’d like to render in 3D LIVE as the molecule is rotating (starting at 0). andnbsp;So orginally there is just a blank graph (i.e. andnbsp;just the axes). andnbsp;Then as it starts rotating starting at 0 degrees, the line forms corresponding to the angle the molecule is presently at. andnbsp;

So I need a modelling strategy to this andquot;moving snakeandquot;

RawlinsCross

as you may have guessed the CH3 in on the far left NOT the far right as I say in the first posting

I’m trying to develop chemistry based animations using 3dc. andnbsp;My first attempt is the rotation of the carbon2-carbon3 bond (in violet) AND animating an energy graph to go along with it. andnbsp;

Some background (sorry for the lesson here folks). andnbsp;As the bond rotates it brings the electron cloud of the iodine group (yellow-green) in contact with the electron clouds of the CH3 group (far right) creating an unstable conformation and high energy (most unstable conformation is shown below). andnbsp;So as it rotates all the around 360 degrees you get a rise and fall of the energy. andnbsp;The graph of energy to angle looks alot like a cosine (or sine) graph.

Back to the animation: andnbsp; what I want to do, is AS that big iodine group is rotating around, there’s a 3D graph that is showing the corresponding energy.

So I need a small square or cylinder (representing the VERY FIRST point – i.e. time zero) that grows in length as the the iodine atom goes round and round. andnbsp;No only does it grow in length but it falls and rises (according to the energy of the molecule) have peaks and troughs. andnbsp;The first point is anchored ofcourse.. basically a living 3D representation of the graph being made as the iodine rotates..

How can I do this GRAPH animation. andnbsp;I thought that I might try to do a particle emission, tracing the shape of the graph, but not having the particles die out??? andnbsp;This might be a stupid idea… any others?

Hi Richard,

Checked out that website about the scripts. andnbsp;My programming experience is limited but NOT non-existant and I think I can cope with practice. andnbsp;

Here’s a sample script that scales an object over time…. can I simply copy and paste this into 3dc ‘write script’ (in the tools section) and use it… cause it’s asking for Main.

Language = VBScript

Sub AnimateObject (Time, 3DCObject)
andnbsp; andnbsp;Dim PointCount
andnbsp; andnbsp;Dim PointIndex
andnbsp; andnbsp;Dim PointX
andnbsp; andnbsp;Dim PointY
andnbsp; andnbsp;Dim PointZ

andnbsp; andnbsp;’get the number of points in the object
andnbsp; andnbsp;PointCount = 3DCObject.GetPointCount

andnbsp; andnbsp;’Run through the points scaling them
andnbsp; andnbsp;For PointIndex = 0 to PointCount – 1

andnbsp; andnbsp; andnbsp; andnbsp;’get the point
andnbsp; andnbsp; andnbsp; andnbsp;3DCObject.GetPoint PointIndex, PointX, PointY, PointZ

andnbsp; andnbsp; andnbsp; andnbsp;’scale the point
andnbsp; andnbsp; andnbsp; andnbsp;PointX = PointX * (Time+1)
andnbsp; andnbsp; andnbsp; andnbsp;PointY = PointY * (Time+1)
andnbsp; andnbsp; andnbsp; andnbsp;PointZ = PointZ * (Time+1)

andnbsp; andnbsp; andnbsp; andnbsp;’set the point
andnbsp; andnbsp; andnbsp; andnbsp;3DCObject.SetPoint PointIndex, PointX, PointY, PointZ

andnbsp; andnbsp;Next

End Sub

So I tried to simply cut and paste this and run the script.. validated ok, but didn’t run.

RawlinsCross

This is an animation script not a general purpose script, so you’ll need to follow the instructions outlined in the andquot;Animation Scriptsandquot; section of that help page.

Richard

This is definitely a time to use scripting.

I don’t know if you have any experience with programming or not, but there is an example script in the online help that demonstrates how to animate the position of a group. It should be relatively straight forward to change it to calculated positions. It doesn’t cover everything you need, but it is a start. (The example is online here: [img:1zpfnfcl]http&#58;//www&#46;amabilisplus&#46;com/3DCDocumentation/3DCAPI&#46;htm[/img:1zpfnfcl]
<!– m –><a class="postlink" href="http://www.amabilisplus.com/3DCDocumentation/3DCAPI.htm">http://www.amabilisplus.com/3DCDoc … vasAPI.htm</a><!– m –>
)

Richard

Ok, so I really don’t know how to script… so what to do?

I guess I can go and purchase books on it and see if I can write the script in order to do what I want to do here. andnbsp;

So here’s the need: andnbsp;to develop a script which a simple primative into a long spagetthi-like curve going up and down… sounds about right.

Hi John,

Is this the sort of thing you were thinking of?

[img:3galcvca]http&#58;//www&#46;traksys&#46;freeuk&#46;com/chem1&#46;AVI[/img:3galcvca]
<!– m –><a class="postlink" href="http://www.traksys.freeuk.com/chem1.AVI">http://www.traksys.freeuk.com/chem1.AVI</a>&lt;!– m –>

(about 100kB)

The model with animations is at:

[img:3galcvca]http&#58;//www&#46;traksys&#46;freeuk&#46;com/chem1&#46;zip[/img:3galcvca]
<!– m –><a class="postlink" href="http://www.traksys.freeuk.com/chem1.zip">http://www.traksys.freeuk.com/chem1.zip</a>&lt;!– m –>
(also 100Kb)

to view the script for the red bar, right click on the object, select andquot;Openandquot; and andquot;Component Scriptandquot;

there is a small bug with the script which means one of the points at the back is a bit odd but you can’t see it. It also relies on the fact that points in a cyinder alternate ends around the curved face.

Regards

Paul

Hey Paul.. that looks pretty cool.. I’ll be sure to disect the script to learn more about how it’s done… what I’ve noticed is that you have the Potential Energy Y-AXIS animated going up and down… I’d like to ALSO animate the X-axis… so you see more like an animation of the graph above starting at 0 degrees and ending at 360. Like a growing snake starting at 0 degrees.

I was thinking of building the graph structure (without any of the data points) alongside my model in 3dc (making a 3d graph with the x and y axis labelled) and then using the script to draw in the curve as the molecule slowly rotates… andnbsp;

so whatcha think?

RawlinsCross…

interesting. andnbsp;About 6 months ago I was working on a script to extrude an arbitrary face along a function. andnbsp;The deadline passed before I finished it, unfortunately, and it doesn’t work.

In your context you could start with a small circle facing right at the left if the screen, then extrude it along your function. andnbsp;I’ve never done scripts for animating, so not sure how that works.

I want to finish the script, and if someone else had a use for it I might start sooner. andnbsp;Helping people get past chemistry into real life would be valuable andnbsp;:)

George

Hi guys…

I think we’re getting closer each post… George, you’re right, we do want to start off with a small circle (cylinder probably) representing the first data point on the graph and then extrude to the left falling and rising as per the graph shown.

Here’s a graph of the rotation of chloropropane from
-180 degrees to 180 degrees (which is the same as 0 to 360).

I can make the structure of the graph in 3dc along side my rotating molecule then I can enter the primative with its script and time the rotation with the moving data line.

All I did was to paint the graph on a cube face – have the animation at the front and moved a flat cube left to right to uncover the graph – ok so I think simple <!– s:) –><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!– s:) –> ….

???
I can’t follow most of this thread but is this the sort of thing you are after ?

Do you need to work out the graph or can it be pre-made ?

You must be logged in to reply in this thread.

20 posts