Removed the x(), y(), z() Point/Pointf/Point3/Pointf3 accessors.

This commit is contained in:
bubnikv 2018-08-17 15:53:43 +02:00
parent 1ba64da3fe
commit 65011f9382
60 changed files with 1083 additions and 1111 deletions

View file

@ -485,8 +485,8 @@ SV* to_SV_pureperl(const Point* THIS)
{
AV* av = newAV();
av_fill(av, 1);
av_store(av, 0, newSViv(THIS->x()));
av_store(av, 1, newSViv(THIS->y()));
av_store(av, 0, newSViv((*THIS)(0)));
av_store(av, 1, newSViv((*THIS)(1)));
return newRV_noinc((SV*)av);
}
@ -495,8 +495,7 @@ void from_SV(SV* point_sv, Point* point)
AV* point_av = (AV*)SvRV(point_sv);
// get a double from Perl and round it, otherwise
// it would get truncated
point->x() = lrint(SvNV(*av_fetch(point_av, 0, 0)));
point->y() = lrint(SvNV(*av_fetch(point_av, 1, 0)));
(*point) = Point(lrint(SvNV(*av_fetch(point_av, 0, 0))), lrint(SvNV(*av_fetch(point_av, 1, 0))));
}
void from_SV_check(SV* point_sv, Point* point)
@ -514,8 +513,8 @@ SV* to_SV_pureperl(const Pointf* point)
{
AV* av = newAV();
av_fill(av, 1);
av_store(av, 0, newSVnv(point->x()));
av_store(av, 1, newSVnv(point->y()));
av_store(av, 0, newSVnv((*point)(0)));
av_store(av, 1, newSVnv((*point)(1)));
return newRV_noinc((SV*)av);
}
@ -526,8 +525,7 @@ bool from_SV(SV* point_sv, Pointf* point)
SV* sv_y = *av_fetch(point_av, 1, 0);
if (!looks_like_number(sv_x) || !looks_like_number(sv_y)) return false;
point->x() = SvNV(sv_x);
point->y() = SvNV(sv_y);
*point = Pointf(SvNV(sv_x), SvNV(sv_y));
return true;
}