geometry

Rotate object about 3 axes in OpenGL

I'm trying to achieve an object rotation about 3 axes by incrementing values of rotation angles for axes, and displaying those axes to make next rotation direction predictable for the viewer. But after a few rotations, only rotation about Z-axis is performed in accord with displayed axis. Is there a chance it can be done simply, without ...

Calculate rectangle width and height from diagonal and rotation

Hello, I have a rotate rectangle and I know the size of the diagonal. I also know the angle used to rotate the rectangle. How can I calculate the width and height of the rectangle? For a sketch of the problem, see: ...

Intersection of parabolic curve and line segment

I have an equation for a parabolic curve intersecting a specified point, in my case where the user clicked on a graph. // this would typically be mouse coords on the graph var _target:Point = new Point(100, 50); public static function plot(x:Number, target:Point):Number{ return (x * x) / target.x * (target.y / target.x); } Thi...

Angle between two line start at the same point.

Lets say I am any two points on 2d plane (p1(x1,y1), p2(x2,y1)) and both points forms a line with the center(c(c1,c2)). Therefore I am two lines end at same point. I want to know how can I calculate angle between those two lines. I want to be able to show angle range from 0-2pi. Also 0-(-2pi) which let the line form by p1 and c to be lin...

How do you generate the non-convex hull from a series of points?

I am currently trying to construct the area covered by a device over an operating period. The first step in this process appears to be constructing a polygon of the covered area. Since the pattern is not a standard shape, convex hulls overstate the covered area by jumping to the largest coverage area possible. I have found a paper th...

How to get transformations from transformation matrix in Flash?

I have transformation matrix properties (a,b,c,d). How to calculate scaleX, scaleY, scewX, scewY and rotation angle from those values? When only one type of transformation is applied, I can figure out that: scaleX = a scaleY = d scewX = c scewY = b rotation = arccos(a) or -arcsin(c) But when multiple transformations are applied at on...

Geo-region data for countries/states/oceans

I'm developing an application where entities are located at positions on Earth. I want to have a set of data from which I can determine what region(s) a point is contained within. Regions may be of types: Continent Country Lake Sea DMZ Desert Ice Shelf ...and so forth. I'm envisioning representing each region as a polygon. For an...

Problem with bird's eye view or 2.5D rendering of Map

I'm developing a turn-by-turn navigation software and I'm using the following solution to make my lines of roads into 2.5D or 3D View http://stackoverflow.com/questions/2808393/draw-2-5d-or-3d-map-with-c-from-lines However, above solution is quite okay for lines within the view port which is 0 < x < width and 0 < y < height . However t...

Auto Slope Generation To Connect Between Terrain and Surface

I have a terrain and a surface, the terrain is represented by a list of elements and coordinates, where as the surface is defined a list of 3D Lines. The surface can be located above, or below or half-above-half-below the terrain. The issue now is that from the edge of the surface, I would have to generate slope planes that connect to t...

How to Create an approximation of a 2-d Arc with line segments?

I have a poly-line-contour consisting of line segments and arcs of circles which i want to extrude to prisms. As my extrusion functions only support straight-edge polygons, i need to approximate the arcs using line segments. The arcs are defined through a starting point, center point and sweep angle (CCW). The sweep-angles i need to d...

Do randomly generated 2D points clump together, and how do I stop it?

Say you have a 2D area and you want to generate random points within it, by setting x = random() * width y = random() * height do the points clump around the centre of the area? I remember reading something saying they would, but I can't quite figure out why, and how to prevent it. ...

Compare Quaternion to axis

I have the orientation of an object stored as a unit quaternion, and I want to see what angle the object's local x axis makes with the global y axis. What's the easiest way to do that? Thanks! ...

How do i get the x/y coordinates of the first and last points of the drawn arc relative to the top left corner of the canvas?

I have a square canvas with a width of 100 and a height of 100. Within that square I draw an arc like so: var canvas = document.getElementById('myCanvas'); var ctx = canvas.getContext('2d'); ctx.clearRect(0,0,100,100) // clears "myCanvas" which is 100pixels by 100 pixels ctx.beginPath(); ctx.arc( 50, 50, 30, 0, Math.PI*2/6 , false )...

C++ - 3d geometry question

Hello! Right my own 3d engine (which I'm currently developing) has a very limited abilities in terms of geometry rendering and I want to expand it. What I'm interested in is how-it-should be done in terms of storing the geometrical objects and drawing them. For now my abstraction only supports rendering geometry as generic lists of t...

WPF element positioning on a Canvas

I have a point on a canvas that I want to place an ellipse. I want the centre of the ellipse to be over this point. At the moment the top left most edge of the ellipse is over this point. I know I can shift the ellipse programmatically on the canvas but I was wondering if there is a way to tell WPF to centre the element over the point i...

What is the fastest algorithm to calculate the minimum distance between two sets of points?

I wanna find the minimum distance between two polygon. I mean, I have to find the minimum of shortest distance between each vertex of first shape with the all the vertexes of the other one. Something like Hausdorff Distance but I need minimum instead of maximum. I appreciate any suggestion. Thank you. ...

Is there an algorithm for solving such projection reconstruction geometric problem?

We have a grid with red squares on it. Meaning we have an array of 3 squares (with angles == 90 deg) which as we know have same size, lying on the same plane and with same rotation relative to the plane they are lying on, and are not situated on same line on plane. We have a projection of the space which contains the plane with squares...

"Center of Mass" between a set of points on a Toroidally-Wrapped Map that minimizes average distance to all points

edit As someone has pointed out, what I'm looking for is actually the point minimizing total geodesic distance between all other points My map is topographically similar to the ones in Pac Man and Asteroids. Going past the top will warp you to the bottom, and going past the left will warp you to the right. Say I have two points (of ...

Any ideas on real life rocks 3d Reconstruction from Single View?

So in general, when we think of Single View Reconstruction we think of working with planes, simple textures and so on... Generally, simple objects from nature's point of view. But what about such thing as wet beach stones? I wonder if there are any algorithms that could help with reconstructing 3d from single picture of stones? ...

Java: Interface with squares (to drag), lines (to link the squares) and animation (square follows the line)

I'm starting to create a Industrial Simulation (IS) interface, using Java. The problem I'm pointing here is the interface. A IS interface will have some big squares (geometrical figure) (unfilled, instead of it they will have their "names" inside it), one or more lines linking the squares, and while time will be going, some "mini-square...