Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #30491
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Java Boolean Operations on Polygons |
| Date | 2014-12-05 08:34 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <m5sc96$35a$1@dont-email.me> (permalink) |
| References | <b30bd2ec-f4fb-4205-84ac-c891701a92cf@googlegroups.com> <m5pmq7$en0$1@dont-email.me> <a27b8ac6-d56b-4c40-b100-d932fcd076be@googlegroups.com> |
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
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread
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
csiph-web