# commons-issues mailing list archives

##### Site index · List index
Message view
Top
From "Matt Juntunen (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (MATH-1450) PolygonsSet sets incorrect value for last vertex in open loops
Date Sun, 11 Feb 2018 04:58:00 GMT
```
[ https://issues.apache.org/jira/browse/MATH-1450?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Matt Juntunen updated MATH-1450:
--------------------------------
Description:
According to the documentation, for open infinite vertex loops returned by the PolygonsSet.getVertices()
method, the last two points can be used to determine the direction of the last edge in the
loop. However, the current code returns a point from the second-to-last edge. For example,
the code below builds a box open on the top. It currently returns the vertex loop [null, \\{0;
1}, \\{0; 0}, \\{1; 0}, \\{1; 0}], where the last two vertices are the same point and cannot
be used to determine the direction of the last edge. The returned vertex loop should be [null,
\\{0; 1}, \\{0; 0}, \\{1; 0}, \\{1; 1}].
{code:java}
Cartesian2D v0 = new Cartesian2D(0, 1);
Cartesian2D v1 = new Cartesian2D(0, 0);
Cartesian2D v2 = new Cartesian2D(1, 0);
Cartesian2D v3 = new Cartesian2D(1, 1);

Line left = new Line(v0, v1, 1e-10);
Line bottom = new Line(v1, v2, 1e-10);
Line right = new Line(v2, v3, 1e-10);

List<SubHyperplane<Euclidean2D>> boundaries = new ArrayList<>();
left.toSubSpace(v1).getX(), 1e-10)));
bottom.toSubSpace(v2).getX(), 1e-10)));
right.toSubSpace(v3).getX(), 1e-10)));

PolygonsSet polygon = new PolygonsSet(boundaries, 1e-10);

polygon.getVertices(); // returns [[null, {0; 1}, {0; 0}, {1; 0}, {1; 0}]]{code}

Pull Request: [https://github.com/apache/commons-math/pull/81]

was:
According to the documentation, for open infinite vertex loops returned by the PolygonsSet.getVertices()
method, the last two points can be used to determine the direction of the last edge in the
loop. However, the current code returns a point from the second-to-last edge. For example,
the code below builds a box open on the top. It currently returns the vertex loop [null, \{0;
1}, \{0; 0}, \{1; 0}, \{1; 0}], where the last two vertices are the same point and cannot
be used to determine the direction of the last edge. The returned vertex loop should be [null,
\{0; 1}, \{0; 0}, \{1; 0}, \{1; 1}].
{code:java}
Cartesian2D v0 = new Cartesian2D(0, 1);
Cartesian2D v1 = new Cartesian2D(0, 0);
Cartesian2D v2 = new Cartesian2D(1, 0);
Cartesian2D v3 = new Cartesian2D(1, 1);

Line left = new Line(v0, v1, 1e-10);
Line bottom = new Line(v1, v2, 1e-10);
Line right = new Line(v2, v3, 1e-10);

List<SubHyperplane<Euclidean2D>> boundaries = new ArrayList<>();
left.toSubSpace(v1).getX(), 1e-10)));
bottom.toSubSpace(v2).getX(), 1e-10)));
right.toSubSpace(v3).getX(), 1e-10)));

PolygonsSet polygon = new PolygonsSet(boundaries, 1e-10);

polygon.getVertices(); // returns [[null, {0; 1}, {0; 0}

,

{1; 0}, {1; 0}

]]{code}

Pull Request: [https://github.com/apache/commons-math/pull/81]

> PolygonsSet sets incorrect value for last vertex in open loops
> --------------------------------------------------------------
>
>                 Key: MATH-1450
>                 URL: https://issues.apache.org/jira/browse/MATH-1450
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 4.0, 3.5, 3.6
>            Reporter: Matt Juntunen
>            Priority: Major
>             Fix For: 4.0
>
>
> According to the documentation, for open infinite vertex loops returned by the PolygonsSet.getVertices()
method, the last two points can be used to determine the direction of the last edge in the
loop. However, the current code returns a point from the second-to-last edge. For example,
the code below builds a box open on the top. It currently returns the vertex loop [null, \\{0;
1}, \\{0; 0}, \\{1; 0}, \\{1; 0}], where the last two vertices are the same point and cannot
be used to determine the direction of the last edge. The returned vertex loop should be [null,
\\{0; 1}, \\{0; 0}, \\{1; 0}, \\{1; 1}].
> {code:java}
> Cartesian2D v0 = new Cartesian2D(0, 1);
>         Cartesian2D v1 = new Cartesian2D(0, 0);
>         Cartesian2D v2 = new Cartesian2D(1, 0);
>         Cartesian2D v3 = new Cartesian2D(1, 1);
>         Line left = new Line(v0, v1, 1e-10);
>         Line bottom = new Line(v1, v2, 1e-10);
>         Line right = new Line(v2, v3, 1e-10);
>         List<SubHyperplane<Euclidean2D>> boundaries = new ArrayList<>();
left.toSubSpace(v1).getX(), 1e-10)));
bottom.toSubSpace(v2).getX(), 1e-10)));
right.toSubSpace(v3).getX(), 1e-10)));
>         PolygonsSet polygon = new PolygonsSet(boundaries, 1e-10);
>         polygon.getVertices(); // returns [[null, {0; 1}, {0; 0}, {1; 0}, {1;
0}]]{code}
>
>
> Pull Request: [https://github.com/apache/commons-math/pull/81]

--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

```
Mime
View raw message