void MainWindow::paintEvent(QPaintEvent *event) { QPainter painter(this); QPoint upper_left(100, 200), low_right(1100, 700); QRect rect(upper_left, low_right); QBrush brush("#349D84"); painter.setBrush(brush); brush.setColor("#349D84"); painter.drawRect(rect); QPen pen; pen.setColor("#307867"); pen.setWidth(3); painter.setPen(pen); int x = (low_right.x() + upper_left.x()) / 2.0; int y = (low_right.y() + upper_left.y()) / 2.0; painter.drawLine(upper_left.x(), y, low_right.x(), y); painter.drawLine(x, upper_left.y(), x, low_right.y()); painter.setBrush(Qt::NoBrush); painter.drawRect(rect); painter.setPen(Qt::yellow); QPointF points[2000]; for (size_t i(0); i != 2000; ++i) points[i] = QPointF(upper_left.x() + i * 0.5, gain * this->points[i + offset] + y); painter.drawPolyline(points, 2000); }
void screen_controller::drawbox(int hor, int ver, int ul, int ur, int ll, int lr) { draw_vertical(0, 0, maxrow()-1, ver); draw_vertical(0, maxcol(), maxrow()-1, ver); draw_horizontal(0, 0, maxcol()-1, hor); draw_horizontal(maxrow(), 0, maxcol()-1, hor); upper_left(); printf("%d", ul, 0); lower_left(); printf("%d", ll, 0); upper_right(); printf("%d", ur, 0); lower_right(); printf("%d", lr, 0); }
inline bool Intersects(const RectangleInt2D &other) const { FixedPointCoordinate upper_left(other.max_lat, other.min_lon); FixedPointCoordinate upper_right(other.max_lat, other.max_lon); FixedPointCoordinate lower_right(other.min_lat, other.max_lon); FixedPointCoordinate lower_left(other.min_lat, other.min_lon); return (Contains(upper_left) || Contains(upper_right) || Contains(lower_right) || Contains(lower_left)); }
// | V0 Z^T*V0 0 | // | V0*Z Z^T*V0*Z 0 | // | 0 0 0 | Spd ASSR::initial_state_variance()const { Spd V0 = StateSpaceModelBase::initial_state_variance(); SparseVector Z0(StateSpaceModelBase::observation_matrix(0)); Vec covariance = V0 * Z0; double y_variance = Z0.dot(covariance) + regression_->sigsq(); int state_dim = state_dimension(); Spd ans(state_dim, 0.0); SubMatrix upper_left(ans, 0, state_dim - 3, 0, state_dim - 3); upper_left = V0; ans.col(state_dim - 2); VectorView covariance_column(ans.col(state_dim - 2), 0, state_dim - 2 ); VectorView covariance_row(ans.row(state_dim - 2), 0, state_dim - 2 ); covariance_column = covariance; covariance_row = covariance; ans(state_dim - 2, state_dim -2) = y_variance; return ans; }
int32_xy tAoi::upperleft() const { return upper_left(); }