/* * Generated by www.nevyns-lab.com on 2019-05-21T15:27:38+10:00. * * MIT License * * Copyright (c) 2017 Nevyn's Lab * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */ var Equations = (function() { /** * The module object is what you will use in your application, but not by that name. * You will reference it in your code as "Equations". */ var module = {}; /** * Angle Velocity */ (function() // Create a closure to avoid function name collisions { /** * Private function that calculates angle. */ var calcAngleImpl = function( radius, velocity ) { // a = PIg * sqrt( 2 * r * sqrt( v^2 + r^2 ) - 2 * r^2 ) / (PIk*r) var r2 = 1.0 * radius * radius; var v2 = 1.0 * velocity * velocity; var omega = Math.sqrt( ( 2.0 * radius * Math.sqrt( v2 + r2 ) ) - 2.0 * r2 ); return Math.PI * omega / ( 4.0 * radius ); }; /** * This public object contains functions for Angle Velocity. * You can reference it in your code as "Equations.AngleVelocity". */ module.AngleVelocity = { type: "angle_velocity", version: "1.0", title: "Angle Velocity", desc: "These calculators can be used to generate data using radius, tangential velocity and angle velocity.", /** * The public function to calculate angle. * You can reference it in your code as "Equations.AngleVelocity.calcAngle( ... )". */ calcAngle: calcAngleImpl, /** * The public function to calculate an array of angle values by varying the radius. * You can reference it in your code as "Equations.AngleVelocity.calcAngleVsRadius( ... )". * The labels parameter is optional. If supplied, it must be an array and will be * populated with the radius value for each angle value. */ calcAngleVsRadius: function( radiusMin, radiusMax, radiusStep, velocity, labels ) { var value = radiusMin; var data = []; while( value <= radiusMax ) { if( labels ) { labels.push( value ); } data.push( calcAngleImpl( value, velocity ) ); value += radiusStep; } return data; }, /** * The public function to calculate an array of angle values by varying the velocity. * You can reference it in your code as "Equations.AngleVelocity.calcAngleVsVelocity( ... )". * The labels parameter is optional. If supplied, it must be an array and will be * populated with the velocity value for each angle value. */ calcAngleVsVelocity: function( velocityMin, velocityMax, velocityStep, radius, labels ) { var value = velocityMin; var data = []; while( value <= velocityMax ) { if( labels ) { labels.push( value ); } data.push( calcAngleImpl( radius, value ) ); value += velocityStep; } return data; } }; }()); // Execute the function immediately return module; }());