Vector addition in Mag & Dir form
How do I make an vector addition in mag & dir form?
What is a vector addition in mag & dir form? How do you make a vector addition in mag & dir form? This script and codes were developed by Yoann Nouveau on 19 December 2022, Monday.
Vector addition in Mag & Dir form - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Vector addition in Mag & Dir form</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
</head>
<body> <script src="js/index.js"></script>
</body>
</html>
Vector addition in Mag & Dir form - Script Codes JS Codes
"use strict";
function round(a) { return Math.round(a * 100) / 100;
}
function addVector(w, x) { var y = arguments.length <= 2 || arguments[2] === undefined ? 0 : arguments[2]; var z = arguments.length <= 3 || arguments[3] === undefined ? 0 : arguments[3]; //convert a and b to compound form A and B x = x * Math.PI / 180; z = z * Math.PI / 180; var A = { x: round(w * Math.cos(x)), y: round(w * Math.sin(x)) }, B = { x: round(y * Math.cos(z)), y: round(y * Math.sin(z)) }; //add them together var C = { x: round(A.x + B.x), y: round(A.y + B.y) }; C.mag = Math.pow(Math.pow(C.x, 2) + Math.pow(C.y, 2), 1 / 2); C.dir = Math.atan(C.y / C.x) * 180 / Math.PI; C.mag = round(C.mag); C.dir = round(C.dir); //Quadrant adjustment if (C.x < 0 && C.y > 0 || C.x > 0 && C.y < 0) { //Quad II & III C.dir += 180; } else if (C.x < 0 && C.y < 0) { //Quad IV C.dir += 360; } console.clear(); console.log(C); return C;
}
addVector(7, 160, 9, 20);
Developer | Yoann Nouveau |
Username | YoannN2 |
Uploaded | December 19, 2022 |
Rating | 3 |
Size | 2,347 Kb |
Views | 4,048 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Material Design Ripple effect on buttons | 3,261 Kb |
Project Euler 7 | 2,142 Kb |
Some buttons | 3,273 Kb |
Animitating Hamburgers | 3,857 Kb |
User Profile | 5,877 Kb |
Project Euler 1 | 2,353 Kb |
Test | 2,380 Kb |
Off Menu Canvas Experiments | 4,298 Kb |
Checkbox jQuery | 2,445 Kb |
PongJS | 5,461 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
A Pen by Final Boss tommyb9 | FBtommyb9 | 55,354 Kb |
Flat UI - Checkbox FIX | ARS | 2,663 Kb |
Airbnb Homepage | SindhujaD | 2,480 Kb |
CSS Dynamic Width Square Div | Elleestcrimi | 2,861 Kb |
LDE old privacy page | Jasonangle | 2,339 Kb |
Button shaking | SusanneLundblad | 2,227 Kb |
RPG Style Text Dialogue | Odylic | 2,635 Kb |
Side Sliding Menu CSS | EduardL | 4,388 Kb |
Part 19 Bootstrap split button dropdown | Venkatesha | 1,601 Kb |
Text Looping Transition | Agelber | 5,619 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!