rectangles

find all rectangular areas with certain properties in a matrix

末鹿安然 提交于 2019-12-10 04:17:02
问题 given an n*m matrix with the possible values of 1, 2 and null: . . . . . 1 . . . 1 . . . . . 1 . . . 2 . . . . . . . . 2 . . . 1 . . . . . 1 . . . . . . . . . . . 1 . . 2 . . 2 . . . . . . 1 I am looking for all blocks B (containing all values between (x0,y0) and (x1,y1)) that: contain at least one '1' contain no '2' are not a subset of a another block with the above properties Example: The red, green and blue area all contain an '1', no '2', and are not part of a larger area. There are of

How to draw a rectangle with a colored border in gnuplot

筅森魡賤 提交于 2019-12-10 02:43:24
问题 I would like to draw an empty rectangle in my plot. So far I have: set style rect back fs empty border lt 3 set object 1 rect from 1,1 to 2,2 And I have my rectangle with a dashed line. How do I change the color of the line? lc does not seem to work after border. I also tried with setting a new line style, and border but I was not successful. Thank you! 回答1: Using lc instead of lt in the code you posted works fine with version 4.6.5: reset set style rect back fs empty border lc rgb '#008800'

Tile (scalable) stacking algorithm

放肆的年华 提交于 2019-12-09 17:09:46
问题 Here is the problem. I have rectangular canvas that have size of 1. So it have coordinate sistem of (0.0 ... 1.0 - x and 0.0 ... 1.0 - y). I also have some tiles. Tiles are also rectangles. They have diffrent size and amount of tiles is a variable. I want to stack tiles in rectangular canvas, from 0.0 to 1.0 ( from left to right, from top to bottom ): 1) tiles have to fit in canvas (but fill as much space as they could) 2) tiles have to be scaled (if they don't fit), each tile should be

Displaying rectangles in game window with XNA

跟風遠走 提交于 2019-12-09 12:46:22
问题 I want to divide my game grid into an array of rectangles. Each rectangle is 40x40 and there are 14 rectangles in every column, with a total of 25 columns. This covers a game area of 560x1000. This is the code I have set up to make the first column of rectangles on the game grid: Rectangle[] gameTiles = new Rectangle[15]; for (int i = 0; i <= 15; i++) { gameTiles[i] = new Rectangle(0, i * 40, 40, 40); } I'm pretty sure this works, but of course I cannot confirm it because rectangles do not

How can I add text to a Checkbox I create using iTextSharp?

一曲冷凌霜 提交于 2019-12-08 12:38:45
问题 Derived from Jeff S's methodology found here, I can add a "Checkbox" to a PDF page like so: PdfPTable tblFirstRow = new PdfPTable(5); tblFirstRow.SpacingBefore = 4f; tblFirstRow.HorizontalAlignment = Element.ALIGN_LEFT; . . . // code where textboxes are added has been elided for brevity PdfPCell cell204Submitted = new PdfPCell() { CellEvent = new DynamicCheckbox("checkbox204Submitted", "204 Submitted or on file") }; tblFirstRow.AddCell(cell204Submitted); doc.Add(tblFirstRow); The

Efficiency of drawing rectangles on image matrix in R

房东的猫 提交于 2019-12-08 09:31:56
问题 I have the function drawRect which will draw a rectangle on a n x m x 3 matrix (one layer for each color channel). It takes in 2 main parameters: the rectangle params c(xleft, xright, ytop, ybottom) and the image matrix im drawRect <- function(rect, im, color=2){ int = 255 im[rect[3]:rect[4],rect[1],color] = int im[rect[3]:rect[4],rect[2],color] = int im[rect[3],rect[1]:rect[2],color] = int im[rect[4],rect[1]:rect[2],color] = int return(im) } The function works as its supposed to. However, I

Add rectangle into pdfpcell itextsharp

流过昼夜 提交于 2019-12-08 02:02:40
问题 How can I add a rectangle with certain width, height and background color into a PdfPCell using itextsharp? Something like this: PdfPCell cell = new PdfPCell(); Rectangle rectangle = new Rectangle(); rectangle.Width = 50f; rectangle.BackgroundColor = BaseColor.RED; cell.AddElement(cell); 回答1: The simple answer is: draw the Rectangle as a Form XObject ( PdfTemplate ), wrap it inside an Image object, and add that image to the table. However: there are several ways to do this, and there may be

On overlap, player gets stuck libgdx Rectangle

岁酱吖の 提交于 2019-12-07 23:16:03
问题 So I'm working on a collision detection code and what i do is when the user rectangle overlaps the rectangle where they cant move, I stop them from moving. So if im moving right and I hit a wall i cant move forward. This works. However if after i hit that wall, I want to move down or up form that point, I get stuck. This is how i check if the user has colidded private void checkCollision() { for (int x = 0; x < amount; x++) { if (collsionRect[x].overlaps(user)) { Gdx.app.log(ChromeGame.LOG,

Determining which screen a window is on (by checking where the most surfacearea is located)

情到浓时终转凉″ 提交于 2019-12-07 13:40:14
问题 I'm currently determining which screen a window is on, by checking on which screen it's very left-top position is. Now I'd like to change that so that I can find out on which scren the most surface area of the window is to be found. Any ideas how that can be accomplished? Here is my old code: (it simply moves the active window between all available screens when pressing F1) F1:: WinGetPos, X, Y,,, A window := {x:X,y:Y} monitors := GetMonitors() Loop % monitors.MaxIndex() { curMonitor :=

OpenCV draw rectangle from webcam with 2 largest objects

喜你入骨 提交于 2019-12-06 13:02:30
问题 I need to draw rectangle with 2 largest object from webcam. I already got to draw contours with 2 largest object from webcam but now i confuse in how to draw 2 largest Rectangle. Someone can show me the code Please~ //find and draw contours void showconvex(Mat &thresh,Mat &frame) { int largestIndex = 0; int largestContour = 0; int secondLargestIndex = 0; int secondLargestContour = 0; vector<vector<Point> > contours; vector<Vec4i> hierarchy; //find contours findContours(thresh, contours,