Calculating arc tangent of 0.12 degrees

ActionScript really does know to be annoyed sometimes!
I'm trying to calculate arc tangent of a number.
I'm using the following code:
arctg_mi = Math.atan(Math.PI/180 * 0.12)
As you can see, I need to calculate arc tangent of 0.12
degrees. Problem is that it just cannot be done. I'm not an expert
of mathematics, but it seems that radian system does not behave
like degrees system when it comes to arc tangent!
I used Windows' Calculator, and arc tangent of 0.12 in
degrees system is about 6.84, which is right. But when I switch to
radian system, then convert 0.12 degrees to radians, and then try
to calculate, I get the wrong value. Totally wrong!
Solution? Either I am so stupid that I missed some ordinary
procedure in all of this, or these two systems are not comparable.
Or do I need to convert the value I get back to degrees
system somehow?
The easiest thing to do would be to switch Flash to degrees
system, but that can't be done, so...
Help, please...

It comes out to 6.84 in Flash too, if you do it right. First
off, degrees
per radian is 180/Pi not Pi/180. And you want to get the
arctangent of the
value, which comes out in radians, then convert to degrees -
you don't want
to take the arctangent of the degrees....
So:
var degreesPerRadian = 180.0 / Math.PI;
trace(Math.atan(0.12) * degreesPerRadian)
6.84277341263094
HTH
Dave -
Adobe Community Expert
www.blurredistinction.com
www.macromedia.com/support/forums/team_macromedia/

Similar Messages

  • I need help understanding how this works. AS 2.0

    Its my first time here and i only started learning flash today. I aint too great with maths and i was showed this piece of code that makes a triangles point follow the cursor. It involved mathimatical things ( which i aint so great at) and the guy said "You dont need to know how it works, just how to use it." well i copied his code and it worked, but i have no idea how to use it in other rotation apart from the one he taught us. I dont even understand how to redo his code i saved it to a word document and anytime i wanted to make something rotate something in that fashion i would refer to that. But i dont want to have to do that, i want to know how to use it, dont have to understand it, but use it for other rotation matters. If you are going to help, please try to be a bit simmple i explaining it, cause im new. Dont get me wrong i aint thick but i can find it a bit hard to follow some things, that is i my current problem.
    here is the rotation code:
    onEnterFrame = function()
    hero._rotation = getmouse(hero);
    getmouse = function(mc:MovieClip):Number
    dy = _ymouse-mc._y;
    dx = _xmouse-mc._x;
    rad = Math.atan2(dy,dx);
    rotate = rad*180/Math.PI
    return rotate+90
    also if it helps, here is the video i was watching: http://www.youtube.com/watch?v=w3OfrpbNhHs
    please if you can, explain how the entire thing works.
    thanks for any help given in advance.

    Hi,
    Here's a short primer.  It may not be sufficient but here goes.
    1st, move the closing bracket at the end and put it on the third line.  This makes the code more efficient
    onEnterFrame = function(){                               // this causes Flash to repeatedly
                                                                              execute the next line at the
                                                                              frame rate you selected
                                                                              for your document
           hero._rotation = getmouse(hero);               // this tells Flash to rotate a
                                                                              movie clip (named hero) based
                                                                              on the function getmouse()
    };                                                                     // putting the }; here makes the
                                                                              code more efficient and readable
    getmouse = function(mc:MovieClip):Number{   // This is the function called with
                                                                             mc referring to hero that was
                                                                             passed from the second line.
         dy = _ymouse-mc._y;                                // dy means delta y which subtracts
                                                                            the y position of the movieclip
                                                                            from the mouses y position
         dx = _xmouse-mc._x;                               // dx = delta x (same as above line
                                                                            but on the x axis)
                                                                         // once you have the x and y sides
                                                                            you male a triangle.
                                                                            Now use trig to find the angle
         rad = Math.atan2(dy,dx);                           // the computer works in radians
                                                                            the arc tangent atan2 will give the
                                                                            angle in radians
         rotate = rad*180/Math.PI                            // you want to convert the radians to
                                                                            degrees, that's what this line does
         return rotate+90                                         // this returns the value of rotate back
                                                                            to the calling function in line 2.
                                                                            the +90 determines which part
                                                                        // of the hero movie clip is facing the
                                                                           mouse.
    If you put the mouse cursor over any of the green reserved words above in the Actions panel you will get a desctription of what these do.
    hope that helps.

  • How to get Runtime for each statement in abap program

    Is there any tool which tells the runtime of each statement in our program..apart from sto5 and se30
    Thanks in advance
    PRASANNA

    Determining the calculation time for calculating the tangent of 1. Since the runtime of the statement is less than a microsecond, the runtime of several executions in an inner loop is measured. The exection time for the loop itself is also measured in order to deduct it as an offset. These measurements are executed several times in an outer loop and the mean value is created using division by n0. Through division by ni, the runtime of an individual statement is determined.
    DATA: t0    TYPE i,
          t1    TYPE i,
          t2    TYPE i,
          t3    TYPE i,
          t4    TYPE i,
          tm    TYPE f,
          no    TYPE i VALUE 100,
          ni    TYPE i VALUE 1000,
          res   TYPE f.
    DO no TIMES.
      GET RUN TIME FIELD t1.
      DO ni TIMES.
        res = TAN( 1 ).
      ENDDO.
      GET RUN TIME FIELD t2.
      GET RUN TIME FIELD t3.
      DO ni TIMES.
      ENDDO.
      GET RUN TIME FIELD t4.
      t0 = t0 + ( ( t2 - t1 ) - ( t4 - t3 ) ).
    ENDDO.
    tm = t0 / ni / no.
    Source: SAP Help.
    Regards,
    Santosh

  • Movement in 2D

    Hi,
    i would like to develop a program to make a playbook for american football. I haven't run across a free application that does this so i want to try it myself.
    The view would be 2D and all players would have an x, y coordinate, velocity, acceleration and agility for starters.
    You would plot out a course for a player by clicking on the field and thus creating a list of x,y points the player would have to run too.
    But i'm not sure how i can calculate the next position given the player his current x,y coordinate and speed. Or if i count in the agility, how fast a player can turn. Are their any tutorials (java or c++) that show how to do this?
    Thanks

    I ususally use something like this..
    public class Vector2D {
        double xmag,ymag,totalMag;
        double angle;  // in radians
        public MotionVector(double xmag, double ymag){
            this.xmag = xmag;
            this.ymag = ymag;
            // Arc Tangent of y over x yields angle
            angle = Math.atan((double)(y/x));
            // Pythagrean (spelling?) theorem
            totalMag = Math.sqrt((double)((xmag*xmag)+(ymag*ymag)));
         * getters & setters
    }And when I need to translate my object to draw I just get the x and y magnitudes in units per second, multiply them by the elapsed time since the last redraw ((Units / Seconds)*Elapsed Seconds = Units). If, for instance the player needs to change direction, just set the variables for its cooresponding Vector2D object and wait for the next redraw. If you want to add acceleration, just tack on another vector of which you multiply by the time squared to get its unit-change.
    // Keep in mind that this is untested, but to my knowledge it should work given you create the addVectors(Vector2D []) method.
    import java.awt.geom.*;
    public class MotionObject{
        Vector2D [] velocities;
        Vector2D [] accelerations;   
        public MotionObject(Vector2D [] velocities, Vector2D [] accelerations){
            this.velocities = velocities;
            this.accelerations = accelerations;
        public Point2D.Double getResultantMagnitudes(double time){
            Vector2D vsum = addVectors(velocities);    // you'll need to create this method, to add vectors together
            Vector2D asum = addVectors(accelerations);
            double deltax = (vsum.xmag * time) + (asum.xmag * (time*time));
            double deltay = (vsum.ymag * time) + (asum.ymag * (time*time));
            return new Point2D.Double(deltax,deltay);
    }To make use of an object like that, you would create your Vector2D arrays, then pop them into a new MotionVector object. And when it came time to find out where your player/object should be on screen, just call getResultantMagnitudes(double time) with the elapsed time and add the x and y values of the returned Point2D.Double instance to the current x and y locations of your onscreen object.

  • MINUTES_BETWEEN Oracle8i

    I need a SQL function that returns number of minutes between dates d1 and d2.
    Is there any solution to the problem?
    thanks,
    Jonas Wahlfrid

    Date calculations can be done, but typically return in fractions of a day. Just add an appropriate calculation to convert to your desired degree. For example:
    SQL> select (to_date('30-APR-2001:08:27','DD-MON-YYYY:HH:MI') - to_date('30-APR-2001:08:25','DD-MON-YYYY:HH:MI'))*24*60 dif_min from dual;
    DIF_MIN
    2
    SQL>

  • Ring Segments (as Shapes) in Java2D

    Hi!
    I have a problem regarding generation of ring segments in Java2D:
    The segment I would like to create should not be a simple Arc2D, but actually a shape
    that I can fill, scale etc. like a ring-chart segment.
    I have tried creating two arc segments with equal start-degree / end-degree values and differing radii
    and then connecting them to a shape. The problem is, that I can't connect the arcs' endpoints and
    startpoints - only endpoint of arc1 to startpoint of arc2, which is not what I need.
    Is it possible to "reverse" an Arc - such as creating an arc starting at 40� and extending -20� ?
    When I try this I always seem to get an "invisible" arc whose endpoints won't connect to a full shape !?
    Any thoughts or solutions would be greatly appreciated.
    Andreas

    One way is to use a fat Stroke together with the Arc2D to generate the shape. Create a BasicStroke of the appropriate width (difference between the inner and outer radii) and pass your arc to the stroke's createStrokedShape method.

  • Determining natural frequency

    Having never done vibration analysis, I'm wondering if anyone has experience in determining the natural frequency of a solid using an accelerometer. Aside from knowing that we can produce a voltage signal through the accelerometer, and that we in some way need to condition this through a fourier transform, I am completely stumped.
    Can anyone provide a simple explanation, and hopefully any more complex knowledge of how to go about solving this problem?
    Thanks,
    Justin
    Just as a post note, I'm really completely unfamiliar with vibrations
    analysis, and am hoping to learn enough through this process to really
    understand the problem and its solution...
    Any help is appreciated!
    Message Edited by g0dam0ng1n53ct5 on 12-17-2009 09:01 AM

    OK, I dug up the old code (I'm talking 1994 here).
    The TRANSFER function is a statement of the relationship between the independent measurement (Y) and the driving force (X).
    You hit point A with force X, and at point B, you see a movement Y.
    The transfer function is dependent on structure geometry, materials, mounting, supports, maybe termperature, etc. 
    That is frequency-dependent, so doing it in the frequency domain provides a lot of info at one time. 
    Here are comments from my 1994 code:
           F(x)     F*(x)           |F(x)|^2
    Sxx = ------ * -------     =   ----------   (no phase information)
            N         N               N^2
           F(y)     F*(x)
    Sxy = ------ * -------
            N         N
                          Cross power spectrum          Sxy
    Transfer function = ------------------------   =   -----
                             Power spectrum             Sxx
                 | Sxy | ^2
    Coherence = -------------
                 Sxx  *  Syy
    where:
      F(x) is the complex Fourier transform of the time domain signal x, and
      F*(x) is the complex conjugate of the Fourier transform of x, and
      N is the number of points in x.
    Note that SXX is the magnitude squared.  It is faster to compute the square of the magnitude than it is to compute the magnitude. Although the complex-to-polar VI would look simpler on the diagram, it would take longer since it computes the magnitude proper, (an extra square-root operation), and it computes the angle (extra arc-tangent operations).
    Since N^2 is a term in both Sxy and Sxx, and since we are dividing one by the other, we do not need to explicitly divide by N^2; it is cancelled automatically.
    Here is the code to process a single channel:
    I'm not sure of the comment "this is much faster..." anymore, as I've tested it recently and found it not the case.  But it was true in 1994. 
    And here is the code to handle the actual Xfer function:
    Note that I had an implicit rule that the first channel in the array was always the reference channel, i.e. the hammer (stimulus).  Any other channel(s) were response channels - you can get transfer functions between one stimulus point and any number of response points with one recording.
    The middle section there is averaging: you may or may not want to do that.  It's averaging from several hammer blows.
    What you get out is a complex spectrum (in the TRANSFER FUNCTION array).
    At each frequency, there's a complex number (R+jI) that describes how well the vibration travels from point A to point B. 
    If this function shows a clear peak at say, 583 Hz, then the structure in question is best at transferring vibration at that frequency.
    If the MAGNITUDE of that peak is close to 1.0, then it's very resonant.  If the magnitude is much lower, it's very damped.
    (If it's greater than 1.0... RUN!  It's about to come off it's mountings !)
    You also get a COHERENCE spectrum, I'm not as well versed on the uses of that. 
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • Calculate step Angle from Stepper Motor Counter

    Hi,
    I am looking for a formula to calculate the Stepper Motor Angle from the Stepper Motor Counter. The Stepper Motor has 1.8 Degree/200 Steps Resolution. As it rotates more than 200 Steps, I want the Angle to reset to 0 and start calculating again from 0 to 360 Degrees. As I am a beginner I am confused to use some sort of While or For Loop. Any suggestions?
    Solved!
    Go to Solution.

    Hi rkamat,
    FOR loops are used when you know the iteration count before starting the loop.
    When iteration count depends on a condition you should use a WHILE loop instead…
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Using of degrees in Tangent vi

    Hi,
    Good day!
    May I know how I can calculate base on degrees by using Tangent vi in LabVIEW 7.1?
    The tangent vi default input is in radians.
    For example: (tan -0.0680 * 27000 + (-36.6))= -68.644 when using degrees to calculate.
    How I can use the vi provided in LabVIEW 7.1 to achieve same result?
    Thank you in advance for the advice!
    Best Regards,
    Norman

    In this case, the third paragraph if the section "Convert Unit Details" applies:
    http://zone.ni.com/reference/en-XX/help/371361D-01/glang/convert_unit/
    Quote: "If the input is a pure number, LabVIEW assigns the unit you specify in the Convert Unit function to the number and returns that physical number in the base unit (or a combination of base units) for that class of measurement, as indicated in the following table."
    The "base unit" of an angle is rad. Yes, it's a bit confusing but at least documented. 
    For some fun, look at the attached VI diagram and front panel. Don't run it yet!!!!
    Can you tell what all the indicators will show without running it?
    Now run it! Were you right?
    Message Edited by altenbach on 09-04-2007 10:47 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    AngleConversions.vi ‏10 KB
    AngleConversions.png ‏20 KB

  • Trying to measure the degree of arc of two points

    I am trying to compute the degree of a mouse down and a mouse up, in order to rotate a rectangle.
    I always start rotation in the bottom right corner.
    I can get a trivial example to work as follows with vector2d:
    Vector2d start = new Vector2d( 400, 0 ); // x is 400, y is 0
    Vector2d current = new Vector2d( 0, 400 ); // x is 0, y is 400
    double angle = start.angle( current );
    double degrees = Math.toDegrees( angle );
    System.out.println( degrees ); // result is 90 degrees
    The problem is that my coordinates are not relative to the center of the rectangle but to the drawing area.
    So for example with this:
    Start X 1066
    Start Y 334
    Current X 886
    Current Y506
    I get angle as 12.33. However this is actually also a 90 degree angle.
    I reckon I just need a translation but I am not sure.
    Any ideas?

    I suspect that is the correct source code, I do not have the source handy, I found that on the web.
    I am moving the mouse to what I believe lies halfway between two quadrants and so I would expect all of these angles to be 45 in their respective quadrants, or going clockwise 315 degrees, 45 degrees, 135 degrees, 255 degrees.
    These are the the results:
    Quad 1 Upper Right
    1. angle is 28.813940220331343
    mouseDownX: 510
    mouseDownY: 239
    mouseUpX: 484
    mouseUpY: 98
    orX: 224.0
    orY: 226.0
    this.mouseDownX - orX: 286.0
    this.mouseDownY - orY: 13.0
    this.mouseUpX - orX: 260.0
    this.mouseUpY - orY: -128.0
    Quad 2 Bottom Right
    1. angle is 17.362571992664307
    mouseDownX: 510
    mouseDownY: 239
    mouseUpX: 480
    mouseUpY: 319
    orX: 224.0
    orY: 226.0
    this.mouseDownX - orX: 286.0
    this.mouseDownY - orY: 13.0
    this.mouseUpX - orX: 256.0
    this.mouseUpY - orY: 93.0
    Quad 3 Bottom Left
    1. angle is 74.81447530342327
    mouseDownX: 510
    mouseDownY: 239
    mouseUpX: 249
    mouseUpY: 338
    orX: 224.0
    orY: 226.0
    this.mouseDownX - orX: 286.0
    this.mouseDownY - orY: 13.0
    this.mouseUpX - orX: 25.0
    this.mouseUpY - orY: 112.0
    Quad 4 Top Left
    1. angle is 85.57932473361393
    mouseDownX: 508
    mouseDownY: 249
    mouseUpX: 242
    mouseUpY: 113
    orX: 224.0
    orY: 226.0
    this.mouseDownX - orX: 284.0
    this.mouseDownY - orY: 23.0
    this.mouseUpX - orX: 18.0
    this.mouseUpY - orY: -113.0

  • Real circles, arcs and bigger art board

    1.) I work with large format graphics and CS3 AI's limitation of around 120" x 120" makes my work difficult. Other graphic applications that are much less mature than AI have almost infinite art boards to work with. I would also be nice to be able to work in scales, too. It is laborious to have to constantly be working at half-, quarter-, or eighth-scale. I wear out a calculator and the possibility for errors shoots through the roof. Lastly, some things just don't scale well. In short, AI is biased toward those whose output is magazine sized. Since it is essentially the only graphics application left standing it should realize that many of its customers need to work is something larger than ledger. At the very least they should have the same limitation for both ID and AI. At present an 120" AI file cannot be placed in ID which has a limit of around 111". Some "suite."
    2.) Make text compatible between AI and ID. As I recall, at present (CS3) the text from one does not conserve its formatting when placed into another. I'd like to have the option.I have to use MSWord as a go-between. Again, some "suite."
    3.) If AI is going to be a complete vector art application perhaps it should start with the ability to draw simple shapes. At present, it can only draw X,Y defined vector paths. The "circle" tool only draws circle-shaped paths. Its size is controlled by changing the X and Y dimensions of an imaginary square into which it is inscribed. A true circle is drawn and manipulated via its center placement, its radius and its diameter---at a minimum! In AI none of these controls are available. Remember compasses from the old drawing board days? At the very least AI should emulate this ancient tool. I don't remember anyone ever trying to draw a circle by drawing a square first and trying to place four arcs in the corners. It is crazy.
    The same is true for arcs. AI only draws crude arc-like paths. In fact, it is even less accurate for arcs than it is for circles. Going back to simple definitions, an arc is a series of points equidistant from a single point. AI's "arc" tool does not draw anything close to this unless you hold down the shift key. Then it draws the arc from one of the end points. This may be helpful sometimes, but 99 percent of the time if you want to draw an arc you are going to want to start at the center and draw from end point to end point. AI acts as if the center does not exist! It is not even indicated; these are not arcs! Lastly, much like a true circle, an arc is manipulated by its center point placement, its radius and its included angle, and/or the location of its end points. None of these are available in CS3. As I said, it only draws X,Y vector paths--very, very primitive.
    The ability to draw fundamental shapes correctly and easily should be the first thing a vector illustration program tackles. It is absurd that it is still missing after 13 versions. Let's hope version 14 finally gets it right. And please don't mention CAD tools. The tools I'm taking about are basic, basic, basic tools.
    MGuilfoile

    I absolutely agree.
    I don't ever recall using a program that created arcs and circles like AI. A circle appears simply to be 4 arcs of 90 degrees. You cannot change the start and end angles, either by dragging the points or by dialog input. I'm not an illustrator by training - I'm a technical writer but I've been doing line illustrations, exploded views, etc. for almost 20 years using various vector-graphics programs. Every program I've used allows you to alter an arc, elipse or both, NOT just size and move!!
    I'm only evaluating AiCS4 for possibly migrating from FreeHand. In Freehand, you cannot change the angle of an arc but you can with elipse. Even the limited graphics package in FrameMaker allows you to define the start/end angles of an arc (not an elipse) via the properties dialog.
    I'm new to AI and I'm just astonished that the arc and elipse tools have been so neglected over the long life-cycle of the program.

  • Distance along an ellipse arc (nD Nonlinear System Solver (VI).vi)

    I'm hoping to get some help solving an issue I've come up against. I appreciate that what I'm asking requires some of your time, so I've tried hard to do my due diligence before posting here. I'll really appreciate any help I can get. I'm using LabVIEW 2014 Professional on Windows 7.
    I've stripped away all the details of the specific application I'm working on and tried hard to isolate just the issue that is causing me difficulties.
    I've posed the problem below and I attached some investigation code (sorry, there is quite a bit) that represents my current solution (with the issue).
    Problem: Given an ellipse (with a major and a minor axis and a frame of reference), a distance to travel and any point on the ellipse, calculate the end point on the ellipse where the elliptical arc length between the two points equals the given distance to travel.
    I'll restate the problem, but with physical values. Given an ellipse, centered on the origin, with axes of 10mm and 8mm, and a starting point (5mm, 0mm); what is the end point on the ellipse after travelling 1 mm along the ellipse?
    This initially seemed like a simple calculation (and it is for a circle), but for an ellipse, the math turns out to be somewhat more complicated and requires numerical computation.
    Issue: I was given some python code that solves this problem and embarked on a LabVIEW solution. The python code uses the function optimize.fsolve from the scipy library to solve one aspect of the problem. I'm not too familiar with the LabVIEW VIs available to do the equivalent, but settled on "LabVIEW 2014\vi.lib\gmath\zero.llb\nD Nonlinear System Solver (VI).vi" (my code still has other options disabled in the code). When I use this solver VI, I do not always get the same answer from this VI. Sometimes it finds one root and sometimes two. For points separated by less than half the circumference of the ellipse, there should always be 2 roots (one in the clock-wise and one in the counter clock-wise direction). Any ideas why the solver does not always return 2 roots?
    Current Solution: My investigation VI takes two points on an ellipse (defined by a start angle and end angle) and calculates the distance between them along the ellipse. Then, I take the start point and the distance and try to calculate the end angle (which I can use to find the end point). Run once, it usually finds the right answer, but run 100 times it often returns the answer 19. I should mention that I'm not 100% positive there are no issues with the code used to support this calculation and I'm open to any suggested changes or improvements, but the issue currently causing problems is the inconsistent operation of the solver VI.
    Again, I appreciate this is long and thank you for reading this far; I hope you find this as fun a problem as I do!
    Chris
    Solved!
    Go to Solution.
    Attachments:
    NI Forums.zip ‏265 KB

    Hello Mark,
    Thanks for your reply, I was concerned that I had sent up an air ball on this one! And thank you for taking the time to review the code.
    You are correct, I am having an issue with the results of the nD Nonlinear System Solver (VI).vi. And that is a good poiint you raise, regarding the choice of the starting points. I'm not intending to use random values, I think I'm using a number very close to the start angle (in this case 20.001 degrees) as a start and 2pi (or 360 degrees) as the end. When I read the description of the start and end from the documentation:
    Start is an array describing the left corner of the n-dimension interval. The randomly chosen start points of the zero-finding algorithm can be found in the n-dimensional rectangle spanned by Start and End.
    End is an array describing the right corner of the n-dimension interval. The randomly chosen start points of the zero-finding algorithm can be found in the n-dimensional rectangle spanned by Start and End.
    I have to admit I don't *understand* what this means and I am currently guessing for the choices of start and end. I will think on this some more and review your links.
    As far as my final goal, I'm going to use this code I shared for generating an ellipitical motion profile on the PC to send to a cRIO and have executed on a FPGA.
    I'll report back after I work on this some more, but if you have some more insights, please share.
    Chris
    (BTW, I have an open support item for this #7444649 and it was suggested I also post on the forums)

  • Inverse Tangent Function Problems

    Hi,
    I am trying to use the trigonometric function "inverse tangent", but it doesn't work as I think it should. I want to change a gradient into an angle, normally on a calculator I use height divided by length, and press the tan^-1 (inverse tan) function and get the angle. For example, the inverse tangent of 1 is 45 (degrees). If I use the inverse tangent function in Labview 2010, I get a completely different result = 0.7853.. Either I am using it incorrectly or the function isn't working properly.
    I've attached an example so you can reproduce the result. I also had a similar problem with sin and cos in the formula node structures.
    Thanks for any help you can give,
    James
    Solved!
    Go to Solution.
    Attachments:
    Inverse Tangent.vi ‏6 KB

    Hi James
    I haven't seen your VI. From what I know, output given by the trignometric functions in Labview is in radians. You will have to perform radian to degree conversion to get the answer as 45.
    Regards
    Javed 

  • Java.Math: tangent with gradient

    Hi all,
    I need to get an trigonometric tangent with a gradient, but in the class lang.Math is only a method that needs a radian for input. Can I convert the value of the gradient into a radian value to work with the existing methods? Or is there any other "easy" way that solves my problem?
    Thanks a lot...

    I got two selfmade draw-objects with their central point. Now I can make the quotient of the x- and y-distances between the two points. But I need the angle of the "slope triangle" (dont know if this is the correct denotation) for the further computation. Every tiny calculator can make a tangent of this quotient (I thought it would be called gradient then, its 1 for a 45 degree...), but I can't figure out how to do this with Java...

  • Error in running a function to convert coordinates in degrees to decimal for EXCEL VBA

    For your information, I have 3 cross-posts regarding this question - and all I can said there is still no firm solution regarding this error.
    1) http://stackoverflow.com/questions/27634586/error-in-running-a-function-to-convert-coordinates-in-degrees-to-decimal-for-exc/27637367#27637367
    2) http://www.mrexcel.com/forum/excel-questions/826099-error-running-function-convert-coordinates-degrees-decimal-excel-visual-basic-applications.html#post4030377 
    3) http://www.excelguru.ca/forums/showthread.php?3909-Error-in-running-a-function-to-convert-coordinates-in-degrees-to-decimal-for-EXCEL-VB&p=16507#post16507
    and the story of the error is as below:
    Currently I am working on VBA excel to create a widget to verify coordinates whether it lies under the radius of ANOTHER predefined and pre-specified sets of coordinates.
    In the module, I want to convert the coordinates from degrees to decimal before doing the calculation - as the formula of the calculation only allow the decimal form of coordinates.
    However, each and every time I want to run the macros this error (Run-time error '5', invalid procedure call or argument) will appear. Then, the debug button will bring me to below line of coding:
    degrees = Val(Left(Degree_Deg, InStr(1, Degree_Deg, "°") - 1))
    For your information, the full function is as below:
    Function Convert_Decimal(Degree_Deg As String) As Double
    'source: http://support.microsoft.com/kb/213449
    Dim degrees As Double
    Dim minutes As Double
    Dim seconds As Double
    Degree_Deg = Replace(Degree_Deg, "~", "°")
    degrees = Val(Left(Degree_Deg, InStr(1, Degree_Deg, "°") - 1))
    minutes = Val(Mid(Degree_Deg, InStr(1, Degree_Deg, "°") + 2, _
    InStr(1, Degree_Deg, "'") - InStr(1, Degree_Deg, "°") - 2)) / 60
    seconds = Val(Mid(Degree_Deg, InStr(1, Degree_Deg, "'") + _
    2, Len(Degree_Deg) - InStr(1, Degree_Deg, "'") - 2)) / 3600
    Convert_Decimal = degrees + minutes + seconds
    End Function
    Thank you.
    Your kind assistance and attention in this matter are highly appreciated.
    Regards,
    Nina.

    You didn't give an example of your input string but try the following
    Sub test()
    Dim s As String
    s = "180° 30' 30.5""""" ' double quote for seconds
    Debug.Print Deg2Dec(s) ' 180.508472222222
    End Sub
    Function Deg2Dec(sAngle As String) As Double
    Dim mid1 As Long
    Dim mid2 As Long
    Dim degrees As Long
    Dim minutes As Long
    Dim seconds As Double ' or Long if only integer seconds
    sAngle = Replace(sAngle, " ", "")
    mid1 = InStr(sAngle, "°")
    mid2 = InStr(sAngle, "'")
    degrees = CLng(Left$(sAngle, mid1 - 1))
    minutes = CLng(Mid$(sAngle, mid1 + 1, mid2 - mid1 - 1))
    seconds = Val(Mid$(sAngle, mid2 + 1, 10)) ' change 10 to 2 if only integer seconds
    Deg2Dec = degrees + minutes / 60 + seconds / 3600
    End Function
    As written the function assumes values for each of deg/min/sec are included with unit indicators as given. Adapt for your needs.
    In passing, for any work with trig functions you will probably need to convert the degrees to radians.

Maybe you are looking for

  • XML parsing with digester

    Hi all, I'm trying to parse the following xml document: <?xml version="1.0" encoding="UTF-8"?> <map>      <entry key='PAGE2.SNOME'>           <bean key='nomeCliente'>field</bean>      </entry>      <entry key='PAGE3.TIPO_CONSTRUCAO'>           <bean

  • OS 9 won't work

    I just got a MAC mini and transferred info, apps. etc from my powerbook G4 running 10.4.3 via firewire. I have a lot of files etc that only run on Classic but none of them will open. On 10.4.3 on the powerbook a classic window opened and I could use

  • Installation Guides

    Guyz, i'm looking for installation guides link on marketplace for ECC 6.0, BI. Appreciate any replies on this. Thanks in advance

  • How to Get Training for SAP Business One Certifications

    Training paths for the C_TB1200_88 Implementation and Support Consultant certification: Classroom Training                                                                 -  TB1000 Logistics  (multiple languages)                                  -  T

  • IPhone 5 owners, new iOS 6.1, shall we risk it?

    Subject sez all. New code on the block. Russian Roulette time. Go or not? Early Adopters, first impressions, please.... P.S. Maybe it is available for earlier models, have no info on that respect. But judging from the 6.0.2 rollout, wouldn't hold my