Animate the PI = 4 experiment

Page 5 of 5 Previous  1, 2, 3, 4, 5

Go down

Animate the PI = 4 experiment - Page 5 Empty Re: Animate the PI = 4 experiment

Post by LongtimeAirman on Mon Nov 04, 2019 7:37 pm

.
Animate the PI = 4 experiment - Page 5 Button10
Both spheres traveling along their tracks in a downward direction have just past their initial sections and red starting lines. The track angle rotation of the curved track sphere is already apparent. Oh, and buttons. And off of daylight savings.

Using a check-box to control pausing is bad
Like teats on a boar bad? The new Pause and Next Frame buttons work slightly better than they did as check boxes. If in haste, one presses Next Frame instead of Pause, the screen will still pause. Here’re the two new items on the end of the parameters list.
Code:

 parameters =
 {
 timeInSecs: 40,
 CycloidRoll: true,
 twopivt: false,
 twopir: true,
 color: "#FFFF00",
 StepAhead: false,
 pauseButton: function(){ pauseButtonPressed() },  
 nFrameButton: function(){ nextFramePressed() }  
 };

The gui additions.
Code:

      gui.add( parameters, 'pauseButton' ).name("Pause");
      gui.add( parameters, 'nFrameButton' ).name("Next Frame");

The two event functions.
Code:

 function pauseButtonPressed()
 {
 // toggle the current state
 paused = !paused;
 };
 
 function nextFramePressed()
 {
 if ( paused ) {
 stepA = true;
 }
 else if ( !paused ) {
 paused = true;
 stepA = false;
 }
 };

I haven’t begun thinking/worrying about using the spacebar.

The PI switch is working. Here’s the current animate function’s circular track section code again, with two new if/else statements.
Code:

 else if (( distNextC >= cTracSectK ) && ( distNextC < cTrackLengthK )) {
 // Curve motion. distance traveled/CTrack circumference.
 // 2PI*v*t/2*PI*r = PI*v*t/PI*r).  
 if ( piTopKOrNot ) {  
 numerator = piK * (distNextC - cTracSectK);
 }
 else {
 numerator = piG * (distNextC - cTracSectK);
 };
 if ( piBottomKOrNot ) {
 denominator = piK * r;
 }
 else {
 denominator = piG * r;
 };
 var trackAngle = numerator/denominator;
 sphereC.position.set( r*Math.sin( trackAngle ), 0, r*Math.cos( trackAngle ));
 sphereC.rotation.y = trackAngle;
 distTraveledC = distNextC;
 curSectionC = nexSectionC;
 }

Nevyn wrote.
A = 2PIg*v*t/(2*PIk*r)
= PIg*v*t/(PIk*r)

Once you have this up and running, we might try using that full equation and see how it goes. If we find that we need it, then that is good confirmation of Miles angular velocity equation.
Airman. A is the angle traveled by the object in circular motion. You said that if the pi’s used in the numerator and the denominator were the same, the angle traveled would reduce to, A = vt/r.

As you guessed on 10 October, and as I had previously coded correctly through trial and error - but which can now be verified true, motion around the circular track operates correctly only when the distance traveled is based on geometric pi, while the circumference must be calculated using kinematic pi. The simplification A = vt/r is not valid.

