/* * Generated by www.nevyns-lab.com on 2019-05-21T15:29:47+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 velocity. */ var calcVelocityImpl = function( radius, angle ) { // v = a * PIk * r * sqrt( a^2 * PIk^2 + 4 * PIg^2 ) / 2 * PIg^2 return angle * 4.0 * radius * Math.sqrt( angle * angle * 16.0 + 4.0 * Math.PI * Math.PI ) / ( 2.0 * Math.PI * Math.PI ); }; /** * 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 velocity. * You can reference it in your code as "Equations.AngleVelocity.calcVelocity( ... )". */ calcVelocity: calcVelocityImpl, /** * The public function to calculate an array of velocity values by varying the radius. * You can reference it in your code as "Equations.AngleVelocity.calcVelocityVsRadius( ... )". * The labels parameter is optional. If supplied, it must be an array and will be * populated with the radius value for each velocity value. */ calcVelocityVsRadius: function( radiusMin, radiusMax, radiusStep, angle, labels ) { var value = radiusMin; var data = []; while( value <= radiusMax ) { if( labels ) { labels.push( value ); } data.push( calcVelocityImpl( value, angle ) ); value += radiusStep; } return data; }, /** * The public function to calculate an array of velocity values by varying the angle. * You can reference it in your code as "Equations.AngleVelocity.calcVelocityVsAngle( ... )". * The labels parameter is optional. If supplied, it must be an array and will be * populated with the angle value for each velocity value. */ calcVelocityVsAngle: function( angleMin, angleMax, angleStep, radius, labels ) { var value = angleMin; var data = []; while( value <= angleMax ) { if( labels ) { labels.push( value ); } data.push( calcVelocityImpl( radius, value ) ); value += angleStep; } return data; } }; }()); // Execute the function immediately return module; }());