I have coded a simple calculation app using MIT AppInventor and I want to transfer the exact set of calculations to Java for an Android app but they are different frameworks.So I did my best to trandfer the calculation to Java as shown below.But the Java calculation is wrong in comparison with the Kawa code.
Can someone point out where the Java code is changed from how I'm calculating in the AppInventor code?
This is the Kawa code for the set of calculations,offset depth,legth and duct depth are user inputted values:
Tri 1=atan(Offset Depth/Offset Length)
Mark 1=sqrt(Offset Length^2+Offset Depth^2)
Tri 2=(180-Tri1)/2
Mark 2=Duct Depth/(tan(Tri 2))
Then this is how I tried to translate that calculation to Java:
tri1,tri2,marking1,marking2 are of type double
and the user inputs offsetLength,depth and ductDepth are also double
tri1 = Math.atan(offsetDepth / offsetLength);
marking1 = Math.sqrt(Math.pow(offsetLength,2) + Math.pow(offsetDepth,2));
tri2 = (180 - tri1) / 2;
marking2 = ductDepth / Math.tan(tri2);
This is a screenshot of the application so people can get a better understanding of the calculation: