You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gilles (JIRA)" <ji...@apache.org> on 2018/02/04 23:52:00 UTC

[jira] [Commented] (MATH-1449) PolygonsSet.getBarycenter() returns incorrect value for empty region

    [ https://issues.apache.org/jira/browse/MATH-1449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16351927#comment-16351927 ] 

Gilles commented on MATH-1449:
------------------------------

In the check
{code:java}
Assert.assertEquals(Double.POSITIVE_INFINITY, poly.getSize(), 1e-10);
{code}
using a tolerance looks a bit strange.  Shouldn't it rather be
{code:java}
Assert.assertTrue(Double.isInfinite(poly.getSize()));
{code}
?

Also, statements such as
{code:java}
Assert.assertEquals(false, poly.isEmpty());
Assert.assertEquals(true, poly.isFull());
{code}
would read better as
{code:java}
Assert.assertFalse(poly.isEmpty());
Assert.assertTrue(poly.isFull());
{code}

> PolygonsSet.getBarycenter() returns incorrect value for empty region
> --------------------------------------------------------------------
>
>                 Key: MATH-1449
>                 URL: https://issues.apache.org/jira/browse/MATH-1449
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 4.0, 3.6
>            Reporter: Matt Juntunen
>            Priority: Major
>             Fix For: 4.0
>
>
> The o.a.c.m.geometry.euclidean.twod.PolygonsSet.getBarycenter() method returns the point (0, 0) when the region is empty. It should return (NaN, NaN) since the barycenter does not exist. This is the behavior of IntervalsSet and PolyhedronsSet.
>  
> Pull request: https://github.com/apache/commons-math/pull/80



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