resolution,
booltilex =
true,
booltiley =
true);
172: m_PrevVisMin(0.0f, 0.0f)
173, m_PrevVisMax(0.0f, 0.0f)
176, m_Scale(1.0f, 1.0f)
177, m_ResolutionX(1.0f)
178, m_ResolutionY(1.0f)
179, m_ResolutionScaler(1.0f)
192 intidx = GetTableIdx(item);
194 if(idx < (
int)m_GridTable.size() && idx >= 0)
195 returnm_GridTable[idx];
203 intidx = GetTableIdx(item);
205 if(idx < (
int)m_GridTable.size() && idx >= 0)
213 floatresolution,
booltilex,
booltiley)
219 floatwh = ((max_pos.
X()-min_pos.
X()) + (max_pos.
Y()-min_pos.
Y()))*0.5f;
224 floatresxy = m_ResolutionScaler * ceilf(wh/resolution);
225m_ResolutionX = resxy;
226m_ResolutionY = resxy;
236 CVect2<int>min_idx(
int(floorf(min_pos[0] / m_ResolutionX)),
237 int(floorf(min_pos[1] / m_ResolutionY)));
238 CVect2<int>max_idx(
int(floorf(max_pos[0] / m_ResolutionX)),
239 int(floorf(max_pos[1] / m_ResolutionY)));
CGlModel2D Base class for a model set up for rendering purposes.
class CSpatialHash2D Class for simple 2D spatial organization that allows for some collision checking...
TVeci GetMaxVisIndex() const
const TVeci & GetMin()
Get min/max indices for current (whole) grid.
TVeci GetMinVisIndex() const
Get min/max visible indices for grid (as per UpdateVisibility)
CVect2< int > m_VisMinIdx
Range of visible indices from previous call to UpdateVisibility.
int m_Width
Width and heigt of table (m_MaxIdx-m_MinIdx)
CVect2< int > TVeci
Storage index in table.
TElemType & Get(const TVeci &item)
float m_ResolutionX
Divisor for dividing model-space resolution into table indices.
CVect2< float > m_PrevVisMax
CVect2< float > TVecf
floating point type for actual (real) positions of data
CVect2< float > m_PrevVisMin
Visible rectangle area from previous call to UpdateVisibility.
TElemType GetSafe(const TVeci &item) const
Return an empty TElemType if index is out of range.
const TElemType & Get(const TVeci &item) const
const TTableType & GetTable() const
virtual ~CSpatialHash2D()
vector< TElemType > TTableType
Storage table type.
CVect2< int > m_VisMaxIdx
TVecf m_MinPos
Geometric region subdivided by this data structure.
T TElemType
Element type stored in table (e.g. indices or pointers to user data)
bool InBounds(const TVeci &item) const
Return true if the index falls within the current table.
int GetWidth() const
Get width/height of grid.
TTableType m_GridTable
Hashtable that stores the data elements.
const CVect2< float > & GetScale() const
TVeci m_MinIdx
Min/Max indicies in the table.
TVecf & GetMinPos()
Get min/max model coords spanned by the grid.
void ResizeGrid(const CGlPane &pane, float resolution, bool tilex=true, bool tiley=true)
int GetTableIdx(const TVeci &item) const
CVect2< float > m_Scale
Current scaling factor of model for viewing in x and y.
virtual void UpdateVisibility(const TModelRect &)
TModelRect & GetModelLimitsRect(void)
TModelRect & GetVisibleRect(void)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Defines to provide correct exporting from DLLs in Windows.
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4