Converting a intricate visual into an array or alternative data structure using JavaScript/TypeScript

As a passionate aviation enthusiast, I am looking to develop a tool that can calculate the necessary takeoff speeds for a Boeing 747-400F. With access to authentic documentation for this aircraft, I have all the reliable information needed.

The image provided depicts various climatic conditions, each categorized into different regions (A, B, D, etc.). By inputting the current temperature and airport elevation, it is possible to determine which region corresponds to the conditions you are dealing with, such as region A.

Background

Once you have identified the region (such as A), you can refer to a second table where the weight of the aircraft needs to be known. By combining this weight information with the region data, you will be able to establish the required takeoff speeds: V1, VR, V2.

While interpreting information from these charts is straightforward, my goal is to automate the initial step:

Question

Is there a way to convert the first graphic into a structured data format that can be utilized in Javascript or Typescript code?

Answer №1

To determine the boundaries of the region, you can identify the segments of the polylines that form those borders. Once you have identified these segments, you can use the provided temperature (x-coordinate) to locate the segments that encompass that temperature (at most one per border). Then, you can pinpoint the lowest segment above the given point. By iterating through the borders from bottom (A) to top (J), the first one with a segment above the specified pressure-altitude will identify the region.

The main task is to identify the segments of the polylines. Here are the coordinates:

[
[[-55.2,29],[-50,160],[-40.7,335],[-30.2,510],[23.5,1239],[29.3,1050],[32.2,496],[38.3,-1370],[40.1,-2012]],
[[-55.2,2230],[10.2,3017],[16,3090],[22.4,3032],[27.6,2595],[31.9,2041],[34.6,1458],[40.1,58],[42.4,-641],[46,-2012]],
...

Additionally, here is a code snippet that utilizes this information to determine the region based on a provided temperature and pressure-altitude:

// The region's border lines specified as polyline coordinates:
const borders = [[...], [...], ...];

// Function for finding the region corresponding to a given temperature (C°) and pressure-altitude (Ft):
function getRegion(temperatureCelcius, pressureAltitudeFeet) {
    // Return null if inputs are out of range:
    if (temperatureCelcius < -55 || temperatureCelcius > 75) return null;
    if (pressureAltitudeFeet < -2000 || pressureAltitudeFeet > 10000) return null;
    // Find the region:
    const region = borders.findIndex(border => {
        ...
    });
    return "JABCDEFGHI"[region+1]; // Translate region index to letter
}

// Example: Temperature of 30°C and pressure-altitude of 5000 ft.
const region = getRegion(30, 5000);
console.log(region); // Result: "E"

The function will output null if either input value is out of range.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What steps should I take to develop an Outlook add-in that displays read receipts for action items in sent emails?

Currently, I am in the process of developing an add-in that will enable me to track email activity using a tool called lead-boxer (). With this add-in, I am able to retrieve detailed information about users who have opened my emails by sending them with an ...

What is the best way to extract value from an input text that is being repeated using ng-repeat within a Tr

Having a table with repeated rows in angular, you can also dynamically add new rows by clicking a button. If there are already 3 repeated rows and 2 extra rows are added with data entered, how can we retrieve all the data from the table in the controller ...

Tips for Sending Request Parameters to Angular Application

My Angular app, created with Angular CLI, is hosted on Heroku using express. The setup looks like this: const express = require('express'); const app = express(); // Serve the static files in the dist directory app.use(express.static(__dirname + ...

Undefined value is returned for Vue 3 object property

Is there a way to extract additional attributes from the Keycloak object ? Currently, If I try, console.log(keycloak) it will display the entire keycloak object. Even after reloading, it remains in the console. However, when I do, console.log(keycloak.t ...

Can you find an `x` value that does not result in 1 when raised to the power of 0 using Math.pow()?

I recently came across a question that discussed the scenario where Math.pow(0, 0) === 1 evaluates to true. The documentation outlines the rules for x^y: If y is NaN, the result is NaN. If y is +0, the result is 1, even if x is NaN. If y is − ...

AngularJS: Exploring the Power of Restangular Library

Currently, I am exploring the wonderful Restangular library and encountering an issue while attempting to fetch JSON objects and bind them to the $scope object. Within my Factory script, I have a function that returns a list of blogs using the Restangular ...

Utilizing Twitter Bootstrap to populate form fields from a dropdown selection

I am currently using twitter bootstrap for my front end web development project. I have successfully implemented a text field with a dropdown menu right next to it: <div class="input-group"> <input type="text" class="form-control" name="ope ...

Node.js client-side code

Hi all, I am currently exploring Nodejs and experimenting with setting up a server-client connection using sockets. The server side seems to be functioning properly, but I am encountering some difficulties with the client side connection. I would appreciat ...

Automatically populate the article number field once the article name has been entered

I am currently working on a HTML <form> using PHP. Within this form, there are three <input> fields. The goal is to have the second <input> field automatically populate once the first one is filled out. This will involve triggering an HTT ...

Sorry, but React does not accept objects as valid children. Make sure the content you are passing is a valid React child element

I encountered an issue with rendering on a screen that involves receiving an object. The error message I received is as follows: Error: Objects are not valid as a React child (found: object with keys {_U, _V, _W, _X}). If you meant to render a collection o ...

What is the best way to link my JSON object to specific properties of my data object in vue.js?

I am currently using Vue.js for my frontend development and I have a JSON object that I need to map to set certain properties in my data(). I have confirmed that the server connection is working and that the JSON object is received properly. In my comput ...

Personalized dropdown appearance

During my work on a select box, I discovered that custom styling is not possible. I attempted to use some plugins but did not find one that met my needs. I am seeking a dropdown menu with options in both black and gray, similar to this template but using ...

Is it possible to validate link clicks and integrate PHP within JavaScript functions?

Before anyone mentions security concerns, please refrain. Imagine I have an index.php. This page contains several links to 'home.php', each with different data stored in the href attributes. For example: Link 1: 'home.php?data=1&count ...

Scrolling to an element is not possible when it has both position absolute and overflow-x hidden properties

My issue involves animating ng-view with a slideup animation, requiring absolute positioning of elements and overflow-x: hidden to clip the content. However, I need to use the scrollTo element functionality on one sub-page, which doesn't work when bot ...

Position the text of an h1 element next to its corresponding image in HTML5

I'm attempting to create a HEADER element with an H1 tag alongside a logo image. Here is the code snippet: Company name However, the issue is that "Some title" is not displaying correctly as it appears b ...

"Unexpected discrepancy: Bootstrap Glyphicon fails to appear on webpage, however, is visible

I am having some trouble getting the glyphicon to display properly in my side nav. The arrow head should rotate down, which is a pretty standard feature. Here is the link to the page: The glyphicon should be visible on the "Nicky's Folders" top leve ...

Error alert: Controllers and services within the same module are experiencing injection issues

I'm in the process of creating an angular module that contains controllers and a service all within the same module. The issue I'm facing is an unknown provider error Error: $injector:unpr. I have made sure not to redefine the module multiple tim ...

Angular JS Array with N-level hierarchy

I am developing an application for questionnaires, where questions have responses that can lead to child questions with even more responses. This creates a hierarchical structure of multiple levels. I am looking for the best strategy to display this data i ...

Problem with Loading OBJ Files in THREE.JS

I'm having difficulties with the OBJ Loader in THREE.JS. Here is the code I've written: //Setting up the scene scene = new THREE.Scene(); //Creating the camera camera = new THREE.PerspectiveCamera(60, window.innerWidth/window.innerHeight, ...

Multiple renderings of React useEffect

I am currently exploring Hooks. I previously implemented a project using componentDidMount. Now, as I dive into learning about hooks, I am in the process of rewriting this project to incorporate hooks. My initial goal is to fetch data and display it on th ...