Would you care to elaborate on why this is a good confirmation of Miles angular velocity equation? I understand that curved motion is, in fact, a function of the radius of motion. How does that affect ( effect/affect I don't know how this word works either) the PI equal Four application?

P.S. remembered to add the gui additions.
.

LongtimeAirman
Admin

Posts : 1407
Join date : 2014-08-10

Back to top Go down

Animate the PI = 4 experiment - Page 5 Empty Re: Animate the PI = 4 experiment

Post by Nevyn on Mon Nov 04, 2019 11:23 pm

It currently is not confirmation of Miles' angular velocity equation, because it is not being used. You need to replace the v variable in my equation you posted above with the angular velocity equation. My guess is that it won't make much difference, if any. At the sizes we are working at here, the curvature of that equation is so close to straight that the differences will be small. However, the smaller you make this track, the more it will become important and needed.

It would probably be more correct to add it in rather than leave it out, but it isn't that important for this problem and what you are trying to show. I guess I would be interested to see it applied, and maybe run 2 tracks next to each other: one with and one without that equation. Your code is not setup for that, though, and it would take some thought to make it so. Actually, as I think about it, it wouldn't be that hard, but probably not worth the effort regardless.

I knew that A=vt/r was not right. It doesn't even look right. I was also pretty sure that the top half of the equation I was building would use 3.14, and the bottom half would use 4, once I realised that I had re-derived the same equation that I did in my Spin Velocity paper. It is always good to have confirmation, though.

I noticed you expanded this function out a bit:
Code:

 function nextFramePressed()
 {
   if ( paused ) {
     stepA = true;
   }
   else if ( !paused ) {
     paused = true;
     stepA = false;
   }

But you didn't need to. They are actually equivalent, but yours uses more effort to perform the same work. Firstly, you don't need that if( !paused ) of the else statement, because if the first condition fails (if( paused )) then you know that paused is equal to false, so you don't need to test it again. Secondly, you don't need the if statements at all, because we don't care about the current state of anything. We just want to set paused to false, so that the next frame is executed, and stepA to true, so that it will pause after it executes it. This way, the next frame button works in all situations. Even if the system is not currently paused, it will pause it after executing the next frame.
Nevyn
Nevyn
Admin

Posts : 1757
Join date : 2014-09-11

http://www.nevyns-lab.com

Back to top Go down

Animate the PI = 4 experiment - Page 5 Empty Re: Animate the PI = 4 experiment

Post by Nevyn on Tue Nov 05, 2019 7:18 pm

I think I see a slight misunderstanding of how boolean logic works. When a boolean expression is being evaluated, not all of that expression may actually be evaluated. Let's look at some examples to see how this operates.

AND

In an AND expression, generally denoted by && in the languages we have been dealing with, you have at least 2 terms in the expres​sion(we will keep it simple and only have 2). The AND operator requires that both sides evaluate to true, or the whole expression fails. Therefore, since we need both to succeed for the whole expression to succeed, if the first part fails, then we don't need to execute the second part. We already know that the whole expression is going to fail, so why waste the time evaluating the second expression?

OR

In an OR expression, generally denoted by ||, we find the opposite of an AND expression. In this case, either expression can make the whole expression succeed. So if the first part evaluates to true, then there is no need to evaluate the second part. Only if the first part fails will the second part be evaluated. So if the second part is evaluated, we know that the first one failed. There is no need to check it again.

The same things apply to if and else statements. If an else expression is being evaluated, then we know that the preceding ifs and else's have already failed. There is no need to check them again.

For these reasons, you must never rely on the execution of code in a boolean expression. That is, you should not call some function that performs something that you need done, because you don't know if it will get executed. That sort of code belongs inside of the if or other control structure, never in the boolean expression. Note that you have not done this, I am just pointing it out.
Nevyn
Nevyn
Admin

Posts : 1757
Join date : 2014-09-11

http://www.nevyns-lab.com

Back to top Go down

Animate the PI = 4 experiment - Page 5 Empty Re: Animate the PI = 4 experiment

Post by LongtimeAirman on Tue Nov 05, 2019 7:22 pm

.
Animate the PI = 4 experiment - Page 5 Header10
The latest includes html information: Miles Mathis’ Physics page link, Title, list of controls and minimum Spacebar directions.

Here’s the extended Spacebar directions; holding the spacebar down allows action to continue; releasing the Spacebar pauses motion. Briefly pressing or tapping the spacebar advances the scene by frames. Perfect, although a Spacebar escape might be nice.

Sir, I tried following your directions as carefully as I could, thank you very much. I deleted the else condition but I couldn’t make the Next Frame button work without the if statement. As it turns out, the Next Frame button is also working perfectly. Using Next Frame will create a Pause, and each next Frame button click advances the scene a frame forward. Here's the current next step event handler.

In trying to post this message I see you are getting more into the logic. Good.
Code:

 function nextFramePressed()
 {
 if ( paused ) {
 stepA = true;
 }
 else {
 paused = true;
 stepA = false;
 }
 };

I found a threejs example that contains html info and uses the keyboard, “three.js - platformer demo”, and wittled the nine keys and two functions down to one. The same Next Frame logic now appears in the new keyboardControl function.
Code:

 var keyboardControls = (function() {
 var keys = { SP : 32 };  
 var keysPressed = {};
 (function( watchedKeyCodes ) {
 var handler = function( down ) {
 return function( e ) {
 var index = watchedKeyCodes.indexOf( e.keyCode );
 if( index >= 0 ) {
 keysPressed[watchedKeyCodes[index]] = down; e.preventDefault();
 if ( paused ) {
 stepA = true;
 }
 else {
 paused = true;
 stepA = false;
 }
 }
 };
 };
 window.addEventListener( "keydown", handler( true ), false );
 window.addEventListener( "keyup", handler( false ), false );
 })([
 keys.SP   ]);
 })();

This PI Equal Four application runs horribly slow on my internet Explorer. I saw a tutorial and read somewhere that requestAnimationFrame functions varied across different browsers. They recommended adding the following code at the top of the script. I did and saw no change, does it have any value or should I get rid of it?
Code:

 window.requestAnimationFrame =
 window.requestAnimationFrame ||
 window.webkitReqeustAnimationFrame ||
 window.mozReqeustAnimationFrame ||
 window.oReqeustAnimationFrame ||
 window.msReqeustAnimationFrame ||
 function(callback) {
 window.setTimeout(callback,1e3/60);
 };

Seems like I’ve been making lots of changes lately, I haven’t included the CSS style or div info code changes, I’ll wait a bit.

However, the smaller you make this track, the more it will become important and needed.

The tracks don’t need to change size, they are a maximum distance reference limit, 10*r, with r being a millimeter or a light year. Allowing spheres to be much smaller than the tube – in radius, as small as we like, they will travel along the tube centerlines. It would then be possible for this app to show Miles’ or your full angular formula.
.

LongtimeAirman
Admin

Posts : 1407
Join date : 2014-08-10

Back to top Go down

Animate the PI = 4 experiment - Page 5 Empty Re: Animate the PI = 4 experiment

Post by LongtimeAirman on Wed Nov 06, 2019 7:40 pm

.
Nevyn wrote. I think I see a slight misunderstanding of how boolean logic works. When a boolean expression is being evaluated, not all of that expression may actually be evaluated.
You’re right, using the if statement I assumed I needed to cover all cases. Saving energy at if statements and explaining why makes for very interesting lessons. You demonstrate a fine ability at logic, you explaining why I do something wrong is scary, and greatly increases your credibility. I've missed some of what you've said, overall you've certainly taught me a lot, and forced me to learn it too by golly.

Airman said. They will travel along the tube centerlines.

Ok, that’s not correct. The PI=4 Experiment application shows a circular tube track at a fixed radius of curvature, regardless of the sphere size. The tubular tracks mimic StevenO’s PI=4 Experiment. You required it and I must admit I very much like the app’s tubes. Let the animated experiment tracks represent some maximum size, what good is it if we allow smaller spheres without greater curvatures of motion? One may vary timing slightly to accommodate the full formula but then nothing is being compared.

Animate the PI = 4 experiment - Page 5 Sevent10
Seven parallel/concentric sets of PI=4 tracks.

How might we simulate the full circular motion formula? I submit the above diagram as one possibility.

Seven green parallel straight tracks each 10*r long, each tangent to a different concentric blue circle at varying radius of r. Seven initial overlapped 2*r straight sections. The two tracks would be separated according to the spheres’ diameter. The red lines are the 2*r distance markers.

At which point I think, why include straight tracks? We know pi=4. We might want to compare the circular motions of any two different radial tracks. One thought led to another and soon I was looking down at the solar system.

I’m back. I think the existing app’s initial setup might be tweeked or not. I’m happy with it, and feeling pangs of post partum blues. I’m glad you agreed to this project. I’ve learned a lot – concentrating on circular motion. Glad you required the tubes. You never indicated your aproval of the hoops. Come to think of it, I suppose I should try and see whether wireframe tube material is an alternative to the parallel hoops.

Looking slightly ahead, how does this process end? Do I simply post the existing code? Can a standalone app be compiled – able to run without the complete .js sources such that anyone might be able to see it? Did you have any interest in making a running copy available at the Lab?
.

LongtimeAirman
Admin

Posts : 1407
Join date : 2014-08-10

Back to top Go down

Animate the PI = 4 experiment - Page 5 Empty Re: Animate the PI = 4 experiment

Post by LongtimeAirman on Thu Nov 07, 2019 1:32 pm

.
Animate the PI = 4 experiment - Page 5 Manytr10
That last set of seven parallel/concentric track distances was a bit off.

The distances in this diagram have been corrected in order to allow a closeup.  
.

LongtimeAirman
Admin

Posts : 1407
Join date : 2014-08-10

Back to top Go down

Animate the PI = 4 experiment - Page 5 Empty Re: Animate the PI = 4 experiment

Post by Nevyn on Fri Nov 08, 2019 5:44 pm

You've lost me with these latest multi-track images. I don't see what they offer or what they are trying to achieve. I think you may have misunderstood what I meant by the track being smaller and requiring Miles' angular velocity equation. I meant a complete scale down to the photon level. This would not change the track dimensions in a relative manner, but would just change the absolute distances to be around 10^-24m.

Where does this process end? With something that is publishable, if that is what you want to achieve, or it stops whenever you want, if you just wanted to learn about circular motion and/or programming techniques. I wanted you to take more control of the application and development process, and you have done that. I wanted you to own it. I wanted you to see that you can tackle an idea and progress through it using 3D models to help you see it a bit deeper than just thought alone might have done. I wanted to rip away the training wheels so that you might gain the confidence to approach these sorts of things on your own. I am still here for help and guidance, but you can do things on your own, too.

So, I see this going in one of two ways: you develop a web page that both contains this animation, and a description of what it is showing; or you look through Miles' PI=4 papers and find somewhere that this animation will fit into it so that it can be added to my Interactive Papers section. The latter might be easier, and you may find multiple spots for it, so don't limit yourself to just one. If you want to go that way, then we will need to go through how I put those pages together, but it isn't much different to what you are doing already, so don't be worried about that.
Nevyn
Nevyn
Admin

Posts : 1757
Join date : 2014-09-11

http://www.nevyns-lab.com

Back to top Go down

Animate the PI = 4 experiment - Page 5 Empty Re: Animate the PI = 4 experiment

Post by LongtimeAirman on Fri Nov 08, 2019 7:13 pm

.
Those latest two multi-track images were just concept ideas. Having given it a fair amount of thought I believe concentric orbitals can provide a good way to demonstrate the full circular motion formula. I’ll be happy to work the idea up formally in due course. In no way do I wish to alter the current app as indicated by those two diagrams.

Ripping off my training wheels indeed! I thought it was a race against time to produce a semi-complete package before it was too late. The thought of carrying-on is a great relief. Glad to be at your disposal. Adding to your interactive papers would be wonderful.

Animate the PI = 4 experiment - Page 5 Tubesa10
In this image, the 122 hoops (alas, no flames yet) – 61 per track, have been replaced by two cylinders and a torus.

Cylinders and Torus. Rather than some transparent solid, I went with wireframe material. The code is far more efficient, saving 73 code lines, (down from 526 to 453), including 122 distance hoops built into the geometries. The downside is – the spheres are much less visible. The cross sections of the tubes or torus should appear round; four sides is an unacceptable diamond square that draws way too much attention to itself. Eight sides is round enough, and is shown in the image above, but with 8 long 10*r lines come two new alternate spin sets of 8 long spiral lines; 24 grey lines compared to the previous four long green lines. The spheres are much less visible. The only other problem is the “Cannot use import statement outside a module” errors when accessing both new threejs geometry sources.

Tossing out the cylinders and torus and their sources, and sticking with the previous grey circles and long green lines, I nonetheless corrected a gross inefficiency I knew I would eventually get around to. Circles were being re-created 3 times in both the straight sections and curved. Now, yZPCircle is created once. Saving appox 21 code lines, ending at 505. I think I’ll do the same with the 11 track markers. Good to know I’m finally saving energy.
.

LongtimeAirman
Admin

Posts : 1407
Join date : 2014-08-10

Back to top Go down

Animate the PI = 4 experiment - Page 5 Empty Re: Animate the PI = 4 experiment

Post by Nevyn on Fri Nov 08, 2019 9:35 pm

Can you use a transparent tube and show some screenshots? Wireframe can be useful, but rarely what you want in a final product.

Don't be afraid to use a heavy transparency. Maybe 0.2 for the opacity. You might have to play with the color so that the tube is still visible. Tube transparency could also be added as a menu control, if you want. However, if used for an interactive paper, the menu will be unavailable, so don't get too attached to it.

The markers should be more visible than the rest of the tube, too. They could use some labels for the main ones we care about, showing how they match on both tracks.

What I would really like is for the current section of tube that the balls are in to light up somehow. Maybe they become a different color, a bit brighter than normal, or even a completely different color, whatever works well. The labels could also light up, even if the tubes don't.
Nevyn
Nevyn
Admin

Posts : 1757
Join date : 2014-09-11

http://www.nevyns-lab.com

Back to top Go down

Animate the PI = 4 experiment - Page 5 Empty Re: Animate the PI = 4 experiment

Post by LongtimeAirman on Sat Nov 09, 2019 7:32 pm

.

Can you use a transparent tube and show some screenshots? Wireframe can be useful, but rarely what you want in a final product.
Amn. Of course; here are two sets - white and blue clear materials for comparison.
Animate the PI = 4 experiment - Page 5 Mostly11
Yes I was skeptical, it’s easy to see the mostly transparent, aerogel-like material making up the cylinders and torus do make the tracks appear more unified or defined; the lines aren’t just hanging in empty space. Even though your suggested opacity level looked best there’s no way around the fact objects inside the tube are dimmer. All the lines and hoops were inside the tubes, note the two-toned blue sphere at the right, so I expanded the hoops and marker lines outward.

Animate the PI = 4 experiment - Page 5 Mostly10
There’s one exceptional odd area, the section of torus that intersects with the initial straight section leading to the starting/finishing lines.

The markers should be more visible than the rest of the tube, too. They could use some labels for the main ones we care about, showing how they match on both tracks.
Amn. I eliminated grey hoops that were drawn at the same locations as the red markers and so now the markers are more distinct, let me know if you’d like to make them moreso. Points if you notice the marker horizontal arms are still a bit short.

What I would really like is for the current section of tube that the balls are in to light up somehow.
Amn. Two possibilities come to my over-optimistic, in-experienced mind. 1) install point lights inside each sphere, The tubes, made out of meshBasicMaterial ‘don’t react to light’. They may need to be upgraded to Lambert in order to make the track light up where the sphere is. Or 2) use shader material. That sounds sexier but probably way more complicated.    
.

