geometry

How to convert/project 4D coordinates to 3D coordinates

Hi, theres a lot of nice looking demonstrations of 4D projection showing tesseracts and other wonderful shapes. I'm trying to make a visualisation of a tesseract and I couldn't find anything explicitly describing the maths involved on google... How (preferably in pseudo code) does one project a point in 4D space into 3D space? thanks i...

Efficient Algorithms to Merge Polygons

I have a list of polygons, inside this list, some of the polygons are overlapping, or touches other polygons. My task is to merge all the polygons that are overlapped or touched with each other. I have a union method that does this. What is the most efficient way to do this? What I can think of currently is to loop though the polygon ...

Unions of polygons (ST_UNION for Geography type)

Hi everyone, I am looking for a function that will return the intersection of 2 or more polygons (geography type). I am aware of ST_UNION, ST_COLLECT but it works only for geometry type. Any tip will be really appreciated ...

Can subsonic handle spatial data. If so how?

Hi, I've been using subsonic for quite a while now and I seem pretty confident about using it in my thesis. What I'm not sure about is how will it handle geometry data types. Anyone has an idea?? ...

Geometry: find point a specific distance between two points

This is similar to this question, but kind of the opposite. I have two geographic points (latitude, longitude) A and B. Let's say they're 40 nautical miles apart. I'd like to calculate the coordinates of the point 10 nautical miles from point A, on the line between A and B. I'm sure this is very basic math, but it's been YEARS since I'v...

Subtracting a SQL Server geometry from another

Is there a way to subtract a geometry from another? A kind of reverse STUnion.. The problem I am having is that I need to ensure a shape fits within another (without changing the larger shape). I thought I could use the STIntersection to get the shape thats "in". However, STIntersection is not accurate and produces a shape that can (an...

How to calculate turning direction

I have a three lat-lon coordinates that make up two line segment A to B to C. I also found a function that can return north-bearing of a line segment A-B or B-C in -180 to 180 manner. However, I'm having trouble to determine when a car reaches from A to B, should it turn right or left to continue to C. ...

Calculate coordinates of a regular polygon's vertices

I am writing a program in which I need to draw polygons of an arbitrary number of sides, each one being translated by a given formula which changes dynamically. There is some rather interesting mathematics involved but I am stuck on this probelm. How can I calculate the coordinates of the vertices of a regular polygon (one in which all ...

Creating an abitrary, curved Well Known Text LineString for display in OpenLayers

I am dynamically generating a WKT LineString between points in a map layer being generated for display in OpenLayers. I'd like to make the lines between the points curved, and I'd like to be able to dynamically change the curvature based on various input variables. This is for a network monitoring app, and we'd like the curvature to ...

How do I find the inverse tangent of a line?

Hey guys, I've got a line (x1,y1) and (x2,y2). I'd like to use tan inverse to find the angle of that line, how would I do so in java? I'd like to see what angle the line makes in relation to x1,y1 ...

How to do correct polygon rotation? ( in C# though it applies to anything )

Hi I'm using this C# code to rotate polygons in my app - they do rotate but also get skewed along the way which is not what i want to happen. All the polygons are rectangles with four corners defined as 2D Vectors, public Polygon GetRotated(float radians) { Vector origin = this.Center; Polygon ret = new Polygon(...

Rotated 2d rectangle intersection detection

I have 2 rectangles they are placed arbitrarily and I have rects all four corner point like struct Rect { NSPoint topLeft; NSPoint topRight; NSPoint bottomLeft; NSPoint bottomRight; } I want to check whether 2 rectangles intersects. I am looking a method similar to NSIntersectsRect . But NSIntersectsRectwon't respect the rota...

How do I calculate width and height when increasing area of box

If I had a box 100px wide by 50px high, so the area is 500px squared. what is the formula for calculating the new height and width of the container in pixels if I wanted to increase the overall area by 20% or 50% or whatever? ...

Parsing MSDN Geometry Data Type

Hi, I have a database where one field gives spatial coordinates. I have learned the field is a serialised MSDN geometry Data Type (http://msdn.microsoft.com/en-us/library/bb933973.aspx). I want to access this database from Python and was wandering if anyone knew the format of the Geometry Data Type, or any libraries capable of parsing ...

Determine which side of a line a point lies.

Hey guys, I've got a line (x1,y1) and (x2, y2). I'd like to see if point (x3, y3) lies to the "left" or "right" of said line. How would I do so? ...

Culling interior triangles

I have an array of thousands of quads; 4-sided 3D polygons. All I know are the coordinates of the quad corners. A subset of these quads define the closed outer shell of a 3D shape. The remaining quads are on the inside of this closed solid. How do I figure out which quads are part of the shell and which quads are part of the interior? ...

2d geometry drawing tool

I'm looking for some tool/library that is able to draw simple 2d geometries from text file or programatically. I already found List of interactive geometry software but that not quite what I'm looking for. I would prefer something more similar in usage to graphviz or gnuplot. I already wrote some scripts for gnuplot but this tool has bee...

Lucene(.Net) geometric (lat/long) queries?

I'm writing an ASP.NET MVC site where I plan to use Lucene.Net for searching. Some of my site content has a location attribute, and I'm thinking of incorporating location into the searching functionality. Does functionality exist in Lucene where, if I were to define latitude and longitude fields for my documents, the user inputs some co...

Trilateration in a 2D plane with signal strengths

Hi, first question to StackOverflow, please be gentle. I am trying to find the equation (and then the algorithm for) the center point of three different points on a 2D cartesian plane, given a certain magnitude or "signal strength". These signal strengths are all on a scale relative to each other, but shouldn't necessary be conflated ...

Rotation about a given point

I have a point, let's say p(0.0, 0.0, 20.0) which I want to rotate about point a(0.0, 0.0, 10.0) in XZ plane. What is the simplest way to do it? I am using Qt with QVector3D and QMatrix4x4 to perform transformations. Everything I can think of is something like that: QVector3D p(0.0, 0.0, 20.0); QVector3D a(0.0, 0.0, 10.0); QMatrix4x4 m...