Little problem with Shape.intersects

I have the following code:
boolean isCollision = island.contains(line.getP1()) ||
island.contains(line.getP2()) ||
island.intersects(line.getP1(), line.getP2(), 1, 1);This doesn't work:
The method intersects(double, double, double, double) in the type Shape is not  applicable for the arguments (Point2D, Point2D, int, int)
Interface java.awt.Shape:
intersects(double x, double y, double w, double h)
Tests if the interior of the Shape intersects the interior of a specified rectangular area.
Now I changed my code to the following:
boolean isCollision = island.contains(line.getP1()) ||
island.contains(line.getP2()) ||
island.intersects(line.getP1().getX(), line.getP1().getY(), 1, 1) &&
island.intersects(line.getP2().getX(), line.getP2().getY(), 1, 1);However, it doesn't seem to work since I don't get a "true" if there is an intersection; the "contains" method works excellent.
How can I intersect a line with a shape to see whether there is an intersection?
Thanks!

I am sorry, I am unsure in which forum my question fits best. Can an admin delete my posting from the wrong forum?
I would really appreciate help on this topic since I can't solve this problem alone :(

Similar Messages

  • Little problem with Photoshop ....

    Hi. I have a little problem with photoshop CS 4. I use a color replacement tool to change a color in some details... but when i set new color, on pictures entries only or grey or black colors and nothing other... i dont known why.... please help . Thanks. Sorry for bad english

    Usually the Color mode is the one you want for the color replacement tool, you
    might have it set to luminosity or your trying replace black or white colors.
    MTSTUNER

  • Little problem with Strings.

              I have an little problem with Strings, i make one comparision like this.
              String nombre="Javier";
              if( nombre.equalsIgnoreCase(output.getStringValue("CN_NOMBRESf",null)) )
              Wich output.getStringValue("CN_NOMBRESf",null) is "Javier" too, because I display
              this before and are equals.
              What I do wrong?.
              

    You are actually making your users key in things like
    "\026"? Not very user-friendly, I would say. But
    assuming that is the best way for you to get your
    input, or if it's just you doing the input, the way to
    change that 4-character string into the single
    character that Java represents by '\026', you would
    use a bit of code like this:char encoded =
    (char)Integer.parseInt(substring(inputString, 1),
    16);
    DrClap has the right idea, except '\026' is octal, not hex. So change the radix from 16 to 8. Unicode is usually represented like '\u002A'. So it looks like you want:String s = "\\077";
    System.out.println((char)Integer.parseInt(s.substring(1), 8));Now all you have to do is parse through the String and replace them, which I think shouldn't be too hard for you now :)

  • Little Problem with Photoshop CS3

    Hi, I have a little problem with Photoshop CS3, I'm not sure if this's because a Windows option that I messed up, but the thing is that I didn't touch any options, or some kind of preferences.
    I'm talking about the "little windows" (I don't know the correct name) that come from, in this case, the Filter and Analysis options, they're coming down from their right side, and usually, the come down from their left side. This is really annoying.
    Not big deal, but I can't really work properly. I hope you guys can help me, and this's my first post, I hope I didn't break any rule.

    Thanks Mylenium, that was the problem, I don't even have a tablet, but that fixed my problem =)
    Thanks again.

  • Hello, I have a little problem with my ipod (3rd generation): I restored my iPod because of problems of wi-fi, then synced my music on itunes and then on my ipod. The problem is that I still do not have wi-fi and my ipod says I have no music. Help me!

    Hello, I have a little problem with my ipod (3rd generation): I restored my iPod because of problems of wi-fi, then synced my music on itunes and then on my ipod. The problem is that I still do not have wi-fi and my ipod says I have no music. Help me!

    No. In fact, my ipod detects the livebox and the network but I can not connect to the internet.

  • A little problem with color profiles

    I am trying LR and so far I love it, it has successfully replaced RSP for me, and also beat Bibble which I briefly considered but didn't like due to the weird UI.
    However, I have a little problem with colours, which has never happened so far with other converters, and I am hoping you can help me to solve it.
    My monitor is calibrated with the Spyder and the appropriate profile loaded in the video card.
    When I work on a RAW image in LR, and then export a sRGB JPG, and then open it with a browser, or the Win viewer, I see it redder. If I open the image in Faststone, I see it almost sepia.
    If I export a TIFF and open it in PS, I see it as in LR, but when I export a JPG from PS (this is my typical workflow), the resulting image has the same problem.
    Considering that my entire workflow is in sRGB, can anybody coach me as to the correct settings I must use in order to obtain a final sRGB image with the same colors as in LR? I think that I must be doing something wrong, as the program behaves consistently with PS.
    Thank you in advance for any help you will be able to provide.
    Andrea,
    from Italy

    Funny how it's only Windows users that have this 'problem'.
    This is not a 'problem' at all. The only 'problem' here is that you've been used to using non-color-managed applications. Suddenly, Lightroom comes in as a mature, color-managed, program... and you're all going bonkers.
    Mac users aren't going bonkers because we're used to using color-managed applications (Preview, Safari, etc. are all color-managed on a Mac).
    Let me clarify for you that by 'color-managed', I mean that the software is *not only* reading the embedded profile in your image, but is *also* converting, on-the-fly, the RGB values of that image to a new set of RGB values that compensates for the native response of your monitor. Say, for example, your monitor only displays a narrow gamut of reds. Chances are, then, that LR or PS will intelligently compensate for this by saturating reds before sending to your monitor. This is how color management works. You can now imagine the disastrous effects that a bad/inaccurate monitor profile might have...
    Your Windows applications, such as 'Viewer', use the Microsoft ICM 2.0 API. This *will* read the embedded profile in an image, but instead of converting to your monitor profile for output, will simply convert to sRGB. That's basically like half-a$$ color-management. Read more about it here:
    http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/prork/prdn_img_vkev.ms px?mfr=true
    Firefox & IE don't even use the ICM 2.9 API, making them entirely non-color-managed. Whatever the raw RGB values are in your image, these applications spit out at your monitor.
    It's very important you understand these simple concepts before proceeding any further.
    OK, ready?
    The original monitor profile that came with my MacBook Pro (profiled by someone over at Apple generically for all MacBook Pro LCDs, I guess) really seems to have underestimated the gamut of my monitor. Hence, color-managed applications compensated for this be resaturating my images (especially in the oranges/reds) before outputting to monitor. Therefore, images looked really nice and saturated in color-managed applications; however, when I exported them to sRGB JPEGs and then uploaded to the web, they looked desaturated (in Firefox, NOT in Safari, since Safari is color managed). They even looked desaturated on other people's monitors (these 'other people' were your average Joes...).
    I then profiled my monitor using an i1 colorimeter. A 3-D plot of my monitor profile now showed that it actually had a much larger gamut than what Apple had predicted in their profile (but this gamut was still much smaller than sRGB, or the gamut of my Dell LCD or Sony CRT, etc.). Therefore, now, LR and PS, using this new profile, showed images much less saturated. Now when I made my edits, and then exported to sRGB JPEGs, images looked slightly *more* saturated in non-color-managed applications and on other people's computers.
    So, you see, your monitor profile affects how you make adjustments/edits in color-managed programs. If your hardware profiler profiled your monitor incorrectly (which I assume is the problem here), then you may be over-saturating certain colors within LR, skewing those RGB values so that a non-color-managed program, which will not re-correct these values as LR is doing, will display the image with too much, say, red.
    Bad monitor profiling also explains why you see this problem only on certain images/colors... if it were a LR problem, you'd most likely see it on every export. The color variance is more than likely due to a bad monitor profile that is not accurately describing your monitor's native response... hence LR/PS are incorrectly adjusting your images before sending to the monitor.
    And at this point, please don't resort to saying "but the colors in the web browser look 'right' and LR looks 'wrong'". This statement has no meaning, as what looks 'right' to you in your web browser might look horrible to someone else with a different monitor. The point of color-management is to minimize these differences. For example, I was very unhappy by how desaturated my images looked on the web compared to in PS before I calibrated my monitor. Now, images look slightly *more* saturated on the web than in LR/PS, which I'm OK with. *Should* they look the same? Heck no. Similar? Yes. Is it better if they do look the same after hardware profiling? Yes, if your main goal is web export, but, keep in mind, the only way they *would* look the same after PROPER hardware profiling would be if your monitor happened to have a very sRGB-like response (to explain this would take another few paragraphs... but you should be able to figure it out if you ponder a bit).
    I hope this is making sense. Let me ask you a couple questions now:
    1.) For your headshot image, IMG_8860, which colors look 'right' to you -- the colors in LR, or the colors upon export (i.e. the headshot on the left or the right in your link above)?
    2.) How exactly did your profile your monitor? Was it in the dark? I had quite a bit of variance in my monitor profile depending on whether or not the Mac OS X dock was visible at the bottom of the screen -- the light from the dock leaked into the colorimeter which then led to profiles that generated yellow/green color casts.
    -Rishi

  • Problem with Shape Hints

    My professor and I are both stumped, so maybe someone can help me out?
    I'm using Flash CS4 (on a mac) and I'm trying to use shape tweens between two parallelograms. They are shapes and not symbols, since I hear you can't shape tween symbols.
    The transition is sometimes funky, so I try using shape hints to keep it from tangling. Sometimes they all work perfectly fine, sometimes only 1-2 points cooperate, and sometimes Flash ignores them altogether.
    They are snapped to the appropriate vertices, they're in the right order, and they're the right colors to signify they've been placed properly (none are red). I also started with "a" as the top left and placed them counterclockwise, which the Adobe tutorial said to do. I've consulted a dozen or so other tutorials and none of them address this problem. I don't think it's the computer - I've tried it on my laptop and several of the desktops in the design labs and ran into the same problem.
    Is anyone good with shape hints that can tell me what I'm missing?

    I've been trying it and Flash is being consistently inconsistent. I'm doing the same thing to dozens and dozens of squares and still can't find any rhyme or reason, it just works some times and not others. I thought it might have to do with the top left corners being moved to the not-top-left, but when I adjusted that it only worked for a few things. I'm just gonna accept defeat, I'm just surprised that I've got the same problem on every computer I try but can't find anyone else experiencing it.

  • Urgent Little Problem with JApplet

    Hi, i have a little problem, i have an applet that loads on a webpage
    it contains two textFields and a command button , i want when i click
    on the button i should open a new page with the values in the two TextFields.
    Thanks.

    Use getAppletContext().showDocument(URL url).
    ================================
    Sincerely,
    Melnikov V
    AlarIT programmer
    http://www.AlarIT.com
    ================================

  • A stupid little problem with FORTE

    Hi to everyone,
    I'm using FORTE on windows 2000 but I've a little problem: I can't put the characters {} in the source editor.
    I've tried with the ASCII code (ALT + 123) and with ALTGR+7 but they don't work. How ca I do?
    Thanks

    You can copy the them from where you are able to type them, and then paste them in the editor with ctrl+v. To copy, you can use ctrl+c.

  • I have a little problem with input in my program...(System.in, BufferedRead

    I'm coding a program that takes a input like this :
    Sample Input
    1 11 5
    2 6 7
    3 13 9
    12 7 16
    14 3 25
    19 18 22
    23 13 29
    24 4 28
    So I wrote a code like this :
    public static void main(String[] args) throws Exception{
              BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
              String input = null;
                   while((input = br.readLine()) != null) {
                   StringTokenizer st = new StringTokenizer(input);
                   int leftX = Integer.parseInt(st.nextToken());
                   int height = Integer.parseInt(st .nextToken());
                   int rightX = Integer.parseInt(st.nextToken());
    .... rest of the code....
    But unlike I expected, the program did not pass the while loop.
    When I observed in debugging mode, when "br.readLine()" has no more strings to read,
    the whole program just becomes idle doing nothing, and it does not proceed further.
    Is there any problem with my code there? I've been trying to figure it out for hours... Please help!!!

    myunghajang wrote:
    Why doesn't it work in a way I intended? BufferedReader returns null if there is no more string to read, and what's the problem?
    It's so frustrating...The computer doesn't have a mind reading input, how is your program supposed to know you have finished typing the input?
    If you put the data in a file and redirect it into your program on the command line it will work (because the file knows where its end is)
    Your program could instead assume that a blank line is you end of input.

  • Having a little problem with iPhone 3G.

    Hi!
    I have problem with Iphone 3G 16 GB. I was trying to reset all the settings in the iphone but something went to wrong side and now probably operating system is damaged and only icon for connection to the iTunes is showing up. ITunes is not recognizing the phone. Please can you help me!
    Thanks in advance.

    Hey gonche,
    The iPhone is in Recovery Mode, generally the iPhone will have to be restored to get it out of recovery mode.
    This article: http://docs.info.apple.com/article.html?artnum=305744 will walk you through restoring the iPhone.
    -Jason

  • Little problem with rename view

    Hej, I've been having a problem an small problem with this... so far i'm changing the position of the tree of and Active Directory account... the major problem is that if i move this account 3 times the accountId fot that resurce is still the original one.
    <set name='newViews.newAccountId'>
                    <ref>myIdentity</ref>
                  </set> 
                  <set name='newViews.accounts[AD].newAccountId'>
                    <ref>myIdentity</ref>
                  </set>
                  <set name='newViews.resourceAccounts.selectAll'>
                    <s>false</s>
                  </set>
                  <set name='newViews.accounts[AD].identity'>
                    <ref>myIdentity</ref>
                  </set>
                  <set name='newViews.accounts[AD].newAccountId'>
                    <ref>myIdentity</ref>
                  </set>
                  <set name='newViews.resourceAccounts.currentResourceAccounts[AD].identity'>
                    <ref>myIdentity</ref>
                  </set>
                  <set name='newViews.resourceAccounts.currentResourceAccounts[AD].selected'>
                    <s>true</s>
                  </set>
                  <set name='newViews.resourceAccounts.currentResourceAccounts[Lighthouse].selected'>
                    <s>false</s>
                  </set>myIdentity is the new value for the account basically cn=..,ou=.. etc.. and all works fine but the first given accountId when the account is created always remains and is never changed during the rename action....

    Hi,
    I had the same problem. The move operation in AD functioned perfectly but the displayed account information kept showing the old DN. The problem was, I had the move activity inserted in the update user workflow BEFORE the Provision activity. I moved my custom rename activity to AFTER Provision (and right before notification) and now the new DN is showing on the account information screen. It appears that if you do the rename before provision, the old information will overwrite the new stuff. But if you do it after provision the new stuff will overwrite the old stuff.
    I hope this helps :-)

  • I have a little problem with iphoto

    Hi, i have a little problem when i used my iphoto.
    First, i'm so sorry because my english is not fluent, but i hope that you understand me.
    The problem is that, i can't see the photos when they are vertical, i mean, when i change my photos horizontal view to vertical view, i can't see the vertical photos.
    Can you help me??? i dont understand what is the problem.
    Thanks so much.
    Lorena from Colombia

    Try rebuild the library:
    Hold down the apple and option (or alt) keys and launch iPhoto. Use the resulting dialogue to rebuild.
    Regards
    TD

  • I have a little problem with recursion.

    I have a HashMap, and I've written a method to fill it up recursively. The map size is 20.
    void fillMap(HashMap map)
    if(map.size()==20)
       return;
    //Code to fill up map
    System.out.println("Map size = " + map.size() );
    fillMap();
    }Output is like:
    Map size = 1
    Map size = 2
    Map size = 3
    Map size = 19
    Map size = 20
    Map size = 1
    Map size = 2
    and so on.
    Is there a problem with doing: if(map.size()==20)
       return;?

    yeah that was a typo.. my actual code seems to be fine that way.
    And it wouldn't compile unless I had a fillMap(*no value*) method either, right?
    I still don't get what is wrong. Here's some new code
    public class CustomMap extends HashMap
         public CustomMap()
              super(new HashMap(20));
              fillMe();
         private void fillMe()
              Object key;
              Object value;
                    if(size() == 20)
                   return;
              //--bunch of code here to determine the key and value
                    //-- I have it so no key and no value are the same, by the way
              put(key, value);
              System.out.println("Size: " + size());
              fillMe();
    }

  • Little probleme with UIScrollBar

    Hi,
    Im having a problem with my UIScrollBar.,
    I have a dynamic text field "My_text" in the scene.  the text is aplied to it  dynamicly    like this: My_text=String(theVarText). The text appear but the scroll dont scroll. but if i set the text in the textfield in the actual FLA and export the movie, the scroll works, Can someone tel me WHY ??

    When you write to a textfield that has a scrollbar assigned to it, you need to refresh the scrollbar if you change/add text after the file is playing.  I don't have the help documents available at the moment, but if you should be able to look thru the UIScrollbar methods and find the method that is used for this... possibly reset() or refresh() or update().  So once you write to the textfield, use that command to make the scrollbar readjust to the new next situation.

