geometry

Value object or not for 3d points ?

I need to develop a geometry library in python, describing points, lines and planes in 3d space, and various geometry operations. Related to my previous question. The main issue in the design is if these entities should have identity or not. I was wondering if there's a similar library out there (developed in another language) to take i...

Determine if a point is inside a triangle formed by 3 points with given latitude/longitude

I have 3 points ( lat , lon ) that form a triangle.How can i find if a point is inside this triangle? ...

Is there a function in mysql to get the MBR(Minimal Bounding Rectangles) of Geometry?

I found that some result of MBRContains(g1,g2) and other functions seems not right to me. and I want to find out why. how to see the mbr? ...

In JTS, when I do geometry.buffer(1).buffer(-1), will the resulting geometry be equivalent to the original?

I was having problems while intersecting two geometries, getting a TopologyException probably due to a rounding error during the operation, then I read this fix and tried a buffer(0) on both input geometries, but still without success. Then I tried geo.buffer(1).buffer(-1) and it worked. Will these geometries be equivalent to the origi...

Calculating which line is in front at the point where two line projections intersect

Two lines in 3d are projected onto 2d screen, and their projections intersect at a point which can be calculated. If the endpoints of the lines in 3d space are known and their intersection point in the projection plane is also known, how can I determine which line is in front at this intersection point? ...

correcting fisheye distortion programmatically

BOUNTY STATUS UPDATE: I discovered how to map a linear lens, from destination coordinates to source coordinates. I actually struggle to reverse it, and to map source coordinates to destination coordinates. What is the inverse, in code in the style of the converting functions I posted? I also see that my undistortion is imperfect ...

.NET Ascertaining mouse is on line drawn between two arbitrary points

I have an arrow drawn between two objects on a Winform. What would be the simplest way to determine that my mouse is currently hovering over, or near, this line. I have considered testing whether the mouse point intersects a square defined and extrapolated by the two points, however this would only be feasible if the two points had ve...

A problem with connected points and determining geometry figures based on points' location analysis

In school we have a really hard problem, and still no one from the students has solved it yet. Take a look at the picture below: http://d.imagehost.org/0422/mreza.gif That's a kind of a network of connected points, which doesn't end and each point has its own number representing it. Let say the numbers are like this: 1-23-456-78910-et...

How could I make geometry advanced operations on bezier paths?

I have a library that draws regular bezier path figures (complex paths formed of a lot of bezier points), using midpoint approximation. I can draw them without problem, but I need to add support for advanced geometry operations: Nearest point of a curve, intersection, figure contains point, and more importantly, path combinations: diffe...

How to convert any text/font to its bezier path representation?

I have a bezier path library to draw complex bezier paths without problem. Now, I need to know how to read a text or font and extract its path information to draw it as a path instead of as text. I came across a C applicaiton, FontForge. It does exactly what I need, picks any font and extract its path information. But what I need to kno...

Prims vs Polys: what are the pros and cons of each?

I've noticed that most 3d gaming/rendering environments represent solids as a mesh of (usually triangular) 3d polygons. However some examples, such as Second Life, or PovRay use solids built from a set of 3d primitives (cube, sphere, cone, torus etc) on which various operations can be performed to create more complex shapes. So my quest...

Howto project a planar polygon on a plane in 3d-space

I want to project my Polygon along a vector to a plane in 3d Space. I would preferably use a single transformation matrix to do this, but I don't know how to build a matrix of this kind. Given the plane's parameters (ax+by+cz+d), the world coordinates of my Polygon. As stated in the the headline, all vertices of my polygon lie in an...

Determining The Coordinates Of A Point Based On Its Known Difference From Three Other Points

I have the coordinates of three points on a plane. Let's call them X1,Y1, X2,Y2, X3 Y3. I need to calculate X4,Y4 but all I know is: X1,Y1 is 350 units in distance from X4,Y4 X2,Y2 is 200 units in distance from X4,Y4 X3,Y3 is 50 units in distance from X4,Y4 I Know The Exact Values For X1,Y1, X2,Y2, and X3,Y3 How can I determine the ...

How to draw a filled circle in Java?

I have a JPanel with a Grid Layout. In the "cells" of the grid I can put different elements (for example JButtons). There is no problems with that. But now I want to put a filled circle in some of the cells. I also would like to relate an ActionListener with these circles. In more details, if I click the circle it disappears from the cur...

What is the name of this geometrical function?

In a two dimentional integer space, you have two points, A and B. This function returns an enumeration of the points in the quadrilateral subset bounded by A and B. A = {1,1} B = {2,3} Fn(A,B) = {{1,1},{1,2},{1,3},{2,1},{2,2},{2,3}} I can implement it in a few lines of LINQ. private void UnknownFunction(Point to, Point from, List<Poi...

Saddle roof algorithm

Hello, I have map (openstreetmap project) with many buildings. Each building is a polygon. How can I make saddle roof parts polygons for every building outline? Algorithm should transform one polygon in 2D to set of polygons in 2D (or 3D). Reason for this transformation is visualization - better rendering isometric view. For example (...

3D coordinate of 2D point given camera and view plane

I wish to generate rays from the camera through the viewing plane. In order to do this, I need my camera position ("eye"), the up, right, and towards vectors (where towards is the vector from the camera in the direction of the object that the camera is looking at) and P, the point on the viewing plane. Once I have these, the ray that's g...

How to calculate the length of a Path2D in Java?

I have some paths represented by Path2D. The Path consist of multiple CubicCurve2D or Line2D segments that are connected to each other. I would like to calculate or get the length from the start to the end of a Path. How can I calculate it or get it? Is it possible? I have checked the API documentation, but couldn't find any useful metho...

Intersections of 3D polygons in python

Are there any open source tools or libraries (ideally in python) that are available for performing lots of intersections with 3D geometry read from an ESRI shapefile? Most of the tests will be simple line segments vs polygons. I've looked into OGR 1.7.1 / GEOS 3.2.0, and whilst it loads the data correctly, the resulting intersections ar...

How do I use Django to insert a Geometry Field into the database?

class LocationLog(models.Model): user = models.ForeignKey(User) utm = models.GeometryField(spatial_index=True) This is my database model. I would like to insert a row. I want to insert a circle at point -55, 333. With a radius of 10. How can I put this circle into the geometry field? Of course, then I would want to check whic...