Questions tagged [rectangles]

A rectangle is a geometric shape: any quadrilateral with four right angles

1277 questions
10
votes
4 answers

Get bounds of unrotated rotated rectangle

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 …
1.21 gigawatts
  • 12,773
  • 23
  • 85
  • 187
10
votes
4 answers

Graphics.DrawRectangle(Pen, RectangleF)

http://msdn.microsoft.com/en-us/library/system.drawing.graphics.drawrectangle.aspx FillRectangle, DrawRectangle, FillElipse and DrawEllipse all can take 4 Float (or "Single") parameters: x, y, width, height. DrawRectangle is the only one that will…
Mike
  • 2,120
  • 1
  • 16
  • 31
10
votes
2 answers

SVG Rectangle display HTML title on mouseover

I try to display a tooltip on mouse hover a rectangle. My attempt were using and set a title to it and set a title to the itself but does not produce any visible output (on Chrome). HTML
Anwar
  • 3,572
  • 2
  • 31
  • 58
10
votes
2 answers

Constrain Rectangle within Rectangle

I am using Java's Rectangle class in a program. I have two Rectangle objects: Rectangle big = new Rectangle(...); Rectangle small = new Rectangle(...); The specific sizes of the rectangles are not important. However, big will always be larger than…
baum
  • 829
  • 9
  • 22
10
votes
5 answers

How to divide an area composed of small squares into bigger rectangles?

Where would i go to look for algorithms that take a 2d grid of values that are either 0 or 1 as input and then identifies all possible non-overlapping rectangles in it? In a more practical explanation: I am drawing a grid that is represented by a…
Mithaldu
  • 2,342
  • 19
  • 39
10
votes
1 answer

Rectangle detection in image

I'd like to program a detection of a rectangular sheet of paper which doesn't absolutely need to be perfectly straight on each side as I may take a picture of it "in the air" which means the single sides of the paper might get distorted a bit. The…
tim
  • 8,782
  • 15
  • 70
  • 127
10
votes
4 answers

Fill the outside of a rectangle

I would like to draw a rectangle in WPF (by code) and to fill the outside of it. Here is an example : The outside of the rectangle is grey (with low opacity), and the fill of the rectangle is trasparent.
Ben
  • 3,612
  • 5
  • 38
  • 75
10
votes
3 answers

How to check intersection between a line and a rectangle?

The title says it all, Ive been searching around and couldnt find anything that was straight and to the point. How would I take a line with points (x1,y1) & (x2, y2) and check its intersection between a rectangle (xR,yR)? I saw in the Line2D package…
Code Doggo
  • 1,700
  • 4
  • 25
  • 51
10
votes
5 answers

Drawing Rectangles in iOS

My goal for my app is for the user to be able to sort through different scheduling options by swiping to the left and right of an iPhone screen. How would I draw and remove rectangles as the user sorts through these different scheduling options? I…
Bryce Langlotz
  • 293
  • 1
  • 4
  • 17
9
votes
1 answer

Svg draw connection line between two rectangles

I am currently programming a diagram editor in javascript with SVG. I am stuck with a problem concerning connection between rectangles. I found a lot of resources to draw a connection between circles but nothing about rectangles. So now what I got…
Korbson
  • 353
  • 1
  • 3
  • 10
9
votes
1 answer

How to draw a rectangle with a colored border in gnuplot

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…
esperluette
  • 1,262
  • 2
  • 10
  • 18
9
votes
1 answer

Create transform to map from one rectangle to another?

What is the simplest way to create AffineTransform which maps coordinates from one rectangle to another (float/double rectangles are given)? UPDATE 1 Rectangles can be absolutely different. For example [(0,0)-(1,1)] and [(150,-14)-(-1000,-14.1)].…
Dims
  • 37,353
  • 77
  • 251
  • 478
9
votes
4 answers

How to draw the border of a square?

I'm using monogame (which uses the XNA API interface) to write my game. So far it is great, but I have hit a snag on something that should be simple. I need to draw a 2d square. But I only want the border (No fill). I have seen many examples that…
Vaccano
  • 70,257
  • 127
  • 405
  • 747
9
votes
1 answer

How to draw a rectangle in WPF at a specific x,y screen location?

In C#, WPF I've created a rectangle: Rectangle myRgbRectangle = new Rectangle(); myRgbRectangle.Width = 1; myRgbRectangle.Height = 1; SolidColorBrush mySolidColorBrush = new SolidColorBrush(); Yes, I really just want…
zetar
  • 1,185
  • 2
  • 15
  • 41
8
votes
5 answers

Tile (scalable) stacking algorithm

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 …
obenjiro
  • 3,445
  • 6
  • 42
  • 80
1 2
3
85 86