Round Perl coordinates instead of truncating them to integers. #1486 #1445 #1464

This commit is contained in:
Alessandro 2013-11-11 13:00:50 +01:00
parent 4250ebf644
commit e024b08762
3 changed files with 21 additions and 19 deletions

View file

@ -112,8 +112,10 @@ void
Point::from_SV(SV* point_sv)
{
AV* point_av = (AV*)SvRV(point_sv);
this->x = (long)SvIV(*av_fetch(point_av, 0, 0));
this->y = (long)SvIV(*av_fetch(point_av, 1, 0));
// get a double from Perl and round it, otherwise
// it would get truncated
this->x = lrint(SvNV(*av_fetch(point_av, 0, 0)));
this->y = lrint(SvNV(*av_fetch(point_av, 1, 0)));
}
void