Skip to main content
Participant
October 8, 2020
Question

arcSin function in adobe

  • October 8, 2020
  • 1 reply
  • 589 views

Hey, I need help to use values from two different textboxes and show the result in the third box.

example: 

Box1: 15 (adjacent)

Box2: 115 (hyptotenuse)

Box3: I need the sin angle

 

Anybody that can help me with the "Math.asin" code for this?

 

Thank u in advance!! 

This topic has been closed for replies.

1 reply

Karl Heinz  Kremer
Community Expert
Community Expert
October 8, 2020

Why do I have the feeling we are doing your math homework? 🙂 

 

The formula to determine the angle when the adjacent and hyotenuse are given, is cos(alpha) = adjacent/hypotenuse

So alpha = arccos(adjacent/hyponeuse)

 

To express that in JavaScript, we use the Math.acos function:

 

 

var adj = this.getField("Box1").value;
var hyp = this.getField("Box2").value;
event.value = Math.acos(adj/hyp);

 

 

You will use this as the custom calculation script for Box3. This code is not doing any error checking, so you may end up with an exception. I'll leave that up to you to add. Also, the angle is expressed in rad, so you will have to convert to degrees. 

Participant
October 8, 2020

Thank You very much for taking the time to answer!

 

Hehe, This got nothing to do with math homework. Im a studentpilot and we use a navigation pdf form. And it takes so much time by plotting and calculating. Im trying to make the form as much as possible automatic with as few inputs. 

I found a code on this support community and made some modifications and it work. The only problem I have is to get the angle from rad to deg. Could you be so kind to take the time to help me again?

The code I found and modified looks like this; 

var v1 = Number(this.getField("TextField5").valueAsString);

var v2 = Number(this.getField("TextField6").valueAsString);

var v3 = Math.asin(v2/v1);

if (v3==0) event.value = "";

else event.value = v3;

Karl Heinz  Kremer
Community Expert
Community Expert
October 8, 2020

Change this line "var v3 = Math.asin(v2/v1);" to this:

 

var v3 = Math.asin(v2/v1) * 180 / Math.PI;