commons-issues mailing list archives

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


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 

Assert.assertTrue(Double.POSITIVE_INFINITY == poly.getSize());
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:
>             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:

This message was sent by Atlassian JIRA

View raw message