- Turn DVector2 rotatepoint() into an inline using the vector's methods.

This commit is contained in:
Mitchell Richters 2022-09-05 22:10:23 +10:00 committed by Christoph Oelckers
parent 18f97c3d7e
commit db5db7d9b3
2 changed files with 5 additions and 17 deletions

View file

@ -510,22 +510,6 @@ void dragpoint(walltype* startwall, const DVector2& pos)
//
//==========================================================================
DVector2 rotatepoint(const DVector2& pivot, const DVector2& point, DAngle angle)
{
auto cosang = angle.Cos();
auto sinang = angle.Sin();
auto p = point - pivot;
return {
p.X * cosang - p.Y * sinang + pivot.X,
p.Y * cosang + p.X * sinang + pivot.Y };
}
//==========================================================================
//
//
//
//==========================================================================
int inside(double x, double y, const sectortype* sect)
{
if (sect)

View file

@ -282,7 +282,6 @@ void checkRotatedWalls();
bool sectorsConnected(int sect1, int sect2);
void dragpoint(walltype* wal, int newx, int newy);
void dragpoint(walltype* wal, const DVector2& pos);
DVector2 rotatepoint(const DVector2& pivot, const DVector2& point, DAngle angle);
int32_t inside(double x, double y, const sectortype* sect);
void getcorrectzsofslope(int sectnum, int dax, int day, int* ceilz, int* florz);
int getceilzofslopeptr(const sectortype* sec, int dax, int day);
@ -328,6 +327,11 @@ inline double getflorzofslopeptrf(const sectortype* sec, const DVector2& pos)
return getflorzofslopeptr(sec, pos.X * worldtoint, pos.Y * worldtoint) * zinttoworld;
}
inline DVector2 rotatepoint(const DVector2& pivot, const DVector2& point, DAngle angle)
{
return (point - pivot).Rotated(angle) + pivot;
}
enum EFindNextSector
{