Math trouble ! Help !

I try to calculate all the points on a curve.
The curve decided by the width(X on the picture) and height(Y on the picture) properties of a movieclip.
The distance between each green point on curve is the same.

I think dealing with ellipse or bezier in this context is too cumbersome and pretty imprecise.
Code below accomplished drawing interface you want and positions point at equal intervals along the curve.Just make this class a document class.
Read comments:
package
     import flash.display.GradientType;
     import flash.display.Graphics;
     import flash.display.Sprite;
     import flash.geom.Matrix;
     public class ObjectCurve extends Sprite
          private var container:Sprite;
          // container width
          private var w:Number = 500;
          // container height
          private var h:Number = 400;
          // reusable Graphics reference
          private var g:Graphics;
          public function ObjectCurve()
               init();
          private function init():void
               // make container
               container = new Sprite();
               g = container.graphics;
               with (g) {
                    beginFill(0xEBEBEB);
                    drawRect(0, 0, w, h);
                    endFill();
               container.x = container.y = 50;
               addChild(container);
                * diagonal is base of right triangle that is made of
                * two radiuses
                * IMPORTANT! Center of cricle is positined at x = width of container
                * and y = radius.
                * radius is most important value to calculate fro this functionality
                * it depends on, again, container dimensions
               // length of container diagonal
               var diagonal:Number = Math.sqrt(w * w + h * h);
               // angle of container diagonal
               var diagonalAngle:Number = Math.atan2(h, -w);
               // radius of the circle which will be used for calculating anlges.
               var radius:Number = diagonal * .5 / Math.sin(diagonalAngle);
               // angle between left buttom corner of container and center of circle
               var angle:Number = Math.atan2(h - radius, -w);
               // angle between radiuses
               var radAngle:Number = -(angle - ( -90 * Math.PI / 180));
               // length of arc that will be drawn
               var arcLength:Number = radAngle * radius;
               // radian increment for each roation
               var rotationIncrement:Number = radAngle * 4 / arcLength;
               // prepare for gradiwnt fill
               var matrix:Matrix = new Matrix();
               matrix.createGradientBox(w, h, -45 * Math.PI / 180);
               var colors:Array = [0x000000, 0x4646FF];
               var alphas:Array = [1, 1];
               var ratios:Array = [0x00, 0xFF];
               // draw arc
               g = container.graphics;
               g.lineStyle(2, 0xFFFF00);
               g.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
               g.moveTo(0, h);
               while (angle < -90 * Math.PI / 180) {
                    g.lineTo(w + radius * Math.cos(angle) , radius + radius * Math.sin(angle));
                    angle += rotationIncrement;
               // finish to top right corner
               g.lineTo(w, 0);
               // continue drawing to make borders
               g.lineTo(w, h);
               g.lineTo(0, h);
               // place points at equal intervals
               // number of points
               var numPoints:int = 10;
               // number of segments based on number of points
               rotationIncrement = radAngle / numPoints;
               // return angle to its original value
               angle = Math.atan2(h - radius, -w);
               var point:Sprite = drawPoint();
               // place first point at the beginning of arc
               point.x = w + radius * Math.cos(angle);
               point.y = radius + radius * Math.sin(angle);
               container.addChild(point);
               // create and place other points
               for (var i:int = 0; i < numPoints; i++) {
                    angle += rotationIncrement;
                    point = drawPoint();
                    point.x = w + radius * Math.cos(angle);
                    point.y = radius + radius * Math.sin(angle);
                    container.addChild(point);
          private function drawPoint():Sprite {
               var s:Sprite = new Sprite();
               s.graphics.beginFill(0x00FF00);
               s.graphics.drawCircle(0, 0, 5);
               return s;

Similar Messages

  • Finance Homework Help, Accounting Assignment Help, Business Homework Help, Math Homework help

    The site ACCOUNTINGHOMEWORKTUTORcom helps the students in Accounting Homework Help, Finance Homework Help, College Homework Help, Business Homework Help, Math Homework Help, Marketing homework help, statistics assignments help answers, economics assignment solutions.
    The website ACCOUNTINGHOMEWORKTUTORcom, which is, a Global community of Students and Subject Experts where Students can interact with Tutors/Experts to get the Homework Help/Solutions of their Queries/Assignments/Projects. As per the past track records of last four years, organization is committed towards Quality College Homework Help to the Students who want to become part of Homework Help Team.
    ACCOUNTING HOMEWORK TUTOR provides Homework and Assignment Help in all Subjects. The website can also help you with Essays & Research Papers. Most of the tutors and writers of the company are either PhD or Master degree holders in their respective subjects.
    Their Team is efficient in College Homework Help, Statistics Homework Help, Finance Homework Help, Accounting Homework Help, Business Homework Help, Chemistry Homework Help, Math Homework Help, Algebra Homework Help, and Science Homework Help etc.
    Tutors and writers are committed to fulfill the requirements and meet the deadline with the highest quality of writing. All essays are plagiarism free and are checked for plagiarism before being delivered to you. The dedicated team of academic writers has great experience and writing skills.
    All tutor/writers are highly qualified and trained to write all types of dissertations, essays, research papers, book reviews etc.. All writers write exclusively for them so that there is no problem of plagiarism. Also this ensures that a student gets the very same writer/tutor always for his series of assignments. The services ensure that the paper is delivered to the client well within deadline. This enables the student to review the work and ask for minor changes that he would like.
    The site ACCOUNTINGHOMEWORKTUTORcom deals into variety of subjects like Anthropology, Archeology, Arts, Biology, Business, Chemistry, Computers & Technology, Community Studies, Criminology, Ecology, Economics, Education, Engineering, English Language, Finance, Geography, Geology, History, IT (information technologies), International Studies and Diplomacy, Languages & Linguistics, Law, Leisure and Tourism, Literature, Mathematics, Media Studies, Music, Marketing, Management, Medicine & Health Care, Nursing, Philosophy, Political Science, Psychology, Programming, Religion, Science, Social Issues, Statistics, Teaching, Technology.

    Whenever It comes to my mind the word Accounting, I get really sick & weak to my kneels. It happens a lot. Once I came across www.accountinhomeworktutor.com
    The guys are really helpful in accounting homework help & finance assignment help for financial comparative analysis, case study analysis, ratio analysis.
    I recommend this to everyone out there.
    finance homework help

  • 4:3 to 16:9 project will not export - marriage in trouble - help!

    Hi
    I'm using CS4, and I'm editing a friend's wedding video as a favour, clearly quite a big one. He used a pro camerman, who shot in widescreen. I'm so used to filming and editing my own 4:3 footage, that I just forgot, and captured the whole project (several hours) and began editing without even noticing my mistake; all the widescreen footage had been captured as 4:3.
    Once I realised what I'd done (halfway through the project), I did a bit of googling and figured there'd be a work around, even if I have to stretch the pixels and lose a bit of quality. But having come to the end of the editing process and tried to export, strange things are happening.
    All my footage appears and plays as 4:3 in Windows Explorer and VLC. But in the source monitor in PP it's widescreen. On all the sequences' program monitor - except one - it appears as 4:3. But on just one sequence the program monitor shows widescreen. Copying footage from other sequences meant that appeared as widescreen, too. But exporting from there, even though everythign looked right in the encoder, created a 4:3 final film. Opening up a new project, and importing the old project, led to exactly the same result, although I haven't yet tried to stretch the 4:3 footage (because at the moment, this won't solve the problem of the sequence that appears to be widescreen but renders as 4:3)
    I'm confused as to why one sequence would behave differently; I certainly can't think of settings that may have been changed.
    I have to hand this over to an old friend on Thursday who's having problems with his marriage - she's terrifying, actually - and he is going to get in a lot of trouble if his precious DVD is late. Please help if you can...
    Thanks for reading
    D.

    Right click on the clips in your project bin and select "Interpret footage." You should see an option to choose the correct pixel aspect ratio for DV Widescreen. I think you can select multiple clips at once and do this, but the point is you'll need to make sure all your clips have the correct footage interpretation selected.
    Assuming you captured via firewire, there should be no issue (DV footage is transferred, actually, not captured...so the footage is not "altered" at all by any capture settings you may have, but the interpretation method may be incorrect, which is why you'll need to correct it).
    Once you have the proper interpretation, drop your footage in a DV widescreen sequence and it will display properly without any further adjustments. Then during export, be sure again to select a preset with "widescreen" listed (check the export screen to be sure it displays the way you like). If you create your own preset or modify one, just be sure that the pixel aspect ratio is matched to your footage (DV widescreen).
    Also, please note that when you change the footage interpretation method, this applies to all the clips in any sequences you currently have them in...so if you've got your clips in a 4:3 sequence, you'll need to copy and paste the CONTENTS of your sequence into a new widescreen sequence. Dragging and dropping a 4:3 sequence into a widescreen sequence will not work...regardless of the footage items themselves. When you nest a 4:3 sequence in a 16:9 sequence, the footage item is the sequence (NOT the original footage items themselves) so you will still see pillar boxes on left/right if you do it that way.
    Again, if you've already done all your edits in a 4:3 preset, just copy and paste all CONTENTS of that sequence to the new widescreen sequence and your newly applied footage interpretations should appear correctly.
    Hope that helps! Sorry if I was too vague, I'm not sitting in front of my editor right now so that's just from memory.

  • Ipod trouble HELP!!!

    I have had my Ipod nano 2nd gen for a long time and it has never given me trouble. Recently it would not connect to my computer but after I changed cords it was fine. Then it suddenly would not turn on at all. nothing. When I plug it in and try and turn it on it makes a weird ticking or clicking sound. It doesn't show up in my itunes and a box pops up saying itunes can't recognize ipod and my computer doesn't recognize it either. Does anyone know what to do to try and fix it? Or should I just go to a store and have them try and fix it?

    Hope this helps
    http://docs.info.apple.com/article.html?artnum=301267

  • Ipod mini troubles: Help Needed

    I really need help with ipod mini troubleshooting..
    I've had my Ipod mini for about 3 years now and lately have been running into a few problems.
    In the past few months:
    -My Ipod's "battery meter" has been acting really strange, one second it may be reading as 3/4 full, and the next it shuts down saying that my battery has depleted, then a few minutes later it will be reading full again. And just to let you know, I always charge it overnight to avoid having a dead battery, and I always make sure to properly shut it off using "hold".
    Resetting my ipod works sometimes, but other times doesn't..
    Yesterday:
    My Ipod is no longer responding at all, and I'm pretty sure I know why: Some careless person spilled some water near and on my ipod, I dried it off as soon as I could. It was working properly shortly afterwards, but a few hours later, it shut off saying that the battery was dead again, and a picture of a "cartoon ipod" with dead eyes("XX") appeared on my screen, and it said under the picture to go to "www.apple/support/ipod". This was when it wasn't connected to a power source. When I connected my ipod to my computer via USB, my itunes does not recognize that it is connected ("Do not disconnect" does not appear on my ipod) and a picture of a "dead battery" has appeared on my screen, it is not in the "recharging mode" either (with the picture of the battery moving).
    I tried re-setting it numourous times, and always end up with either the "dead battery" picture, or the "dead cartoon ipod" picture on it.
    Help would be greatly appreciated, as I use my ipod everyday for school and leisure.
    Thanks.

    I've tried that several times without luck.

  • PowerMac G3 Blue & White Hard Drive Trouble/Help Requested

    Hey all,
    I work for a small IT/computer repair company. We recently got in a PowerMac G3 Blue & White (300 MHz; 512K cache; 64 MB SDRAM) which has what appears to be a bad hard drive.
    (Upon boot, it comes up with a flashing disk/question mark and you can hear the drive making noises it shouldn't be/spinning up and down/etc.). I've tried booting with the OS CD (8.5.1) in the drive and get a bit further, but it complains of an unimplemented trap, and if I try holding down C to boot up, it starts to load, but then the screen flashes and it eventually locks up (but without the hard drive connected at all doesn't even get that far; just a gray screen).
    I've done some research and think my first step should be to replace the hard drive (though if that's not the case, I'd appreciate some insight). I haven't fixed many Macs before, though, so I still have several questions:
    1.) The drive that came with the machine is a 6 GB IBM connected to the mainboard IDE interface. It lists it as having Apple HDD Firmware. Is this firmware required on any drive I'd have to get to work with this machine, or can I go with any IDE drive and not worry about it like with PC's (I'm going to stay as small as I can, but with newer drives, that's probably still a lot of gigs)?
    2.) Similarly, when I do get a new drive, assuming that's the problem, will OS 8.5.1 be able to format and use it, as I've never done an install of this particular OS before. I'm assuming I just boot from CD and go through the process?
    3.) Unfortunately, I've discovered this unit is using the Revision 1 chipset. So I may need to go for some sort of PCI IDE interface option. Any recommendations for a cheap solution here, and is this a definite must to get this working reliably?
    4.) The owner of this machine also inquired about a DVD/CD burner (would have to be external as there's no room inside). Any recommendations that would work well with this machine, or is this machine not suited to using these types of drives well?
    5.) Can this Apple G3 run Mac OSX well enough, as the client has also expressed interest in upgrading OSes, or is it too slow for this?
    Thanks much for any help - this is fairly new territory for me!
    Shaun

    Shaun,
    After the iMac killed the used Mac market and the G4 killed the value of the B&W G3, I closed up shop and moved on to better ways of making money. lol
    One client wanted a newer mac cheap so I bought her a used B&W G3. One month later they came out with the Mac Mini for $125.00 more than a fully configured B&W. With in the year, that client moved up to a Mini. The B&W has plummeted in value since that day. Current market is G4 or better now.
    For a hobby machine, it is still a great computer. To pay for service time at shop rate, that model can quickly become a money pit. You may have already checked out some sites like this:
    http://www.macgurus.com/products/motherboards/mbppcg3bw.php
    so I apologize in advance if you already know the history of issues with that machine.
    Yes we can walk you through the resurrection of a Blue and ***** ( honest typo) Mac, but religious preferences aside, if you value the client, tell them about the value of a mini. It was built to run OS X. It has behaved flawlessly ( except with MS Office ) for us here.
    The model of B&W Mac that you mentioned has many service land mines. Those traps for the unwary can be easily avoided with SCSI interface cards and a SCSI drive. Your fees and the cost of the upgrades might add up to close to the cost of a bare bones Mini. Just something to consider.
    First thing to do is to "zap the PRAM" and Texas mac man gives a good tutorial here:
    http://www.geocities.com/texas_macman/pram.html
    The Apple OEM HDD firmware is not required but it does make life much easier on your client.
    If you have a spare Western Digital IDE drive kicking around, see if you can format it to Mac with Drive Setup in the Utilities folder of any drive you can get to boot that Mac after zapping the PRAM.
    The Mini can be ordered with a DVD burner.
    Good luck.
    Jim

  • Making movie project in iDVD without a theme - still having trouble. help!

    I am trying to make a movie in iDVD without a theme. I am following previous instructions but having a problem. I open up iDVD, create a new project. Pick a theme, then select the map view. When the screen opens I drag my movie into the first box which says "Drop content here to play....". I also loop the movie to play over. I am not able to move forward with burning a disc because there is a yellow triangle warning in the main theme box which says "menu contains no buttons". Nothing in HELP addresses this as far as I could find. Since I don't want to use menus and just want to burn my movie, how do I get around this problem. I finally decided to try and burn a disc anyway and iDVD quit during encoding process about half thru. Help....

    Thanks Geoff - Your suggestion seems to be what I am looking for. However, halfway thru encoding/burning iDVD app quits on me. I don't know why that is happening??????

  • Movie download trouble help plz i hope i didnt buy it twice

    i bought a movie and can watchit on my i touch but it went away so i rebought it thinkin it just stoped downloading then when i hooked it up one was there workin and another of the same movie was down loading does tht mean i bought it twice:( i cant afford it 2 take tht much out of my account how do i fix it ...or am i over reacting

    This is a user support board, so if you got charged twice, contact iTS support and see if they can help undo your trigger-finger spree.
    Usually you get a warning if you try to purchase the same thing twice. Did you see a warning?

  • IPhoto Importing Troubles Help

    Hi Everyone,
    So I import photos onto iPhoto from my Gopro and the last imports were there. I wasn't thinking and forgot to put them into an album so when I imported more from another camera they replaced the old photos in the last import folder. So now the new photos are there and the others have vanished. Confusing I know but if you can help or have ideas that would be great thanks!
    mrbush_

    Right  --  Last import is obviously the "last import" so each time you import it changes - that is simply a view of the last import and has nothing at all to do with the photos in your library - the photos can always be viewed as events or as photos (at the top of the source pane on the left of iPhoto under "Library"
    LN

  • Printer wont print. have new ink. trouble help say it ok but its not ok

    I HAVE A HPPHOTO SMART C5180 ALL IN ONE PRINTER. IT JUST STOP PRINTING SO I CHECK THE INK REPLACE IT WITH NEW INK AN NOW IT JUST WONT PRINT I TROUBLE SHOOT IT AN IT SAY ITS OK BUT IT STILL DONT PRINT . I ALLSO REPLACE IT WITH NEW PAPER AN IT STILL DONT WORK

    If resetting the que fails try deleting the printer and reinstalling (delete and allow your mac to find it again). This has worked for me in the past when I had trouble with the que.
    If that fails you can search the HP website for a OS-X compatible driver for this printer model and try using that instead of the pre-installed driver selected by OS-X.
    Good luck. Let us know how it turns out.

  • Flash Math need help

    I dont really understand why these two equations is giving me absolutely different result
    trace(10 + 1 * ( 80 + 10));
    trace((10 + 1)* (80 + 10));

    holy sh!!!!t
    is that so ?
    this only in flash Math though.
    not in real world?

  • Collapsible panel mouseover code trouble-help!

    i have several collapsible panels on my page and i want them
    to open on a mouseover and close on a mouseout. i changed the code
    in the SpryCollapsiblePanel.js widget file on line 208 (code is
    attached below) from
    "Spry.Widget.CollapsiblePanel.addEventListener(tab,
    "mouseover", function(e) { return self.onMouseOver(e); }, false);"
    TO -> "Spry.Widget.CollapsiblePanel.addEventListener(tab,
    "mouseover", function(e) { return self.onTabClick(e); }, false);"
    after reading a previous post instructing to do so. this
    allows the panel to open on a mouseover, but requires another
    mouseover to close the panel. if i change line 209 to
    "Spry.Widget.CollapsiblePanel.addEventListener(tab,
    "mouseout", function(e) { return self.onTabClick(e); }, false);"
    this allows the panel to close on mouse out, but only applies
    to the tab area of the collapsible panel. when your mouse moves
    down to click on a link in the content area of the collapsible
    panel, the panel closes before you can click on a link. how can i
    get the mouseout function to apply to the entire panel and not just
    the tab area of the panel? help!

    hi,
    thanks, that is what i am looking for.
    again thank u very much.
    regards,
    shiv

  • New Mac Pro Owner - In Trouble - Help!

    Is there a way to open the SuperDrive disc drawer without the OS or the keyboard?
    I had installed Boot Camp and was doing the Windows install, and I had the two keyboards I've had hooked up (the standard one that comes with the Mac Pro and this ergonomic keyboard I'm actually used to by Kinesis), and after I placed the Windows install disc in the drive and hit continue, after it went through all its loading and got to the point where it wanted me to hit Enter to set up Windows (or F3 to exit), neither keyboards were able to be recognized.
    I did try plugging in my Windows PC's keyboard, but, uh, at this point there ain't no plug and play, and it wasn't seen either.
    So all I could do is hit the power switch and then start it up again - but before powering up unplug the other keyboards and have only the standard Mac Pro keyboard connected, but apparently with that Windows Install CD in the SuperDrive and the Mac in whatever mode where it thinks it's installing Windows, I just get right back to the Windows setup, and again I can't send an Enter or even an F3 to escape.
    My theory is that if I can just start up Leopard again and be running in a one keyboard mode with the standard keyboard, then the Windows install might work and see the keyboard.
    At long last I am getting away from Windows,and now it is coming back to bite me and actually has me unable to use my spiffy new Mac Pro. Vindictive, eh?
    If nobody has any helpful advice, I will of course call Apple Care folks tomorrow when they are open.
    Sigh...
    Thanks in advance for any advice!
    Apple

    Thanks for the system preferences advice. Yeah, when I'd go to start up tomorrow evening I'd be wondering why I'd have to hold down the Opt key to get to OS X...
    My tricks to try to get the Windows Setup to see the keyboard didn't work. Even tried going with just a PC keyboard connected, booting into OS X to make sure it was seen there, then running the Boot Camp assistant to install Windows again.
    The Windows Setup just doesn't see any keyboard plugged in to any USB port. Period.
    Dang Windows...
    Thanks,
    Apple

  • Iweb troubles help please and paypal question

    Hi guys i am having a few troubles.
    i have made my site. i then publish to folder then i view it-zero flaws!
    i then copy it over using dreamweaver mx ftp to my site, it come up with an error.
    heres the site http://www.8i.com.au/InfinityImagery/Home.html
    problems:
    click on a blog in the blog section and it's not on the server.
    http://www.8i.com.au/InfinityImagery/Blog/Blog.html
    no photos apear but you can roll over them & click on them and they appear!
    http://www.8i.com.au/InfinityImagery/PhotoDiary.html
    random photos not viewable.
    also i want to put in a paypal shopping cart & paying facility... anyone know how?
    iPod 40gb 4g/ G4 Powermac 733 Quicksilver   Mac OS X (10.3.9)  

    Harrington,
    This could be off-base; I have never had a plasma TV.  I do remember that years ago when we purchased our first, (then) expensive Sony LCD that plasma TV's were considered high-end; they were high $$$, too.  The BIG thing about plasma TVs in those days was the great Picture - true Blacks and great colors - and you had to have them tuned up like a car.  Yes.  It was the reason we did not buy one:  Tune-ups.  High maintenance, like 12 cylinder race cars.
    I suspect your TV needs a Tune-up.
    That does not tell you what is wrong with it.  There may actually be such a thing as a tune-up-kit for a plasma TV.  Or, there may be a tech out there that knows what parts would ordinarily be on the list of things needing replacement - like that capacitor.  It might at least give you a starting place that makes sense:  "Well, we are supposed to replace / fix this - it is on the list", that sort of thing.
    "That's all I got."
    Good Luck!
    Kind Regards,
    Dragon-Fur

  • Simple math operation - Help needed

    Hi, i have a simple mathematical operation to do, related to
    a shooping cart, which i want to keep simple.
    I have a input text box named QT1, where customers indicate
    quantity
    I have a dymanic text box, named ST1, where i want the value
    of QT1 to be multiplied by 10$ (hence 10)
    on the release of the button. I have a NaN answer. Here is
    the code.
    on (release) {
    var qt1:Number;
    st1 = qt1 * 10;
    And then, a grand total button will add ST1 + ST2 + ST3, with
    GT the name of the grand total dymamic box:
    on (release) {
    gt = st1 + st2 + st3;
    The second part works, but the first one, with QT1 is giving
    me a Nan (not a number) answer.
    Any help appreciated.

    Problem solved. That cary Auto-kern thing....

Maybe you are looking for

  • How to use the compensate activity in bpel flow

    Hi Can anyone please let me know how to use the compensate activity in bpel flow. Like i have 4 DB adapters in a flow if any one fails i want do the roll back by using compensate activity. I am femiliar with transactions proparties, I want to do it f

  • How to automatically set transitions including overlap?

    I have a question about default transitions between video clips (and their associated audio tracks) in Premiere Elements 11. What I want to happen is that each pair of clips is overlapped through the transition (eg around 25 frames/1 second for PAL v

  • Happy Birthday Macintosh Jan 24, 1984

    http://news.softpedia.com/news/Happy-Birthday-Macintosh-16764.shtml

  • IHC Incoming payment - no posting on clearing account

    Hello together, I need some help with the processing of an external bank statement. I try to read an incoming payment from an external bank statement (MT940). When I post the bank statemenat with FEBAN I get two documents: one for general ledger and

  • Power/Audio issue

    Apologies if this has been posted elsewhere - I did try searching but to no avail... I've just noticed the past couple of days that my iPhone 5 is behaving oddly when connected to the mains power to charge. I'm using the USB/lightning cable and UK ac