-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
49 lines (42 loc) · 1.31 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function CalcController($scope) {
$scope.outputvalues = [];
$scope.calcApert = function() {
var inputFocal = $scope.inputFocal;
var inputAperture = $scope.inputAperture;
var inputWidth = $scope.inputWidth;
var inputHeight = $scope.inputHeight;
var outputWidth = $scope.outputWidth;
var outputHeight = $scope.outputHeight;
var diag1 = Math.sqrt((inputWidth * inputWidth) + (inputHeight * inputHeight));
var diag2 = Math.sqrt((outputWidth * outputWidth) + (outputHeight * outputHeight));
var outputAperture = inputAperture * (diag1 / diag2);
if ( outputAperture > 0 )
{
return (Math.round(outputAperture * 100) / 100);
}
else
{
return "...";
}
};
$scope.calcFocal = function() {
var inputFocal = $scope.inputFocal;
var inputAperture = $scope.inputAperture;
var inputWidth = $scope.inputWidth;
var inputHeight = $scope.inputHeight;
var outputWidth = $scope.outputWidth;
var outputHeight = $scope.outputHeight;
var area = inputWidth * inputHeight;
var diag1 = Math.sqrt((inputWidth * inputWidth) + (inputHeight * inputHeight));
var diag2 = Math.sqrt((outputWidth * outputWidth) + (outputHeight * outputHeight));
var outputFocal = inputFocal * (diag1 / diag2);
if ( outputFocal > 0 )
{
return (Math.round(outputFocal * 100) / 100);
}
else
{
return "...";
}
};
}