2006-02-24 04:48:15 +00:00
|
|
|
// Emacs style mode select -*- C++ -*-
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// $Id:$
|
|
|
|
//
|
|
|
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
|
|
//
|
|
|
|
// This source is available for distribution and/or modification
|
|
|
|
// only under the terms of the DOOM Source Code License as
|
|
|
|
// published by id Software. All rights reserved.
|
|
|
|
//
|
|
|
|
// The source is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
// DESCRIPTION:
|
|
|
|
// Nil.
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#ifndef __M_BBOX_H__
|
|
|
|
#define __M_BBOX_H__
|
|
|
|
|
|
|
|
#include "doomtype.h"
|
|
|
|
|
2008-04-06 17:33:43 +00:00
|
|
|
struct line_t;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
class FBoundingBox
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
public:
|
2008-04-06 17:33:43 +00:00
|
|
|
FBoundingBox()
|
|
|
|
{
|
|
|
|
ClearBox();
|
|
|
|
}
|
|
|
|
|
|
|
|
FBoundingBox(fixed_t left, fixed_t bottom, fixed_t right, fixed_t top)
|
|
|
|
{
|
|
|
|
m_Box[BOXTOP] = top;
|
|
|
|
m_Box[BOXLEFT] = left;
|
|
|
|
m_Box[BOXRIGHT] = right;
|
|
|
|
m_Box[BOXBOTTOM] = bottom;
|
|
|
|
}
|
|
|
|
|
|
|
|
FBoundingBox(fixed_t x, fixed_t y, fixed_t radius)
|
|
|
|
{
|
|
|
|
m_Box[BOXTOP] = y + radius;
|
|
|
|
m_Box[BOXLEFT] = x - radius;
|
|
|
|
m_Box[BOXRIGHT] = x + radius;
|
|
|
|
m_Box[BOXBOTTOM] = y - radius;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ClearBox ()
|
|
|
|
{
|
|
|
|
m_Box[BOXTOP] = m_Box[BOXRIGHT] = FIXED_MIN;
|
|
|
|
m_Box[BOXBOTTOM] = m_Box[BOXLEFT] = FIXED_MAX;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
void AddToBox (fixed_t x, fixed_t y);
|
|
|
|
|
2008-04-06 17:33:43 +00:00
|
|
|
inline fixed_t Top () const { return m_Box[BOXTOP]; }
|
|
|
|
inline fixed_t Bottom () const { return m_Box[BOXBOTTOM]; }
|
|
|
|
inline fixed_t Left () const { return m_Box[BOXLEFT]; }
|
|
|
|
inline fixed_t Right () const { return m_Box[BOXRIGHT]; }
|
|
|
|
|
|
|
|
int BoxOnLineSide (const line_t *ld) const;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
fixed_t m_Box[4];
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif //__M_BBOX_H__
|