Maybe you are looking for

  • Can we use two hierarchies off a single characteristic in the same query?

    Dear Bwers, I have a requirement where the user wants to see a query with two hierarchies at the same time on a single characteristic.Is this possible? If so please let me know how to model them in BW? Thanks for all the help in advance Raj

  • Trouble with windows XP

    I recently tried to reinstall window xp in bootcamp. I reformatted C: and tried to re-install my windows XP with service pack 2. Every time I try to install it automatically ejects and says it cant find the installation disk. Any thoughts?

  • LMS 3.2 Ciscoview 6.1.9 : Problem to recognize module WS-X4748-RJ45V+E

    Hello, LMS ( Ciscoview) fails to recognize the module WS-X4748-RJ45V+E into a 4510R+E LMS is 3.2. The other boards in the 4510R+E are recognized: WS--X45-SUP7-E     : OK WS-X4648 -RJ45-E    : OK WS-X4748-RJ45V+E  : NOK Can you help me ? Regards,

  • Strange User Account behaviour at Log In - not solved re duplicate thread

    This morning I cold booted my laptop and strangely after signing in it declared that it was "Preparing Windows." I was then taken to a desktop with empty Documents etc. folders. Panicking I went to the User Accounts and found all my folders and data

  • Mapping edi 820 VS idoc

    Hi I am doing mapping for EDI 820  and PEXR2002 IDOC output . I couldnt able to map for sure certain  interchange control header and functional group header ?. I need to submit this map to EDI team to process . For example Control number field ,Sende