Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7182051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:41:16+00:00 2026-05-28T17:41:16+00:00

There are 2 areas ( java.awt.geom.Area ) area1 and area2 . I need to

  • 0

There are 2 areas (java.awt.geom.Area) area1 and area2. I need to verify if area2 is inside area1? (area1 contains area2).

I have tried:

areaDelta = (Area)area1.clone();
areaDelta.add(area2);
return areaDelta.equals(area1);

But it doesnt always work as it should (If the bounds of area2 are on the bounds of area1, it returns true, should return false).

In fact I have 2 polygons (java.awt.Polygon) and I need the Polygon.contains(Polygon) method, may be this can be easier then for areas.

Any ideas?

Polygons can be convex and non-convex.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T17:41:17+00:00Added an answer on May 28, 2026 at 5:41 pm

    Since you have Polygon.contains(Point), you can achieve what you need by testing if every point of your second polygon is inside the first polygon (I dream of a JDK version which would implement every basic need of a programmer, like .NET).

    EDIT: To handle concave polygons, you first need to split your polygons into convex ones, then you’ll be able to properly use the method mentioned above. I used two different polygon decomposition algorithms in one of my applications, and I would suggest you to look at their code:

    • Bayazit Decomposer
    • Ewjordan Decomposer
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to block a critical area like with Java synchronized in
Till now, I have developed simple swing applications so there was no need to
Link: http://hedenstedfotoklub.net.dynamicweb.dk/ In the upper grey area there is a little icon which triggers
There are two img elements that use the same map with one area. Now,
Is there a way to limit mouse pointer movement to a specific area in
There's an XML stream which I need to parse. Since I only need to
I found out there is a open source mining software in Java, which is
I have have a small prototype game in java where players can build their
I have a single .png image with several icons on it (with transparent areas)
this is the code: import java.awt.*; import java.awt.event.*; import java.applet.*; import java.util.Vector; public class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.