Measuring included angle between 3 points

I need a behavior that can measure the angle formed between
two points and a sprite’s center. The first point is saved on
mouseDown, the second point is the current mouse location.
I’m using the law of cosines and if Director supported acos()
I’d be done hours ago. I’ve got the formula re-written
with atan(), unfortunately atan() presents two problems: 1. the
function has singularities which I can deal with, 2. atan() returns
an angle between 0<x<180, anyone know what I can test to
determine if I need to add 180 to the angle to get a full 360
answer?

The behavior I attach below does not compete with your
12-line handler in terms of concision. I felt it was worth adding
to this thread because:
a) It provides a solution which does not block all other
activity on the Stage
b) It shows how you can use 3D vector mathematics to solve a
2D rotation problem

Similar Messages

  • Measuring an angle in an image

    I'm wondering if anyone knows of a utility (inside LabVIEW or the Vision system or anything else) that could measure the angle between the apparent cross hatch in the following image.
    Tim Elsey
    LabVIEW 2010, 2012
    Certified LabVIEW Architect

    I searched for lines in two separate directions.  i.e. Top to bottom and left to right.  You'll have to play around with these as well as the orientation of the line you're searching for to get anything useful.  Then you can calculate the angles between these lines.  
    I found it very useful to do some preprocessing on the image to make it easier to find lines.  For example, no lines could be found in the above image, but after I used IMAQ Equalize.vi on it, I could find all sorts of lines.  This particular function may or may not be helpful in your use case.
    Another thing that helped further is equalizing just a small ROI rather than the whole image at once.  This way any stark differences between regions of the image will be nullified. 
    I'm no longer at my old company, so I don't have access to the code
    Tim Elsey
    LabVIEW 2010, 2012
    Certified LabVIEW Architect

  • Angle between two points

    hi,
    if I have two points
    Point2D.Double p;
    Point2D.Double q;
    how do you find the angle between them (measured from a vertical bar)?
    thanks,
    asjf

    Point2D.Double  p = new Point2D.Double(4.0,3.0),
                 q=new Point2D.Double(-3.0,4.0);
    double angle = Math.atan(p.y,p.x)-Math.atan(q.y,q.x);
    System.out.println("angle(radians)="+angle+", (degrees)="+ angle/Math.PI*180);Defend the hionour of atan2? Gaaah! you are making two[d] calls to a math library! My code only needs to make one, to acos().
    Firstly, of course, in the atan method the order of the operands is significant. In the dot product method, they are not. One gives "the angular distance from p to q", wheras the other gives "the angle between p and q".
    Secondly, atan2 behaves ... oddly sometimes, I can never get straight whether the results are 0 to PI, or -PI/2 to PI/2. So if the angle is 60 degrees, you might get 60, -60, 120, -120, 300, -300 etc depending subtly on what the two points p and q contain, and all in floating point. You get the situation where the result flicks between two wildly different values when you move one of the points by a pixel, and the nature of the flick can change depending on which quarant the points are in. Been there, done that. The dot product method, by contrast, goes smoothly from 0 to PI.
    Someone pass me a saucer of milk.

  • HT4513 You need to include "Click the Advanced button" between points 3 and 4 in the description above

    You need to include "Click the Advanced button" between points 3 and 4 in the description above

    I hate these HTxxxx linked discussions as I often can't follow/or miss the meaning of the post.
    If you look above you'll see:
    Learn About AppleTV: Apple Remote.....
    which links to HT4513.
    AC

  • LabVIEW/SignalExpress: How can I automate measuring the time between two pulses?

    Hi everyone, bit of a newbie here so please bear with me.  
    I'm a student at a university conducting a muon decay experiment with an oscilloscope connected to some photomultipliers.  To summarize, if a muon enters the detector it will create a very small width pulse (a few ns).  Within a period of 10µs it may decay, creating a second pulse.  The oscilloscope triggers on the main pulse 5-15 times per second, and a decay event happens roughly 1-2 times per minute.  I am trying to collect 10 hours of data (roughly 1500-2000 decay events) and measure the time it takes for each decay.
    I've been able to set recording conditions in SignalExpress that starts recording on the first pulse and stops recording on the last.  The Tektronix TDS 1012 oscilloscope however feeds 2500 points of data from this snapshot into a text file (for use in excel or other software).  Even if I perfectly collected the data, I would have 100,000+ data points and it would be too much to handle.  I don't know how (or if it's possible) to reduce the sample size.
    To conclude, using Labview or SignalExpress, I would like to be able to have the software
    1.  Differentiate between the single pulse detections and double pulse decay events
    2.  Record only when two pulses appear on the oscilloscope
    3.  Measure the time between these two pulses and ONLY that to minimize the amount of data recorded.
    Any help would be GREATLY appreciated, thanks!

    Hi wdavis8,
    I am not that familiar with Tektronix, but there should be a place in the dialog that you go through when you create the action step to acquire date to specify a sampling rate. That would allow you to reduce the number of data points you are seeing, but may reduce the quality of the data.
    If it’s just a matter of that much data being hard to dig through when you have that many points, you could do some analysis on the data after the fact, and then create a new file with only the data you want to look at. For example, you could identify the peaks in the data, and based on the distance between them or the difference in magnitude, selectively write data to a new file.  
    Here is some information about peak detection in LabVIEW:
    http://www.ni.com/white-paper/3770/en/
    You could also do some downsampling on the data to get fewer data points:
    https://decibel.ni.com/content/docs/DOC-23952
    https://decibel.ni.com/content/docs/DOC-28976
    Those are just a few quick ideas. 
    Kelsey J
    Applications Engineer

  • How to measure an angle in Illustrator??? HELP!

    Hi,
    I have a big problem that seems very easy, but I can't find a solution on internet. The problem is. I have a rectangle, all angles are 90 degrees, I know that. But how can I make Illustrator to measure this???? Using Window - info I really don't know how to do it? Is it in another place? This is a basic feature I think and I can't believe it's not possible. Please let me know or I will go crazy before Easter.
    If you happen to know how to do it, I have also another question. How can I measure something in Illustrator so that it leaves a measurement on the screen, like in Corel, if I measure something, a distance for example it shows it on the screen and it stays on the paper, so if I print it, I have it. In Illustrator, I only can see it in information window, but how can I make it to stay and be printed??
    Thank you.
    Tomasz

    Silly as it is...
    Illustrator's Measure tool is useless garbage. The Line Tool makes a better measuring tool.
    1. Make sure Snap to Points and/or SmartGuides is on.
    2. Line Tool: Drag to draw a "line" (it's actually a path) connecting the two points bwtween which you want to measure the angle.
    3. Delete.
    4. DoubleClick the Line tool. The resulting dialog will tell you the angle and length of the path you just drew.
    Illustrator has never provided a proper dimensions toolset, as is taken for granted in programs like Draw and Canvas (just as it has never provided such basics as geometric primitive objects with editable parameters, like rounded rectangles on which you can change the radii, or polygons on which you can change the number of sides, or arcs on which you can change the angular sweep...)
    My JET_DimensionLines.jsx script is a cumbersome workaround for only the very simplest kind of linear dimensions. It will not help you label angles.
    I'd highly recommend your keeping that copy of Draw up-to-date and continue to use it. There is no law that you can only use one drawing program. And Illustrator is a very antequated program that falls very short in too many very basic functions.
    JET

  • Creating Route between points

    Hi all,
    Am currently using oracle database 10gR2 that contains some spatial data of the city of auckland, nz. I am using oracle maps to display the data and the normal navigational features as such. But what I want to do is determine a route between two locations on the map. There is a distance tool that just measures the distance between two points. But I'm not sure how to go about finding a route between two points. In the tabe in the database there are columns for F_NODE and T_NODE which I'm guessing is the start and end node of each line? Any help in this matter is greatly appreciated.
    Kind Regards,
    Avinash

    Avi
    Did not worked with Mapviewer and Networks as such, but the Ora App Server Map Viewer User Guide has a section on Networks 2.3.7 Network Themes starting on page 83.
    http://download.oracle.com/otn/other/mapviewer/pdf/mapviewer_10131_ug.pdf
    I hope this can give you a start.
    Luc

  • I want to measure te time between the peaks

    I need to measure the time between each peaks (QRS peak) in an ECG waveform continuously and plot on the chart.
    Can u please help me with this.

    Hello kok,
    Here is an example.  I am using a sine wave instead but it will still work.  Just put in the threshold to be above the itnermediate peaks that you want to ignore but below the peaks you want to get.  The VI will then tell you what location inside of the array the peak occured.  You can subtract each location from each other to find how many elements pass between peaks.  You can then multiply the number of elements between peaks by the amount of time between each sample.  I hope this helps.
    Steven T.
    Attachments:
    rrmeter.vi ‏16 KB

  • Determining angle between current and last position; 2D

    Hi,
    I have a player on a JPanel from a bird's eye view. I have to determine the angle (0 - 360) of the player's move:
                          0 or 360
                             |
                             |
                             |
                             |
    270--------------------Player--------------------90
                             |
                             |
                             |
                             |
                            180The top of the JPanel corresponds to 0 or 360 degree, the right side to 90 degree etc.
    I have to determine the angle between the current and the last (x, y) coordinates of the player. The player is being moved by mouse clicks.
    I don't know where to start to implement this... and how I can calculate the angle between these 2 positions (which I store in an Ellipse2D ArrayList).
    Thanks for your help!

    Multiply them by -1. Do you understand how degrees
    work? Degrees go counterclockwise. So 0 degrees
    should be on the right, and 90 degrees should be
    straight up.Oh... I didn't know that degrees in Java go counterclockwise and start on the right. Sorry. Is there a way to tell Java to start "at the top" and go clockwise? Or is the solution to change the formula? Thanks! :)

  • Best way to capture data every 5 ms (milli-seconds) in the .vi diagram when using "Time between Points, and Small Loop Delay tools" ?

    - Using LabView version 6.1, is there anyway to change the "Time Between Points" indicator of (HH.MM.SS) to only (mm.ss), or to perhaps only (.ss) ?
    - Need to set the data sampling rate to capture every 5 milliseconds, but the defaults is always to 20 or greater; even when the "Small Loop Delay" variable is adjusted down. 
    Thank you in advance.

    I have no idea what "Time between Points, and Small Loop Delay tools" is. If this is some code you downloaded, you should provide a linke to it. And, if you want to acquire analog data every 5 milliseconds from a DAQ board, that is possible with just about every DAQ board and is not related to the version of LabVIEW. You simply have to set the sample rate of the DAQ board to 200 samples/sec. If it's digital data, then there will be a problem getting consistent 5 msec data.

  • Is there a way to trace a line between point A and B in a PowerMap

    Hi there,
    I have a simple question about PowerMap. Can I trace a line between points A and B? Please bear in mind that a workaround to create hundreds/thousands of points to simulate a line would NOT work for me (like this tutorial
    here -- this is a no-no for me).
    Any ideas if this is possible? If not, then consider it a feature request :-)
    Regards,
    P.

    Sorry but I think you are missing the point here.
    You added several yellow points to make this line. This isn't a line but a bunch of dots. I mentioned in my original question that unfortunately this is an unacceptable kludge for me.
    Consider this. you only have 3 to 5 of those dots, from Athens to Melbourne -- and I want a line between each one of those 3 to 5 dots, connecting them. NOT several dots that looks like a line -- that is cheating (and contra-productive in a real-life scenario)
    Regards,
    P.
    It's not possible. You can make feature requests using the Smile/Frown Feedback button in the UI.
    Thanks!
    Ed Price, Azure & Power BI Customer Program Manager (Blog,
    Small Basic,
    Wiki Ninjas,
    Wiki)
    Answer an interesting question?
    Create a wiki article about it!

  • How can I measure the time between each two successive rising edges ,using Digital Input ?

    Hello
    I'm trying two measure the time in seconds between each two successive rising edges on a digital input .
    Till now I have managed to detect the rising edge ,increment a counter with each rising edge ,and snap the time at which the rising edge happenned
    all I need now is to subtract the current rising edge time from the previous rising edge time in order to calculate (T) which can be 1/frequency and display it in realtime to the user.
    but I don't know how to do this
    Can somebody please help me !!!
    Solved!
    Go to Solution.
    Attachments:
    Counter without time.vi ‏11 KB

    Woah!  
    Sorry Apok, but your code is becoming way too complicated/messy. I don't think that all of those shift registers or boolean conversion/operators are needed at all.
    If you want to measure the timing between two button presses then this is a different (much less complicated) way. It simply records the timing of the button press into a shift register then compares the two.
    Spoiler (Highlight to read)
    Of course this is a very quick and basic solution just to show you that it can be much simpler than you are making it (remember to use the mechanical actions of the buttons to get the behaviour you want).
    A better way would be to use an event structure looking at value changes of the buttons to determine the timings between clicks.
    -CC
    "If anyone needs me, I'll be in the Angry Dome!"
    Attachments:
    Time between clicks.vi ‏9 KB

  • Draw an animated line between points

    I'm looking to develop an application that will draw an
    animated line between points. Some of the points will be
    pre-defined, and others will be set based on input from the user.
    I'm new to flash and/or any related products, so I'm just
    looking for some general directions on where to begin. What I'm
    wondering is
    a) what product or products would I use to put together such
    an application, and
    b) is this a complicated/difficutl thing or something fairly
    strightforward
    Thanks for any help!

    Hello BrotherBob
    Thanks for you rquick reply.
    I've checked those settings and the Brush Dynamics were off, on all brushed.
    Also, wet edges, airbrush and smoothing are 'greyed out' and appear to be locked.
    Still the same effect, the square brush works, the round brushes don't!

  • Measuring distance between points

    Hey,
    I am trying to do 2-D particle tracking.  What I am trying to do is for each point in the image, I want to find the shortest distance to anouther point. Repeat for each point.  Then move on to the next image and then compare those distances, since the particles are moving slowly, to help keep tabs on the particle.  So for example if it was at least 15 pixels away from the nearest particle in picture one, that should stay about the same in picture two.  However I am having trouble trying figuring out how to find the closest particle to every particle.  I am open to other suggestions as well for 2-D particle tracking.\

    hi there,
    i wrote a little vi (see attachment), but ist not tested.
    best regards
    chris
    Best regards
    chris
    CL(A)Dly bending G-Force with LabVIEW
    famous last words: "oh my god, it is full of stars!"
    Attachments:
    Points_LV71.vi ‏34 KB

  • Measuring phase angle

    Hello,
    I require some help with a phase angle measurement.
    The circuit I have to measure is attached. I would like to measure the current and phase angle through R3 and C1.
    I believe that if I use a wattmeter and measure across them (R3 and C1) then cos^-1 the power factor, I will only get the angle associated with their impedance. (about -37 degrees). I want the angle of current relating to the original voltage not just the shift resulting from that branch.
    Can any one recommend a device/ method of connecting to achieve the results I am looking for. 
    Best regards,
    Dan
    Message Edited by dan1988 on 12-07-2007 04:38 AM
    Attachments:
    EEP a1.ms10 ‏48 KB

    I calculated either 98.97 degrees or -82.87 depending on whether I used a thevenin or super position analysis. I believe the 98.97 degrees is to be taken from the 180 degree point, thus making them them as good as same answer. (Can't go more than 90 degrees anyway so it can't be taken from 0).
    I found an interesting result from playing around with the measurement probes you suggested, whereby I was receivng two readings in the load branch from seperate measurement probes, each referenced to a different supply. The readings were 120 degrees and -60.1 degrees.
    Now the combined thevenin and load impedance is -20.93 degrees.
    120 - 20.93 = 99.07
    -60.1 - 20 = -80.1
    Meaningful results? I don't know, I do not have enough understanding of the subject to prove or dissprove it.
    Any way its still not what i was looking for because Ive had to use my calculations which is what I'm trying to prove in the first place.
    If your interested ive attached the circuit and my calculations. As you can probaly tell its part of an assignment, for my HNC. I handed it in yesterday and just had to explain why i couldn't prove the angle (not that we were expected to). I credited you, Lacy, for the measurement probe idea.
    Best regards,
    Dan
    Attachments:
    EEP a1_ measurement probes.ms10 ‏45 KB

Maybe you are looking for

  • Question To iPhone 3G Owners

    The previous iPhone had a very tough back, is the new plastic one as resistant ? What about scratches ? I want to buy myself one, and I'm just curious.

  • From Adressbook to Excel file

    For my work I need to deliver all Adresses (groupwise) in an Excell file. Furthermore I need to put the Billing number (I strategically placed in the "note" section) to be visible Yes, I am a Apple apprentice and would like some help iBook G4   Mac O

  • IPV6 support on IOS for ONS 15540 ESPX

    Hi! Can anybody tell me whether IPV6 have been supported on IOS release for ONS 15540 ESPx. I know this sound kinda funny as ONS happen to be a Layer 1 optical transport but my customer wants to know. Have tried to find out via feature navigator on C

  • I cannot open a CS6 project.

    Hi, I have build a project in CS6 and it was working fine until late last night. When I try to open it, it get to 81% and then stops. The software then crashes if I try to do anything. I have deleted some of the source file the project it useing but

  • Syncing other calendars from my iPhone

    Currently I have my iPhone set up to sync with my work calendar (from Outlook). I can also see my iCloud/Mac Book Calendars on the phone, and when I set up an appointment in iCal - it will sync to the iphone through the icloud. The question is, is it