LongtimeAirman
Admin

Posts : 1407
Join date : 2014-08-10

Back to top Go down

Animate the PI = 4 experiment - Page 5 Empty Re: Animate the PI = 4 experiment

Post by Nevyn on Sun Nov 10, 2019 5:38 pm

You definitely don't want to use lights, nor shaders either. All you need is to create individual track segments with their own Material object (not shared) and update the color property of the Material depending on whether the ball is in that segment or not.

I don't think the grey markers are needed. They just clutter up the track. The red ones are fine. Maybe make the PI marker a different color to differentiate it.

That small section is caused by the additive blending on two transparent things that are inline with respect to the camera. You can change the blending method, but I don't know what is available and whether it will fix it as you want it to. Worth a go, though.

While transparent tubes will lower the intensity of the ball color, only you really know that. The general user will just see it in that subdued way. It is easy to get used to vibrant colors, but that doesn't mean they are better. I get hooked on vibrancy quite often, and have to convince myself away from it.
Nevyn
Nevyn
Admin

Posts : 1757
Join date : 2014-09-11

http://www.nevyns-lab.com

Back to top Go down

Animate the PI = 4 experiment - Page 5 Empty Re: Animate the PI = 4 experiment

Post by LongtimeAirman on Sun Nov 10, 2019 7:31 pm

.
Animate the PI = 4 experiment - Page 5 Almost10
Thanks for calling me off the lights, I had gotten two stuck in the tube openings.

Just when the hoops and markers were cooperating – the hoops are gone. I take it you want me to drop the four long green lines as well? Done. The red horizontal and vertical lines too?

I'll change the pi marker next. Do you still want labels? Lighting sections of the tubes eh, interesting. I must contemplate that.

Noticed today that there’s no DAT gui when I run this thing in fireFox. No problem, I'll continue using chrome.
.

LongtimeAirman
Admin

Posts : 1407
Join date : 2014-08-10

Back to top Go down

Animate the PI = 4 experiment - Page 5 Empty Re: Animate the PI = 4 experiment

Post by Nevyn on Sun Nov 10, 2019 9:27 pm

Looking better already!

The red markers could be replaced by something a bit more 3D. They can go outside of the tube, and they can be wider than a line. They also don't need to be transparent, if that works. Think of some sort of join across 2 separate tubes that rises above the tube, with beveled edges that connect to the tubes. That would be 3 pieces: 2 beveled edges and a center piece. The center piece could be what highlights as the ball passes that marker. That's just one idea that could work.

Some textures would probably be useful, too. At least for the balls, but even the tubes, maybe. That does get complicated but you can use the textures from my site to avoid cross origin problems.

