geometry

Distribute points on a circle as evenly as possible

Hi SO community! Problem statement I have the following problem: I have a circle with a certain number (zero or more) of points on it. These positions are fixed. Now I have to position another set of points on the circle, such as all points together are as evenly distributed around the circle as possible. Goal My goal is now to devel...

Find if point lies within a rectangle.

How can a find if a point lies within a 2D rectangle given 4 points? ...

Given a latitude / longitude to a certain number of decimal places, how to tell the area covered (in metres)?

If i have a position specified in latitude and longitude, then it can cover a box, depending on how many digits of accuracy are in the position. For example, given a position of 55.0° N, 3.0° W (i.e. to 1 decimal place), and assuming a truncation (as opposed to rounding), this could cover anything that's 55.01° to 55.09°. This would co...

Why is cosine used to calculate the x values and sine the y values for an arc?

I'm trying to understand the math on this raphael.js demo: http://raphaeljs.com/pie.js Checkout the sector method: function sector(cx, cy, r, startAngle, endAngle, params) { var x1 = cx + r * Math.cos(-startAngle * rad), x2 = cx + r * Math.cos(-endAngle * rad), y1 = cy + r * Math.sin(-startAngle * rad), y2 ...

Rotated 2d rectangle intersecting points or area

Moving ahead from previous question.I have two rectangle and they look like this: struct Rect { NSPoint topLeft; NSPoint topRight; NSPoint bottomLeft; NSPoint bottomRight; } I use something similar code to check whether rectangles intersects(or collision) . In case If 2 rectangles intersects I want to calculate the area of in...

Find whether a List<Point> represents a regular or irregular polygon

How can I implement this method: private bool IsRegularPolygon(List<Point> seed) The Point object is in 2 dimensions, with an X and Y coordinate. And assuming it is regular, how can I find the length of a side? Thanks! ...

how to position 12 circles evenly in a big circle

how to position 12 circles evenly in a big circle ...

How to draw a line on an existing BitmapSource in WPF ?

Hello folks, I would like to draw a line (or any geometric shape) on an existing BitmapSource object in my WPF application. What is the best way to do it ? The BitmapSource is the result of a BitmapSource.Create(...) call. Thanks Romain ...

how to position 12 circles evenly in a big circle

This is a realistic question in my study design needed to be solved. Please help. In a 3-cm2 big circle (area=3-cm2, so calculated radius of this big circle=9.77 mm), I need to put 12 small holes (all of same dimension). They should be evenly distributed with 4mm spacing from each other, and should be as close to the edge of the big cir...

Find the outline of a union of grid-aligned squares

How to get the co-ordinates of the outline shape formed using smaller grid blocks. For example, If I used 32x32 unit blocks for construct a shape (any shape). Then how can I get overall co-ordinates of the shape, including the negative spaces. For example: One could arrange the blocks like this: (each block is 32x32 and coordinates ref...

Help with this issue

My application allows rotating points around a center based on the mouse position. I'm basically rotating points around another point like this: void CGlEngineFunctions::RotateAroundPointRad( const POINTFLOAT &center, const POINTFLOAT &in, POINTFLOAT &out, float angle ) { //x' = cos(theta)*x - sin(theta)*y //y' = sin(theta)*x + cos(th...

Projecting points from 4d-space into 3d-space in Mathematica

Suppose we have a set of points with the restriction that for each point all coordinates are non-negative, and the sum of coordinates is equal to 1. This restricts points to lie in a 3-dimensional simplex so it makes sense to try to map it back into 3 dimensional space for visualization. The map I'm looking for would take extreme points...

Check whether a line-segment intersects the perpendicular line draw from a particular point?

As shown in this image: I have a set of line segments. I want to check which line-segments intersect with the perpendicular line drawn from a given point (x0,y0). (E.g.: AB passes the check and BC does not.) The only information I've got is two points of the line-segment, (x1,y1), (x2,y2), and the target point (x0,y0). Is it possi...

Question about the implementation of Bezier Curves?

Hello all, I have read some tutorials for bezier curve such as this one http://www.codeproject.com/KB/recipes/BezirCurves.aspx. The basic idea to create bezier curve is to use some control points and make decision how many new points need to be created. And then interpolate those new points. Here is the question: Assume I have 1000 p...

Fill arbitrary 2D shape with given set of rectangles

I have a set of rectangles and arbitrary shape in 2D space. The shape is not necessary a polygon (it may be a circle), and rectangles have different widths and heights. The task is to approximate the shape with rectangles as close as possible. I can't change rectangles dimensions, but rotation is permitted. It sounds very similar to pac...

Partition line into equal parts

Hello, This is a geometry question. I have a line between two points A and B and want separate it into k equal parts. I need the coordinates of the points that partition the line between A and B. Any help is highly appreciated. Thanks a lot! ...

Given grid coordinates, how can I determine the center point of a cell which they fall within?

I'm working on a simple board game using Appcelerator Titanium for iPhone (javascript - not that it matters for this question really). My problem isn't really language-specific, it's more of a general programming and math question. I have a grid of "cells" that is 10 columns by 10 rows (100 cells). It's a board game, like checkers/drau...

Determine whether two sectors of a given circle intersect?

Anybody know how to determine whether two sectors of the same circle intersect? Let's say I have a sector A, expressed by starting and ending angles A1 and A2, and a sector B, expressed by starting angle B1 and ending angle B2. All angles ranges from 0..2*PI radians (or 0..360 degrees). How to determine whether angle A intersects wit...

What's the opposite of polygon triangulation?

After I've done a 2D triangulation, some triangles have the same color and I want to recombine them for drawing into like-colored graphics paths. I find that if I just draw the triangles one by one, some graphic renderers shows seams between the triangles (at least if anti-aliasing and/or transparency is involved). So how do I take a se...

Ensure camera position is always the center of the screen?

Given 2 functions Translate(x,y) and Scale(x), I want the camera's position to always be the center of the screen. There is also a scalefactor variable and by modifying it it either zooms in or out from the center of the screen. Given that I know the dimensions of the screen in pixels, how could I achieve this? Thanks ...