public List <Vector3> GetPointsInGivenRadius(Vector3 pos, float rad) { this.m_PointsInRadius.Clear(); Vector3 pos2 = pos; pos2.x -= rad; pos2.z -= rad; SimpleGridCell cellAtPos = this.GetCellAtPos(pos2); Vector3 pos3 = pos; pos3.x += rad; pos3.z += rad; SimpleGridCell cellAtPos2 = this.GetCellAtPos(pos3); for (int i = cellAtPos.m_X; i <= cellAtPos2.m_X; i++) { for (int j = cellAtPos.m_Y; j <= cellAtPos2.m_Y; j++) { SimpleGridCell simpleGridCell = this.m_Cells[i, j]; for (int k = 0; k < simpleGridCell.m_Points.Count; k++) { Vector3 vector = simpleGridCell.m_Points[k]; if ((vector - pos).magnitude < rad) { this.m_PointsInRadius.Add(vector); } } } } return(this.m_PointsInRadius); }
public bool IsPointInPos(Vector3 pos) { SimpleGridCell cellAtPos = this.GetCellAtPos(pos); for (int i = 0; i < cellAtPos.m_Points.Count; i++) { if (cellAtPos.m_Points[i] == pos) { return(true); } } return(false); }
public void InsertPoint(Vector3 point, bool use_bounds = false) { SimpleGridCell cellAtPos = this.GetCellAtPos(point); cellAtPos.m_Points.Add(point); }