Advertisement
ad2bg

inside_volume

May 25th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(input) {
  2.     for (let i = 0; i<input.length; i+=3){
  3.         let x = input[i];
  4.         let y = input[i+1];
  5.         let z = input[i+2];
  6.  
  7.         if (inVolume(x,y,z)){
  8.             console.log('inside');
  9.         }  else {
  10.             console.log('outside');
  11.         }
  12.     }
  13.  
  14.     function inVolume(x, y, z) {
  15.         let x1 = 10, x2 = 50;
  16.         let y1 = 20, y2 = 80;
  17.         let z1 = 15, z2 = 50;
  18.  
  19.         return x1 <= x && x <= x2 && y1 <= y && y <= y2 && z1 <= z && z <= z2;
  20.     }
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement