Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #30480 > unrolled thread

Java Boolean Operations on Polygons

Started bynataraja gadikota <nataraja.3.833@gmail.com>
First post2014-12-03 22:47 -0800
Last post2014-12-05 08:34 -0500
Articles 6 — 3 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Java Boolean Operations on Polygons nataraja gadikota <nataraja.3.833@gmail.com> - 2014-12-03 22:47 -0800
    Re: Java Boolean Operations on Polygons nataraja gadikota <nataraja.3.833@gmail.com> - 2014-12-03 22:50 -0800
    Re: Java Boolean Operations on Polygons Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-12-04 08:16 -0500
      Re: Java Boolean Operations on Polygons nataraja gadikota <nataraja.3.833@gmail.com> - 2014-12-04 20:50 -0800
        Re: Java Boolean Operations on Polygons Jeff Higgins <jeff@invalid.invalid> - 2014-12-05 07:06 -0500
        Re: Java Boolean Operations on Polygons Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-12-05 08:34 -0500

#30480 — Java Boolean Operations on Polygons

Fromnataraja gadikota <nataraja.3.833@gmail.com>
Date2014-12-03 22:47 -0800
SubjectJava Boolean Operations on Polygons
Message-ID<b30bd2ec-f4fb-4205-84ac-c891701a92cf@googlegroups.com>
Hi , 
  Are there any open-source softwares available 
which handle Boolean Operations AND , OR , NOT , XOR on Polygons

http://en.wikipedia.org/wiki/Boolean_operations_on_polygons

I'm looking into Java port of GPC library , wanted to know if there are any other options .

Thanks
Nataraja G

[toc] | [next] | [standalone]


#30481

Fromnataraja gadikota <nataraja.3.833@gmail.com>
Date2014-12-03 22:50 -0800
Message-ID<d7bc2bfe-f9c4-4476-abdc-40385b6e7cdf@googlegroups.com>
In reply to#30480
I'll be working on rectilinear & hole free polygons ONLY ( INPUT & OUTPUT ) , 
I think this will simple the algorithm .. 

[toc] | [prev] | [next] | [standalone]


#30482

FromEric Sosman <esosman@comcast-dot-net.invalid>
Date2014-12-04 08:16 -0500
Message-ID<m5pmq7$en0$1@dont-email.me>
In reply to#30480
On 12/4/2014 1:47 AM, nataraja gadikota wrote:
> Hi ,
>    Are there any open-source softwares available
> which handle Boolean Operations AND , OR , NOT , XOR on Polygons
>
> http://en.wikipedia.org/wiki/Boolean_operations_on_polygons
>
> I'm looking into Java port of GPC library , wanted to know if there are any other options .

     Have you considered using java.awt.geom.Area?

-- 
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM

[toc] | [prev] | [next] | [standalone]


#30489

Fromnataraja gadikota <nataraja.3.833@gmail.com>
Date2014-12-04 20:50 -0800
Message-ID<a27b8ac6-d56b-4c40-b100-d932fcd076be@googlegroups.com>
In reply to#30482
I've found this example , but can I get the boundary points from "shape" Object  ?

    Shape arc = new Arc2D.Float(x, y, w/2, h/2, startAngle, arcAngle, Arc2D.OPEN);
    Area shape = new Area(line);
    shape.add(new Area(oval));
    shape.subtract(new Area(rectangle));
    shape.intersect(new Area(roundRectangle));
    shape.exclusiveOr(new Area(arc));
    g2d.draw(shape);

[toc] | [prev] | [next] | [standalone]


#30490

FromJeff Higgins <jeff@invalid.invalid>
Date2014-12-05 07:06 -0500
Message-ID<m5s753$foc$1@dont-email.me>
In reply to#30489
On 12/04/2014 11:50 PM, nataraja gadikota wrote:
> I've found this example , but can I get the boundary points from "shape" Object  ?
>
>      Shape arc = new Arc2D.Float(x, y, w/2, h/2, startAngle, arcAngle, Arc2D.OPEN);
>      Area shape = new Area(line);
>      shape.add(new Area(oval));
>      shape.subtract(new Area(rectangle));
>      shape.intersect(new Area(roundRectangle));
>      shape.exclusiveOr(new Area(arc));
>      g2d.draw(shape);
>
another example
<https://docs.oracle.com/javase/tutorial/2d/advanced/examples/Pear.java>
from the fine manual

[toc] | [prev] | [next] | [standalone]


#30491

FromEric Sosman <esosman@comcast-dot-net.invalid>
Date2014-12-05 08:34 -0500
Message-ID<m5sc96$35a$1@dont-email.me>
In reply to#30489
On 12/4/2014 11:50 PM, nataraja gadikota wrote:
> I've found this example , but can I get the boundary points from "shape" Object  ?
>
>      Shape arc = new Arc2D.Float(x, y, w/2, h/2, startAngle, arcAngle, Arc2D.OPEN);
>      Area shape = new Area(line);
>      shape.add(new Area(oval));
>      shape.subtract(new Area(rectangle));
>      shape.intersect(new Area(roundRectangle));
>      shape.exclusiveOr(new Area(arc));
>      g2d.draw(shape);

     No, because the Shape in your example has an infinite number
of boundary points (the Arc2D is not polygonal, and maybe some
of the other pieces aren't either).

     But if you begin with Shapes that are all polygons, their
intersections and unions and so on will also be polygons and
their outlines will consist only of straight line segments.
Use one of the getPathIterator() methods, then visit the path
segments in turn.  For each segment, you can verify that the
segment is in fact a line, and you can retrieve the endpoints.

-- 
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web