rectangle

Problem in generating the border of a rectangle in Java?

I am using java.awt.geom.Rectangle2D.Double class to generate a rectangle. I want to generate a rectangle which is filled with a color (say green) and have a border (outline). Now the problem is if I call g2.draw(new Rectangle2D.Double(....)); // g2 is an instance of Graphics2D then it doesn't fill the rectangle and when I call g2.f...

how to draw a rectangle in iron python. demos required

Hello everybody, can some one please show a demo of drawing a rectangle in iron python and appending it to form. p.s real problem is there is no such documentory in web about drawing in iron python.. and that sucks hard. Sincerely, Eugene. ...

Traverse Rectangular Matrix in Diagonal strips

I need the same thing done here, but to work with any matrix, not just a square one. Also, the direction of traversal needs to be opposite. I tried to edit the code I found there, but couldn't figure it out. Thanks. ...

on an iPhone web application: how do I disable the rectangle that appears around a DIV when a user touches and holds it?

I've tried setting -webkit-user-select: none and selectstart And it did remove the selector, but a rectangle still appears.. ...

How can i extract rectangles from a rectangle intersection.

Having a rectangle (A) and intersecting it with another rectangle (B), how could I extract the other rectangles created through that intersection (C,D,E & F)? AAAAAAAAAAAAAA CCCFFFFDDDDDDD AAABBBBAAAAAAA CCCBBBBDDDDDDD AAABBBBAAAAAAA -> CCCBBBBDDDDDDD AAAAAAAAAAAAAA CCCEEEEDDDDDDD AAAAAAAAAAAAAA CCCEEEEDDDDDDD And could th...

C# List<T>.Find(x=>x.Rectangle.Contains(Point)) FAIL

For the life of me I can't make sense why this code produces the following output... I think there is a bug or something when using List and lambda if the type exposes a Rectangle property and you use the Contains method of the rectangle object...and explicit iteration proves true while the List Find method fails.... Oneway Code publ...

How to reverse a RectangleF to a Picasa face hash.

Here are the details for what Picasa stores as a hash. It stores them like this: faces=rect64(54391dc9b6a76c2b),4cd643f64b715489 [DSC_2289.jpg] faces=rect64(1680000a5c26c82),76bc8d8d518750bc Info on the web says this: The number encased in rect64() is a 64-bit hexadecimal number. Break that up into four 16-bit numbers. Divide each ...

Easiest way to rotate a rectangle

I'm using rectangles defined in terms of their x y coordinates and their width and height. I figured out how to rotate them in terms of coordinates (x = cos(deg) * x - sin(deg) * y y = sin(deg) * x + cos(deg) * y) but I'm stuck on the height and width. I'm sure there's an obvious solution that I'm missing. If it matters, I'm using Python...

Are any of these quad-tree libraries any good?

It appears that a certain project of mine will require the use of quad-trees, something that I have never worked with before. From what I have read they should allow substantial performance enhancements than a brute-force attempt at the problem would yield. Are any of these python modules any good? Quadtree 0.1.2 <= No: unable to execu...

How to identify subtriangle within a rectangle given a coordinate in that rectangle

Given a rectangle of width w and height h. and a coordinate x,y in that rectangle I would like to identify which triangle I am within. i.e. the function should take parameters(x,y) and return a,b,c,d or a zero based number representing that triangle index i.e. (0=A,1=B,2=C,3=D) if they are in that order. I think this would be somethi...

How to set alpha value of drawRoundRect object

Ok I know this practically sounds elementary, but I don't understand what I'm not doing correct here. I draw a simple rounded Rect backing1.graphics.beginFill(bgColor); backing1.graphics.lineStyle(borderSize, borderColor1); backing1.graphics.drawRoundRect(position1, position1, sizeW-1, sizeH-1, cornerRadius1); backing1.graphics.endFill...

Rotate Bitmap (Rectangle) While Maintining Area

How can I rotate an Bitmap a given number of degrees while maintaining the area of the original bitmap. ie, what I rotate a bitmap of Width:100,Height:200, my end result will be a bigger image but the rotated portion will still have an area of 100*200 ...

Drawing a continuous rectangle

Hi..i m currently working on visual c++ 2008 express edition.. in my project i have a picturebox which contains an image, now i have to draw a rectangle to enaable the user to select a part of the image.. I have used the "MouseDown" event of the picturebox and the below code to draw a rectangle: Void pictureBox1_MouseDown(System::Objec...

Collision Detection - Java - Rectangle

I would like to know if this is a good idea that conforms to best practices that does not lead to obscenely confusing code or major performance hit(s): Make my own Collision detection class that extends Rectangle class. Then when instantiating that object doing something such as Collision col = new Rectangle(); <- Should I do that or i...

.NET Rectangle Off By 1

After working with the .NET GDI+ Rectangle object, I've noticed that if I create a rectangle that is X:0 * Y:0 * Width:100 * Height:100, the Right and Bottom properties are set to 100, 100. Shouldn't this be 99, 99? 0 - 99 is 100 pixels. 0 - 100 is 101 pixels. FWIW, the documentation does say the right is computed by x + width and th...

How do I translate a point from one rect to a point in a scaled rect?

I have an image (i) that's been scaled from its original size (rectLarge) to fit a smaller rectangle (rectSmall). Given a point p in rectSmall, how can I translate this to a point in rectLarge. To make this concrete, suppose I have a 20x20 image that's been scaled to a 10x10 rect. The point (1, 1) in the smaller rect should be scaled ...

Make an image fit in a rectangle.

Hi, If I have an image of which I know the height and the width, how can I fit it in a rectangle with the biggest possible size without stretching the image. Pseudo code is enough (but I'm going to use this in Java). Thanks. So, based on the answer, I wrote this: but it doesn't work. What do I do wrong? double imageRatio = bi.getH...

Fast rectangle to rectangle intersection

What's a fast way to test if 2 rectangles are intersecting? A search on the internet came up with this one-liner (WOOT!), but I don't understand how to write it in Javascript, it seems to be written in an ancient form of C++. struct { LONG left; LONG top; LONG right; LONG bottom; } RECT; bool IntersectRe...

Find Upper Right Point of Rotated Rectangle in AS3 (Flex)

I have a rectangle of any arbitrary width and height. I know X,Y, width, and height. How do I solve the upper right hand coordinates when the rectangle is rotated N degrees? I realized if it were axis aligned I would simply solve for (x,y+width). Unforunatly this doesn't hold true when I apply a transform matrix on the rectangle to rotat...

Draw Rectangle with XNA

Hey guys, I was working on game, and wanted to highlight a spot on the screen when something happens, I created a class to do this for me, and found a bit of code to draw the rectangle static private Texture2D CreateRectangle(int width, int height, Color colori) { Texture2D rectangleTexture = new Texture2D(game.GraphicsDevice, width...