Checking the point(x,y) whehter it is in the octagonal shape for selecting

hi!
I have drawn the octagonal shapes below by using the paint method
how can i check if the int(x.y) is in the octagonal shape??
can someone help me, please?
thanks in advance
public class [octagonal] extends [RectangularShape] {
     public [octagonal](int x, int y) {
          super(x,y);
          /*     Return whether the point (x,y) is in the octagonal - for selecting it
public boolean contains(int x, int y) {
               If selected, paint 4 handles.
     public void paintShape(Graphics g) {
          g.setColor(Color.black);
     int x1,y1,x2,y2,j,k;
               int n=8;
          for (j=0;j<=n-2;j++) {
               x1=(int) ( ((getLeft()+getRight() ) /2)+getWidth()*Math.cos(j*360/n*3.14159/180));
               y1=(int)( ((getTop()+getBottom() )/2)+getHeight()*Math.sin(j*360/n*3.14159/180));
               for (k=j+1;k<=n-1;k++) {
                    x2=(int) (((getLeft()+getRight())/2)+getWidth()*Math.cos(k*360/n*3.14159/180));
                    y2=(int)(((getTop()+getBottom())/2)+getHeight()*Math.sin(k*360/n*3.14159/180));
                    g.drawLine(x1,y1,x2,y2);

I've done it like this. but, it still doesn't fit into octagonal
shape how can i fix this?
public boolean contains(int x, int y) {
          Polygon poly = polyShape();
          return poly.contains(x,y);
public void paintShape(Graphics g) {
          Polygon poly = polyShape();
          if (filled) {
               g.setColor(getTranspColor());
               g.fillPolygon(poly);
          g.setColor(Color.black);
               int x1,y1,x2,y2,j,k;
               int n=8;
          for (j=0;j<=n-2;j++) {
               x1=(int) ( ((getLeft()+getRight() ) /2)+getWidth()*Math.cos(j*360/n*3.14159/180));
               y1=(int)( ((getTop()+getBottom() )/2)+getHeight()*Math.sin(j*360/n*3.14159/180));
               for (k=j+1;k<=n-1;k++) {
                    x2=(int) (((getLeft()+getRight())/2)+getWidth()*Math.cos(k*360/n*3.14159/180));
                    y2=(int)(((getTop()+getBottom())/2)+getHeight()*Math.sin(k*360/n*3.14159/180));
                    g.drawLine(x1,y1,x2,y2);
     private int hcentre(){ return ( getLeft() + getRight() ) /2;};
     private int hcentre1(){ return ( getLeft() + getRight() ) /4; };
     private int hcentre2(){ return ( hcentre1() * 3 ) ;};
     private int hcentre3(){ return ( getLeft() + getRight()); };
     private int vcentre(){ return ( getTop() + getBottom() ) /2; };
     private int vcentre1(){return ( getTop() + getBottom() ) /4;};
     private int vcentre2(){return ( vcentre1() * 3) ;};
     private int vcentre3(){ return ( getTop() + getBottom() ); };
     private Polygon polyShape() {
          int[] xs = {hcentre(), hcentre2(), hcentre3(), hcentre2(), hcentre(),
                              hcentre1(), getLeft(), hcentre1(), hcentre()};
          int[] ys = {getTop(), vcentre1(), vcentre2(), vcentre3(), getBottom(),
                              vcentre3(), vcentre2(), vcentre1(), getTop()};
          Polygon poly = new Polygon(xs,ys,9);
          return poly;
     }

Similar Messages

  • I have adobe acrobat 11 reader writer I want to use the pointer symbol on full screen instead of the hand, iwas able to do it on adobe 10 also when in full screen i can't open attachments unless i right click and open it then it boots me out of full scree

    I have adobe acrobat 11 reader writer I want to use the pointer symbol on full screen instead of the hand, iwas able to do it on adobe 10 also when in full screen i can't open attachments unless i right click and open it then it boots me out of full screen is there any way i can click on the attacment without going out of full screen

    I don't know why the change, but the pointer appears in the same way as it does on the main screen, not a pointer. There does not appear to be anyway to change it. You may want to submit a comment to the Features Requests: Acrobat Feature Requests. I also submitted this as a bug.
    As a clarification, your "adobe acrobat 11 reader writer" is not informative. There is Acrobat 11 and Reader 11. Writer is not a product as such. So you have referred to Acrobat in a contradictory manner. In the future, please just indicate Acrobat 11 or Adobe Acrobat 11.

  • I am having a recurring problem with my screen suddenly enlarging to the point where I cannot use it!  The power button is also unresponsive.  When it does work and the screen is large, I cannot access the slide at the top.....

    I am having a recurring proble with my screen suddenly enalrging to the point where it is unusable. The power button is also not working.  When I try to shut off the phone to restart it, I cannot swipe across the top to power off vbecause the screen is so big and unresponsive.  Can someone help me with this problem?

    Double tap the screen with three fingers to switch off zoom, then go to setting and disable it to make sure you don't switch it on again by accident.
    http://support.apple.com/manuals/

  • The pointer of my mouse is clicking on the wrong thing.

    I have a  mid 2012 Macbook pro that works perfectly fine, however i have both my MBP trackpad and magic mouse working but when i click something the pointer is on the icon or link and its trying to select something else near by the original icon or link. what is this madness?

    1: Connect the device to your computer and open iTunes.
    2: If the device appears in iTunes, select and click Restore on the Summary pane.
    3: If the device doesn't appear in iTunes, try using the steps in this article to force the device into recovery mode.

  • What is the point of [Bindable("selectionChange")] in parts of the spark datagrid class?

    I dont understand the point of this code in the spark datagrid class:
    what is the point of this:
        [Bindable("selectionChange")]
         [Bindable("valueCommit")]
         [Inspectable(category="General", defaultValue="null")]
    in
        //  selectedItem
        [Bindable("selectionChange")]
        [Bindable("valueCommit")]
        [Inspectable(category="General", defaultValue="null")]
         *  @copy spark.components.Grid#selectedItem
         *  @default null
         *  @langversion 3.0
         *  @playerversion Flash 10
         *  @playerversion AIR 2.5
         *  @productversion Flex 4.5
        public function get selectedItem():Object
            if (grid)
                return grid.selectedItem;
            return (dataProvider && (selectedIndex > 0)) ?
                dataProvider.getItemAt(selectedIndex) : undefined;
         *  @private
        public function set selectedItem(value:Object):void
            if (grid)
                grid.selectedItem = value;
            else
                var f:Function = function(g:Grid):void
                    g.selectedItem = value;
                deferredGridOperations.push(f);

    Anything that is binding to selectedItem will go get the value again when either of those events fires.

  • Cost error message at the point of saving a Process Order

    Dear Experts,
    Raw Materials R458 and R467 are processed to produce semifinished material S229
    While creating a Process Order for material S229, at the point of saving the process order I get the following error messages:
    1 No cost element segment exists for 21501000 on 07.07.2011
    2 Cost Element Group 2950 does not exist
    At the point of saving, cost gets calculated by the system.
    Which account(s) is this cost posted to?
    Is it the ''Offsetting entry for inventory posting'' account  of the Raw materials R458 and R467? or
    Is it the ''Offsetting entry for inventory posting'' account  of the Semi material S229? or
    Is it the Cost Center to which the Resource is assigned to?
    How can I view this calculated cost value within the particular account?

    Hi,
    1. For error No cost element segment exists for 21501000 on 07.07.2011
    Can you check whether you have maintained valuation type in the accounting tab? Also have you maintained costing tab? If you have maintained then go to OBYC that is in GBB with account key VBR GL may have not maintained. Ask your FICO guy to check this.
    2. For error Cost Element Group 2950 does not exist
    Go to below link
    Cost element group does not exist. S_ALR_87013620 report
    Regards / US

  • Since i updated lion the pointer will not show contents when i hover the pointer over the item....

    Since i updated lion on mac pro the pointer will not show contents whil hovering the pointer over the item.... ???

    If you use extensions like <i>Adblock Plus</i> or <i>NoScript</i> or <i>Flashblock</i> that can block content then make sure that such extensions aren't blocking content.<br />
    You can see the installed Firefox extensions in "Tools > Add-ons > Extensions".
    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]

  • Whats the point of "Add Encore Chapter Marker" if I have to export it to m2v to use the sequence in

    Eh collegues there is a button on the timeline "Add Encore Chapter MArker"
    But since I have to export the entire sequence in M2V and WAV if i want to use it in enocre, then whats the point of this?
    Can i put the timeline to encore without having to export the whole project in m2v via the "File>Export>Export to encore" option?

    File, export, movie. Export as dv avi. then open encore and import as timeline.
    You can make chapter points in premiere as well, but you have to use sequence markers. when you export movie, make sure you include chapter markers under compile settings. Or you can make chapter markers in encore.

  • Overlapping polygon and how to determine the points

    I have a larger footprint polygon/table called A and a sub-polygon/table called B.
    I need to identify which is polygon A and which is polygon B because they overlap with each other.
    And I need to identify all the point that falls within A and B.
    which means A = A and B = A+B and the other points that do notfall within A and B will be null.
    How do I start this assignment?
    I was thinking
    alter table A
    add  (ID varchar( 50 BYTE)) ;
    update A
    set ID = 'larger';
    --TO do a point in Polygon
    PROCEDURE point_polyA
    IS
         proc_name varchar2(50);
    BEGIN
         proc_name := 'point_polyA';
         add_log(proc_name,'Start processingpolyA');
         COMMIT;
         FOR x IN (SELECT id, geoloc
                       FROM A)
         LOOP     
              FOR y IN (SELECT a.*
                            FROM point
                           WHERE sdo_filter (A.geoloc, x.geoloc) = 'TRUE')
              LOOP               
                   IF sdo_geom.relate(y.geoloc, 'ANYINTERACT', x.geoloc, 5) = 'TRUE' THEN
                        INSERT INTO point_polyA ( id)
                             VALUES ( x.id);
                   END IF;          
              END LOOP;
              COMMIT;
         END LOOP;
         add_log(proc_name,'Finish!');
         COMMIT;
         EXCEPTION
                 WHEN OTHERS THEN
                    add_log(proc_name, substr(SQLCODE||' '||SQLERRM, 1, 199));
         COMMIT;Do the same for B then
    select ID
    from A,B
    where sdo_relate(A.geoloc,B.geoloc,'mask = contains') = 'TRUE';Message was edited by:
    CrackerJack

    Hi,
    this
    rownum<2
    making sure that only the one clicked polygon is rendered/displayed
    (pls see the [image of the screen |http://bp0.blogger.com/_8PXbvmaOB6M/SEe0rNCz4nI/AAAAAAAAAWo/lOHcLjbIz-U/s1600-h/verschneiden_snap3.png] )
    i.e. you click on the polygon of the area (county) and get the FOI as per Parameter 1 (which are the records/FOI contained in the first table "DEKUNDEN" = customers)
    in ur above code you will need to say:
    (b.geoloc, :1)
    recommend to firstly try to achieve a result with the delivered MVDEMO data.
    Then the SQL of the theme will look as follows:
    select a.location, a.name,
    a.city, a.sales from customers a where sdo_relate(a.location, (select
    geom from counties b where sdo_contains(b.geom, :1)='TRUE' and
    rownum&lt;2), 'mask=ANYINTERACT')='TRUE'
    re) attributes for both points and polygon
    --> for the points (customer table/theme) usually you get an Infowindow automatically for the theme "customers" for the "Info columns" you have defined in the ADVANCED Tab of the theme in the Mapbuilder.
    --> for the polygon you'll have to assign an info window on "mouse_right_cklick" as the "mouse-click" (left) has already been used for selelcting the polygon.
    and lastly I am not dealing with a webservice - just 2 tables: "customers" (with the POI - points) and "counties" (the polygon - area) from the MVDEMO example data.
    Hope that helped and I did not make more complicated - sorry - but it is quite complex (;-).
    Bernhard
    Edited by: BernhardFW on Aug 25, 2008 1:30 PM

  • What's the point of OS 9?

    hey everyone,
    i was wondering if someone could enlighten me on what the point of installing mac os 9 with the os x? also why do i have to install os 9 in order to be able to install starcraft? why can't it work with os x?

    Hi, Taylor. The point of installing OS 9 in addition to OS X is to be able to run software that was written for OS 9 and earlier, and is not available in, or has not been upgraded by the user to, an OS X-native version. I'm not familiar with Starcraft, but if there isn't an OS X version of it that you could upgrade to, you'll have to run it in Classic mode, which means OS 9 running as a "super-application" within OS X.
    OS X is every bit as different from OS 9, under the hood, as it is from Windoze. Making an OS 9 application run natively in OS X means rewriting it from the ground up. Many older Mac programs never made that jump, so there are lots of Mac users from the old days still running their favorite antique software in Classic, even after upgrading to Macs that can only start up in OS X.
    I bought my first Mac 22 years ago last month, and I've accumulated useful software ever since. I use about 200 different applications on my Powerbook, and at least 80% of them run only in Classic mode or when I'm booted into OS 9. I could never afford to upgrade all of them to OS X versions, even if OS X versions were available for all of them — which isn't the case by a long shot. I'm a convert to OS X now, but I sure wouldn't want to let all those useful apps go, so OS 9 and Classic are indispensable for me. And I'm not alone. That's why this forum exists.

  • What's the point of Desktop 6.2 vs 4.2?

    Hi - I have a new Centro coming to replace an ailing TX so thought I would "upgrade" my desktop to 6.2. Was I in for a shock. PD 6.2 is not an upgrade, it's a downgrade. It locks up when I try to access my Note Pad files, there is no color anymore in calender events, etc. I don't want to use this with the new Centro either! I googled and found that PD 4.2 will work with Centro. But I have to wonder: what is the point of 6.2 being worse than the versions it supposedly replaces? Is there a better (than 6.2) PD coming? I'm on TMobile, so the Pre is not an option. Thanks for any insights!
    Post relates to: Palm TX

    Hi, and welcome to the Palm Community Forums.
    Palm Desktop 6.2.2 was provided to Palm by Access, the company that owns it now, in order to provide Windows Vista compatibility.  As far as I can see it, there are only two reasons to use it over PD 4.2:
    if you have a Vista desktop;
    if you plan to migrate to a Pre, because the data transfer assistant which comes with the Pre will apparently only work with Palm Desktop 6.2.2.
    I would not personally expect any further upgrades or development of Palm Desktop.  Palm is pretty much done with the Palm OS, and without any new Palm OS devices coming online, I doubt Palm would invest any resources to further develop the Palm Desktop.
    smkranz
    I am a volunteer, and not an HP employee.
    Palm OS ∙ webOS ∙ Android

  • [locked] A Different Perspective On The Point System

    I was reading Joel on Software today and he was talking about "Stack Overflow" which is a very successful Q&A forum for programmers by programmers.  Joel makes the point that the Stack Overflow board (which is similar to these forums in that it's a technical support forum) uses a point system. Joel goes on to write;
    "It’s not much of a secret, but Stack Overflow is already a great place to find good programmers, because you can see how good people really are by reading the answers that they post. I’ve noticed a lot of people putting their Stack Overflow reputations on their resumes, and we’re starting to hear stories of people who got jobs through the site. Jeff and I are committed to building features to make this easier in the next “six to eight” weeks. For example, I’ve always hated traditional resumes, which just don’t give the right kind of information about a candidate. If you wanted to hire an iPhone developer, would you rather know that person’s Stack Overflow stats in the iPhone tag and read their answers to technical questions? Or would you rather know where they went to college?
    If we pull this off, getting jobs in the tech industry will be a lot saner."
    I'm not sure at this point where I sit in this debate; but I thought you all might be interested in a reasoned opinion on the pro side.

    If those pros that you're referring to don't care about the points then how exactly are they destroying the forum?
    many of them are insulted by them and have left. the format of the forums have changed becasue the new system discourages long teaching discourses with lots of back and forth an examples coming from the teachers and the students. this format encourages quick, dirty answers (as pj says, paraphrasing: who needs a discourse when ESC ESC UP UP DOWN LEFT RIGHT START works, and others add: even if that trashes your image!).
    and on the other hand there are those in charge of the Community Help
    who say that they have solid data indicating that points have helped
    increase the overall value of the comments posted there
    no offense to any but i don't believe that for a second. change that to maybe those who have some vested interest in the new forums or are in some way beholden to adobve mgmt are pushing the corporate line, then yes, you've got a point.
    and who the $@** are "community help"? i haven't seen ANY "community help" in the last 7ish years except that provided by myself and other dedicated users to the adobe user "community".
    Gee, i wonder who i'll believe....
    hmm, maybe the guy who cares enough about adobe and it's products to spend the last 7 years donating his time helping people use adobe's programs? Gee, f*&k off with your snide "Gees" bish. thanks.
    You're freaking incredible Dave.
    um, sorry steve, you did notice that i was responding to pj who said he doesn't care, right?
    If
    the intent was to change the flavor of the forums, they are being very
    successful! A lot of the old friendly banter is gone, and answers are
    given to try to satisfy the OPs question and no more. I feel it's a big
    shame.
    exactly... that's all i was saying.and i feel that if that's the intent, adobe should come out and SAY so. then those of us who care about the programs and helping people make best use of them can move on and those who care about racking up meatballs can provide the free tech support for a change.
    I am personally not against a point system per se, but I am opposed to the way it is implemented. If ALL
    users could give points (or kudos, or what-have-you) for a useful
    answer (and not just the OP), with no limit to just three per thread,
    people would be encouraged to give more complete and universally useful
    answers. I believe that such an implementation would promote the joint
    learning atmosphere instead of stunting it...
    again, yes. and this was brought up in this specific forum when we were asked for feedback.
    the focus of the forums hasn't shifted, all that happened was that they added points, don't blow this out of proportion.
    you're wrong zeno! not only are you wrong, but you're speaking as if you're some sort of authority on it and if you have any pull with adobe (and it seems you do) then you're providing them with your wrong, skewed view of how things were vs. how they are.
    how the heck would you know? where did you come from? how did you get authority? WHERE THE H&LL WERE YOU FOR THE LAST DECADE that you can compare the way the old forum works with the vapid eye candy we're being forced to use now? you sure as heck weren't providing adobe photoshop windows support...
    GEE, "A customer is the most important visitor on our premises. he is not dependent on us. We are dependent on him. He is not an interruption in our work. He is the purpose of it. He is not an outsider in our business. He is part of it. We are not doing him a favor by serving him. He is doing us a favor by giving us an opportunity to do so."

  • Is the points system too restrictive?

    When I first joined these forums, the points system was quite different, so that the transition from level three to four took a long time, but was possible. Since then giving and receiving points has tightened up so much that I now think that it is all but impossible to get from level two to level three in a reasonable time.
    I would like to know how many people have made the level three to four transition since the current point regime started? and of those, how many were already close to the transition at the changeover?
    Is the current scheme too restrictive? Was it cynically designed to be restrictive to reduce the number of people getting to level four?
    Bob

    Majordadusma leveled on 6/20/06.
    Okay. There may still be some overlap between this list and yours.
    *Carried up to L4 by the points conversion at the time of the transistion*
    b noir (from L2)
    Buegie (from L3)
    StarDeb55 (from L3)
    *L4 level achieved some time after the transition*
    Alan Somers
    AxL
    Bryan Mick
    David S.
    Dick Napoli
    F Shippey
    Francine Schwieder
    Michael Lafferty
    Otto42
    QuickTimeKirk
    The hatter
    Anyone there you've already got, Ronda?

  • Raw 6.7 RC forces use of process 2010.  Why and What is the point?*

    I installed it and every time I try to make a picture use the 2012 item it forces me to use the old one.  I have never seen such a useless go round the pole!  Far as I see it does nothing.  At least LR4 lets you use the thing.  If this is what it does how do I uninstall?  Thank you for the time to answer.  Richard

    Sorry, I do not see the point here.  CR 6.7 is the current one used w/ CS5.  If you have CS5 you need to keep CR 6.7.  My original question was about the interface of CR 7 (in LR4!) and CS5.  Adobe will (would not) not let CS5 use CR 7.   If you use the beta of LR4 like I did then you might see the same question.  The answer to that is that when/if you get CS6, the problem will go away as they then have the same version.  Additionally, it is correct that, using LR4, either beta or purchased, you can use the "render in lightroom" option in the Camera Raw dialog box that comes up and it will then open in CS5 if you choose not to upgrade.  hope ths is a bit more clear and helpful.

  • What  is the point of the icloud ".me" email?

    The point of icloud is to sync all the ios devices that people have correct?
    If I have a gmail account hooked up to all my ios devices via the mail app, like most others, I don't see the point or need of having the .me email account
    So I was wondering if anyone knew why this .me email service exists.
    Thank you

    The only reason would be if you want everything in one place. Its an extra feature that like you im not using right now, i still use my gmail for mail but iCloud for contacts, calendar, etc. So for you there is no point

Maybe you are looking for