Rectangle2D p2D = new Rectangle2D(new Point2D(0.0, 0.0), new Point2D(width, height));
AffineTransform2D t = AffineTransform2D.createTranslation(-refX, -refY);
CirculinearDomain2D rect = p2D.transform(t);
Then I get the vertices, one with a boundary and one without.
Collection<Point2D> in = rect.boundary().vertices();
Collection<Point2D> out = rect.buffer(-2.5d).boundary().vertices();
As you can see my Point2D items are rotated. I expected on index 0 of OUT the value's
Point2D(2.5, 2.5000000000000284)
But I find them as : Point2D(97.5, 2.5000000000000355)
What I am trying to accomplish is simple the inset of a shape, but I would like to have them in the same orientation. Is there a better way of doing the above?
Ries
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Actually there is no direct ensured correspondence between vertices of original shape and vertices of the buffer. For some shapes, the number of vertices may also be different.
If you are interested in the inner inset, maybe a more convenient way could be to consider another rectangle, with same center and size computed from original rectangle ?
David
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hey All,
I have CirculinearDomain2D created as follows:
Rectangle2D p2D = new Rectangle2D(new Point2D(0.0, 0.0), new Point2D(width, height));
AffineTransform2D t = AffineTransform2D.createTranslation(-refX, -refY);
CirculinearDomain2D rect = p2D.transform(t);
Then I get the vertices, one with a boundary and one without.
Collection<Point2D> in = rect.boundary().vertices();
Collection<Point2D> out = rect.buffer(-2.5d).boundary().vertices();
IN:
[0] = {math.geom2d.Point2D@10816}"Point2D(0.0, 0.0)"
[1] = {math.geom2d.Point2D@10821}"Point2D(100.0, 0.0)"
[2] = {math.geom2d.Point2D@10822}"Point2D(100.0, 100.0)"
[3] = {math.geom2d.Point2D@10823}"Point2D(0.0, 100.0)"
OUT:
[0] = {math.geom2d.Point2D@10833}"Point2D(97.5, 2.5000000000000355)"
[1] = {math.geom2d.Point2D@10839}"Point2D(97.5, 97.49999999999997)"
[2] = {math.geom2d.Point2D@10840}"Point2D(2.5000000000000284, 97.5)"
[3] = {math.geom2d.Point2D@10841}"Point2D(2.5, 2.5000000000000284)"
As you can see my Point2D items are rotated. I expected on index 0 of OUT the value's
Point2D(2.5, 2.5000000000000284)
But I find them as : Point2D(97.5, 2.5000000000000355)
What I am trying to accomplish is simple the inset of a shape, but I would like to have them in the same orientation. Is there a better way of doing the above?
Ries
Hi Ries,
Actually there is no direct ensured correspondence between vertices of original shape and vertices of the buffer. For some shapes, the number of vertices may also be different.
If you are interested in the inner inset, maybe a more convenient way could be to consider another rectangle, with same center and size computed from original rectangle ?
David