What are those red and green thingy's on the bottom right? Failed spheres?

I'm kinda liking the idea of a light being inside the ball. But it would not roll with the ball, but must curve around the circle. Could be tricky, but could look good too.
Nevyn
Nevyn
Admin

Posts : 1757
Join date : 2014-09-11

http://www.nevyns-lab.com

Back to top Go down

Animate the PI = 4 experiment - Page 5 Empty Re: Animate the PI = 4 experiment

Post by LongtimeAirman Yesterday at 8:04 pm

.
Animate the PI = 4 experiment - Page 5 Rubber10
The two images are intended to convey the resulting ‘dramatic’ light and shodows cast, especially on the curved track.

It wasn’t too difficult to install a point light in each sphere and advance them along with the spheres. They don’t need to rotate. The red line markers are currently transparent rubber grommets that don’t always light up.

The red and green thingy's were point light helpers. Now the helpers are much smaller blue spheres and white octagons identifying the point light source.

I have no problem with the torus/initial straight section overlap.

Now that the grey lines are gone, I turned them into 50 or 60 tube sections. The result, all the internal walls, worked just as well as the grommets and were just as distracting as the grey lines. Now I’m happy without them. Keep it pure and simple, there’s plenty involved in getting the lighting right. That is, of course, if you agree.

