bounding-box

Dirty Rectangles

Where may one find references on implementing an algorithm for calculating a "dirty rectangle" for minimizing frame buffer updates? A display model that permits arbitrary edits and computes the minimal set of "bit blit" operations required to update the display. ...

Given a set of points, how do I approximate the major axis of its shape?

Given a "shape" drawn by the user, I would like to "normalize" it so they all have similar size and orientation. What we have is a set of points. I can approximate the size using bounding box or circle, but the orientation is a bit more tricky. The right way to do it, I think, is to calculate the majoraxis of its bounding ellipse. To do...

Determining "boxes of interest" on a PDF page

I want to be able to determine the bounding box of areas of text, images and paths on a PDF page, similar to what is shown here: http://www.windjack.com/products/screenshot/pdfcanscreenshot2.html Looking at the PDF spec, I can see how to determine the bounding boxes of paths and images, but I can't see how to arrive at them for text. D...

LaTeX: Using .bb files in \includegraphics

Hi, is it possible to use a .bb file (generated with, for instance, the "ebb" program included in MiKTeX) to define the bounding box of .png files when using \includegraphics? I can define the bounding box in \includegraphics directly, for instance \includegraphics[bb=0 0 100 100]{file.png}, but I'd like to be able to define this outsid...

Find bounding rectangle of objects in monochrome bitmaps

Given a monochrome bitmap: 000000000000000000000000000000000000000 001000100000000000000000000000000000000 000101000000000000000000000000000000000 000010000000001000000000000000000000000 000101000000010100000000000000000000000 001000100000100010000000000000000000000 000000000000010100000000000000000000000 000000000000001000000000000000...

How can I make images fit into a 200 pixel square box using CSS?

I have a bunch of images which all fit into a 400px × 400px box (that is, one of their dimensions is 400px and the other is smaller). I would like to be able to, using CSS, but jquery/javascript if necessary, fit that image to a 200px by 200px box, so that two edges of the image touch the box, and there is a gap between the other two edg...

Bounding box collision handling - not detection

I had this working a week ago, but then I ended up breaking it. I can't get it working again. I have some 2D sprites, they're just rectangles. No rotation involved. I'm not looking for a way to detect collisions between them, I have that, and there's thousands of articles out there about it. What I can't find is any resource about what t...

Javascript: getBoundingClientRect() for text nodes?

Hi, Is there a way to get the bounding rect of a text node? The getBoundingClientRect() method is defined on elements only, and the parent element is bigger then the actual text node. 10x! ...

How do I correctly space multiple string fragments within a single bounding rectangle when priting with c#?

I am writing a function that applies special formatting to predetermined keywords when printing a string. For example, in the string - "Why won't this work?" I might need to print the word "Why" underlined and in blue. I've had to implement this in pieces, printing each segment of a string with a separate call to print. This approach w...

Clipping WPF elements in a canvas

I am working on an interactive WPF graph/tree tool and have nodes and links between them placed in a canvas. The nodes are usercontrols and the links are simply Line shapes, and currently the links go from the centre of a node to another node's centre. The problem arise when I want the nodes to be slightly transparent and one sees the l...

Given a latitude and longitude, and distance, I want to find a bounding box

Given a latitude and longitude, and distance, I want to find a bounding box where the distances are less than the given distance. This questions was asked here: http://stackoverflow.com/questions/238260/how-to-calculate-the-bounding-box-for-a-given-lat-lng-location I donot want this partcularly accurate, so I have modified and simplif...

Calculating bounding box a certain distance away from a lat/long coordinate in Java

Given a coordinate (lat, long), I am trying to calculate a square bounding box that is a given distance (e.g. 50km) away from the coordinate. So as input I have lat, long and distance and as output I would like two coordinates; one being the south-west (bottom-left) corner and one being the north-east (top-right) corner. I have seen a ...

SVG, text , font with fixed width/height

Hi all, I'm trying to get a SVG 'text' element fitting inside of a svg 'rect' element. e.g. In the example below, I used a monospace text of 5 chars with a font-size of 100px and I expected to have a bounding rectangle close to the text. But there is a blank gap at the right of the text. <svg xmlns="http://www.w3.org/2000/svg" height=...

Calculate the bounding box of a GDI+ drawing

I am drawing an image from MetaFile (emf) and then apply some rotation transformations to it all within the OnPaint of a UserControl. After applying those transformation how can I calculate the normal untransformed rectangular bounding box of this in screen coordinates? I need this to be able to resize the rotated image to the size of th...

Faster way to perform rectangle merging based on their intersection

Hi, this is being used in a motion detection problem. Basically, I perform a motion detection algorithm on an image, and get a list of blobs, where each blob hopefully corresponds to an object that has moved. However, we have to merge these blobs as there might be many small ones touching each other that should be one large blob. I merg...

How do you find a tight-fitting, axis-aligned, bounding box of a rotated ellipse in AS3?

The AS3 getBounds function returns a rectangle that is not fitting tightly to a rotated ellipse. Instead it returns an axis-aligned rectangle based on the bounds of a rectangle whose width/height corresponds to the max/min diameter of the ellipse and follows its rotation. The answer to a similar question on Stack Overflow elegantly outl...

Finding an original rectangle's dimensions from rotation and bounding box dimensions.

In AS3, I have a Sprite that has a Z axis rotation applied. How do I calculate that Sprite's dimensions (it's original size) from Sprite.rotationZ and Sprite.getRect(...)? ...

Find boundaries of an array of objects with only the boundaries of the objects

New Programmer here. Trying space invaders. I have a 2 dimensional array of objects stored in a one dimensional array (using modulo to determine rows and columns). Each object will return its boundaries in graphical space. I need to determine the boundaries (top, bottom, left, right) of the whole array for collision detection. I feel l...

Do I need a spatial index in my database?

I am designing an application that needs to save geometric shapes in a database. I haven't choosen the database management system yet. In my application, all database queries will have an bounding box as input, and as output I want all shapes within that database. I know that databases with a spatial index is used for this kind of appli...

Google maps KM bounds box reapplying itself on map zoom

I have a map in which I apply a custom overlay using KMbox overlay to signify where I think the users general point of interest lies. What I want is to display this map to the user and allow them to click on the map to give me an exact location match of their POI. This all works fine except for when the user clicks on the map and change...