geometry

Tangent of a parametric discrete curve

I have a parametric curve, say two vectors of doubles where the parameter is the index, and I have to calculate the angle of the tangent to this curve at any given point (index). Any suggestion or link about how to do that? Thanks. ...

Calculate the distance between a point and a line segment on an ellipsoid (or WGS84 coordinates)?

Hi, I have a line segment AB between two WGS84 coordinates on the earth's surface (or, alternatively, on an ellipsoid), and need to calculate the distance between a point P and the point nearest to P that is on line segment AB. How can I do this? Any help is greatly appreciated. Regards, Jochen ...

Determining line orientation using vertex shaders

Hi, I want to be able to calculate the direction of a line to eye coordinates and store this value for every pixel on the line using a vertex and fragment shader. My idea was to calculate the direction gradient using atan2(Gy/Gx) after a modelview tranformation for each pair of vertices then quantize this value as a color intensity to pa...

TTSpeechBubbleShape in Three20 only draws "speech" triangles top and bottom

So I am using the Three20 library for an iPhone app, and want to use the TTSpeechBubbleShape style for a view. But the triangle doesn't seem to want to draw on the left or right sides. I see in the source that it's a lot of geometry and was wondering if anyone had tackled this or knew how to fix it. ...

How to learn geometry for programming?

What's the best way to learn the essentials of geometry (and other types of math) used in drawing/graphics programming - e.g. curves (like bezier curves), transformations, matrices, etc.? ...

Get most left|right|top|bottom point contained in box

I'm storing Points Of Interest (POI) in PostgreSQL database, and retrieve them via PHP script to Android application. To reduce internet usage I want my mobile app to know if there are any points in the neighborhood of currently displayed area. My idea is to store bounds of the rectangle containing all points already retrieved (in other...

How do i pack multiple rectangles in a 2d box tetris style

I have a number of rectangles of various widths and heights. I have a larger rectangular platform to put them on. I want to pack them on one side of the platform so they spread in the lengthwise (X) dimension but keep the widthwise (Y) dimension to a minimal. That is to place them like a tetris game. There can be no overlaps but there ca...

c++ opengl: how to find normalized vectors for a quad ?

Hiya. can anyone assist me in finding the proper formula for quad normalization ? using c++ with opengl. thank you! ...

Collision detection, alternatives to "push out"

I'm moving a character (ellipsoid) around in my physics engine. The movement must be constrained by the static geometry, but should slide on the edges, so it won't be stuck. My current approach is to move it a little and then push it back out of the geometry. It seems to work, but I think it's mostly because of luck. I fear there must b...

circles and triangles problem

Hello everyone, I have an interesting problem here I've been trying to solve for the last little while: I have 3 circles on a 2D xy plane, each with the same known radius. I know the coordinates of each of the three centers (they are arbitrary and can be anywhere). What is the largest triangle that can be drawn such that each vertic...

Soft Shadows in Raytracing 3D to 2D

Hello: I wish to implement soft shadows produced by area lights in my raytracer. I'm having trouble generating the random samples. So I have a scene in which I have an area light (represented as a circle) whose world (x,y,z) coordinates of the center are given, the radius is given, the normal of the plane on which the circle lies is giv...

Bounding Boxes for Circle and Arcs in 3D

Given curves of type Circle and Circular-Arc in 3D space, what is a good way to compute accurate bounding boxes (world axis aligned)? Edit: found solution for circles, still need help with Arcs. C# snippet for solving BoundingBoxes for Circles: public static BoundingBox CircleBBox(Circle circle) { Point3d O = circle.Center; Vect...

Determine if 3D point is inside 2D Circle

Hello: I wish to determine if a Point P(x,y,z) is inside a 2D circle in 3D space defined by its center C (cx, cy, cz), radius R, and normal to the plane the circle lies on N. I know that a point P lying on a 2D circle in 3D space is defined by: P = R*cos(t)*U + R*sin(t)*( N x U ) + C where U is a unit vector from the center of the ci...

Geometry library for python (or C++) for CAD-like operations?

I'm trying to put together a simple program that will let me visualize a series of consecutive cuts on a wood panel using a router with a particular cutting head. I'm trying to find a decent geometry library that will give me a shortcut through the CAD-like stuff. Specifically, I'd like to be able to define a rectangular solid (the w...

calculate intersection between two segments in a symmetric way

When using the usual formulas to calculate intersection between two 2D segments, ie here, if you round the result to an integer, you get non-symmetric results. That is, sometimes, due to rounding errors, I get that intersection(A,B)!=intersection(B,A). The best solution is to keep working with floats, and compare the results up to a c...

Google earth GEOdata ?

Question: Is it possible to use/retrieve Geodata from Google-Earth ? What I want to do is take a little area, get terrain information (coordinates, height, elevation) and simulate how the selected area would be flooded at specified amounts of rain for a specified amount of hours. ...

formula for best approximation for center of 2D rotation with small angles

This is not a homework. I am asking to see if problem is classical (trivial) or non-trivial. It looks simple on a surface, and I hope it is truly a simple problem. Have N points (N >= 2) with coordinates Xn, Yn on a surface of 2D solid body. Solid body has some small rotation (below Pi/180) combined with small shifts (below 1% of di...

Rectangles Covering

I have N rectangles with sides parallel to the x- and y-axes. There is another rectangle, model. I need to create an algorithm that can tell whether the model is completely covered by the N rectangles. I have some ideas. I think that first, I need to sort the rectangles by their left side (it can be done in O(n log n) time), and then...

Detecting the axis of rotation from a pointcloud

I'm trying to auto-detect the axis of rotation on a 3d pointcloud. In other words, if I took a small 3d pointcloud, chose a single axis of rotation, and make several copies of the points at different rotation angles, then I get a larger pointcloud. The input to my algorithm is the larger pointcloud, and the desired output is the sing...

Serialize a java.awt.geom.Area

Hi all, I have the need to serialize an Area object (java.awt.geom.Area) in a socket. However it doesn't seem to be serializable. Is there a way to do such thing? Maybe by converting it into a different object? Thanks in advance ...