Animate the PI = 4 experiment - Page 5 Pntlgt10
Here, the section markers are two concentric circles.

How do I ensure that all surfaces - front, back, and inside of the grommets and tubes are reflecting light?
.

LongtimeAirman
Admin

Posts : 1407
Join date : 2014-08-10

Back to top Go down

Animate the PI = 4 experiment - Page 5 Empty Re: Animate the PI = 4 experiment

Post by Nevyn Yesterday at 8:32 pm

Airman wrote:How do I ensure that all surfaces - front, back, and inside of the grommets and tubes are reflecting light?

Every Material object has a side property which can be THREE.FrontSide, THREE.BackSide, or THREE.DoubleSide. This determines which side will be rendered. If the camera is facing the back side, but only the front should be rendered, then it won't render. Set the grommets (and probably the tubes) to DoubleSide and it should work as you want it to.

Try using a SpotLight. This has a position and a direction, which should point along the velocity vector for the ball. This may require some special handling for the curved section (which I was referring to in the last post). You may be able to just set the lights direction to the velocity and everything will work out. Just have a play with it and see what you can do.
Nevyn
Nevyn
Admin

Posts : 1757
Join date : 2014-09-11

http://www.nevyns-lab.com

Back to top Go down

Animate the PI = 4 experiment - Page 5 Empty Re: Animate the PI = 4 experiment

Post by Sponsored content


Sponsored content


Back to top Go down

Page 5 of 5 Previous  1, 2, 3, 4, 5

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum