rectangles

Draw Rectangle over PictureBox

爷,独闯天下 提交于 2019-12-24 07:27:21
问题 The next code lets you draw Rectangles in the Form with mouse clics. Why not, or how can be draw over a PictureBox? Public Class Form1 Dim SelectRect As Rectangle = New Rectangle() Dim ps As Point = New Point() Dim pe As Point = New Point() This catch the first click, starting point or corner of the rectangle Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown SelectRect.Width = 0 SelectRect.Height = 0 SelectRect.X = e.X

How can I enclose some XML elements in a bounding box?

谁说我不能喝 提交于 2019-12-24 05:01:28
问题 I want to enclose the pair of checkboxes and the radio buttons here: ...in a rectangle or "bounding box" so that it look something like this: ...but less ugly, of course. How can I do that with the following XML as a starting point: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:paddingLeft="@dimen/activity

How can I enclose some XML elements in a bounding box?

丶灬走出姿态 提交于 2019-12-24 05:01:09
问题 I want to enclose the pair of checkboxes and the radio buttons here: ...in a rectangle or "bounding box" so that it look something like this: ...but less ugly, of course. How can I do that with the following XML as a starting point: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:paddingLeft="@dimen/activity

Blinking rectangle white pygame with specific frequency

眉间皱痕 提交于 2019-12-23 04:45:34
问题 I'm student at university and I have a specific question. Presently I display a white rectangle in center of a window with pygame above a black background. But presently I would like to blinking my white rectangle at a specific frequency, and it's why a I need help. Presently I implement that: import pygame, sys from pygame.locals import * def main(): pygame.init() fenetre = pygame.display.set_mode((500,400),0,32) black=(0,0,0) white=(255,255,255) fenetre.fill(black) pygame.draw.rect(fenetre,

count the number of adjacent rectangles

喜夏-厌秋 提交于 2019-12-23 02:56:19
问题 My code prints a sets of (X,Y) coordinates in 2D space in the range [0,1]. void Rect_Print() { cout << "In counter-clockwise fashion" << endl; cout << "#Rectangle ( x0, y0) ( x1, y1) " << endl; for (int b=0; b<Rect_Count; b++) { double Area = (Rect[b].x0 - Rect[b].x1) * (Rect[b].y0 - Rect[b].y1); cout << fixed << setprecision(4) << (b+1) << " (" << Rect[b].x0 << "," << Rect[b].y0 << ") (" << Rect[b].x1 << "," << Rect[b].y1 << ")" << endl; } cout << "Number of divisions (N = 3j-2) = " << Rect

Optimum set of dirty rectangles

寵の児 提交于 2019-12-22 03:49:30
问题 I'm looking for an algorithm here, independent of specific programming language. The problem: We have a 2-dimensional display area (think simple buffer of pixels). Periodically, some of the pixels are changed. We need to find a set of rectangles that encapsulate all changed pixels. It would be trivial, but undesirable, to compute a single, potentially large, rectangle that encapsulates all changed pixels. We would rather have multiple, smaller, tight-fitting rectangles down to a specified

Get bounds of unrotated rotated rectangle

血红的双手。 提交于 2019-12-21 08:01:24
问题 I have a rectangle that has a rotation already applied to it. I want to get the the unrotated dimensions (the x, y, width, height). Here is the dimensions of the element currently: Bounds at a 90 rotation: { height 30 width 0 x 25 y 10 } Here are the dimensions after the rotation is set to none: Bounds at rotation 0 { height 0 width 30 x 10 y 25 } In the past, I was able to set the rotation to 0 and then read the updated bounds . However, there is a bug in one of the functions I was using, so

What's a good, simple, 2D rectangles-only collision detection algorithm?

允我心安 提交于 2019-12-21 03:34:25
问题 I'm designing a collision detection game tutorial for young adults, so I want this to be as simple as possible to make it easier to explain. The requirements are very simple. The world is 2D and contains only rectangles (of arbitrary sizes). BSP and even quadtrees seems like it would be overkill (again, the emphasis is on simplicity) but I would like something more efficient than brute forcing through all n(n-1)/2 possible collisions. 2D, rectangles only, and simple. Can anyone point to an

How to compute the union polygon of two (or more) rectangles

时光毁灭记忆、已成空白 提交于 2019-12-21 02:20:24
问题 For example we have two rectangles and they overlap. I want to get the exact range of the union of them. What is a good way to compute this? These are the two overlapping rectangles. Suppose the cords of vertices are all known: How can I compute the cords of the vertices of their union polygon? And what if I have more than two rectangles? 回答1: There exists a Line Sweep Algorithm to calculate area of union of n rectangles. Refer the link for details of the algorithm. As said in article, there

Drawing box around message

梦想与她 提交于 2019-12-20 08:06:32
问题 I'm working on this Python task that I can't figure out. It is the last of 3 functions and the first 2 were much easier to program then this one. The instructions are "Given a message that may contain multiple lines, utilize the split() function to identify the individual lines, and the format() function so that when printed, it draws a box around the message's lines, all centered. Box uses vertical bars & dashes on the sides (|, -), +'s in the corners (+), and there is always a column of