commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Juntunen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MATH-1449) PolygonsSet.getBarycenter() returns incorrect value for empty region
Date Mon, 05 Feb 2018 01:44:00 GMT

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

Matt Juntunen commented on MATH-1449:
-------------------------------------

Yes, I suppose it does look kind of strange with the tolerance. I didn't use Double.isInfinite()
because I wanted to distinguish between positive and negative infinity. The tolerance value
is just there to keep Assert happy. I could rewrite it as 

 
{code:java}
Assert.assertTrue(Double.POSITIVE_INFINITY == poly.getSize());
{code}
to make it clearer if needed.

Also, I disagree that the boolean statements read better with the assertTrue/False methods
in this case. When asserting a method return value, I prefer to have the expected return value
listed explicitly rather than encoded in the name of the assertion method. I think it stands
out better that way. But, this is just a preference thing and really makes no difference otherwise.

Let me know if you'd like me to make either of these changes. Note that I'm pretty sure I
used both of the syntaxes you mentioned above all over my last batch of unit test changes,
so, if I do change these, I should probably update the other tests as well to match.

> 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)

Mime
View raw message