Suppose I have an array of coordinates, representing a route. I want to decompose this route so that it contains a point, say every 5 miles. How can I do that?
struct Location
{
double latitude;
double longitude;
};
vector<Location> route;
vector<Location> computeHigherGranularityRoute(const vector<Location>& oldRoute, double ...
BW = poly2mask(x, y, m, n) computes a
binary region of interest (ROI) mask,
BW, from an ROI polygon, represented
by the vectors x and y. The size of BW
is m-by-n.
poly2mask sets pixels in BW
that are inside the polygon (X,Y) to 1
and sets pixels outside the polygon to
0.
Problem:
Given such a binary mask BW of a ...
I have a polygon determined by an Array of Points.
This polygon is crossing itself making some holes in the polygon itself.
My questions is: How can I omit this holes and just get the exterior points of the polygon?
Or what will be the same and probably easier: Which Algorithm for checking if a point is inside a Polygon should I use t...
for a given geometry with border width ,
How do I get the clip region which exclude the border ?
...
Hi there,
I have to write an algorithm in AS3.0 that plots the location of points radially. I'd like to input a radius and an angle at which the point should be placed. Obviously I remember from geometry coursework that 2(pi)r will give me an x on the point at the radius distance. The problem is I need to produce the x, y and the calcul...
Just Curious. I'm currently foraying into the world of Java coding, and, was wondering weather Geometry can come useful in the kind of programming a Beginner to Intermediate Skill level Java coder has.
...
I'm trying to implement a geometry templating engine. One of the parts is taking a prototypical polygonal mesh and aligning an instantiation with some points in the larger object.
So, the problem is this: given 3d point positions for some (perhaps all) of the verts in a polygonal mesh, find a scaled rotation that minimizes the differen...
I have a point p, and 2 line segments in a 2D plane. Point p is a location of view from where camera is looking towards the line segments. I want to check if line segment 1 is partially or fully hidden behind the line 2, when looking from the point P.
...
Hi All,
How can we check if a line segment falls partially or fully inside a triangle?
Cheers.
...
Hi,
I'm trying to understand some flash animation, and am having difficulty working out the following. Can anyone help?
I want to convert a degree range of 0 to 90, to a value between 0 and 1
These is an existing function to convert from the range 0 to 1 to degrees, eg:
function convertToDegrees(Int:Pos)
{
var rot = (45 * pos);...
I have been given an assignement for a graphics module, one part of which is to calculate the minimum bounding ellipse of a set of arbitrary shapes. The ellipse doesn't have to be axis aligned.
This is working in java (euch) using the AWT shapes, so I can use all the tools shape provides for checking containment/intersection of objects....
Given 2 points A(x1,y1,z1) and B(x2,y2,z2), what is the equation to calculate their angular coefficient?
I wish a quite simple equation like this one:
m = (y2 - y1) / (x2 - x1)
used to calculate the angular coefficient into a cartesian system.
...
Given 2 points A(x0,y0,z0) and C(x2,y2,z2) forming a segment of length "k", what is the equation to find a point C(x1,y1,z1) placed at "k-1" distance from A?
...
I'd like to write a program that lets users draw points, lines, and circles as though with a straightedge and compass. Then I want to be able to answer the question, "are these three points collinear?" To answer correctly, I need to avoid rounding error when calculating the points.
Is this possible? How can I represent the points in mem...
Just wondering if this is possible in wpf,
Say we have a Path object p1 with geometry = g1 (same as p1.Data).
Similarly if we have another Path object p2 with geometry = g2 (same as p2.Data).
Now if we would like to know what is g2-g1 (same as p2.Data - p1.Data) is it possible.
How about g1+g2?
Please let me know if you have any suggesti...
Hi All,
How can I draw a perpendicular on a line segment from a given point? My line segment is defined as (x1, y1), (x2, y2), If I draw a perpendicular from a point (x3,y3) and it meets to line on point (x4,y4). I want to find out this (x4,y4).
Thankx.
...
I want to calculate the average of a set of angles, which represents source bearing (0 to 360 deg) - (similar to wind-direction)
I know it has been discussed before (several times). The accepted answer was Compute unit vectors from the angles and take the angle of their average.
However this answer defines the average in a non intuitiv...
I am writing a game in Python (with pygame) that requires me to generate random but nice-looking "sea" for each new game. After a long search I settled on an algorithm that involves Bezier curves as defined in padlib.py. I now need to figure out when the curves generated by padlib intersect a line segment.
The brute force method would b...
Hi,
I'm trying to extrude a path in 3d. Nothing fancy yet, just following some points and using a regular polygon for 'tubing'. I'm using Processing for now to quickly prototype, but will later turn the code into OpenGL.
My problem is rotating the 'joints' at the right angles. I think I have a rough idea how to get the angles, not sure...
The function below creates a polygon square out of 4 points and I assume the last 5th point closed the squar, I need it to have at least 24 points and to make up a circle. Any ideas?
function getRadius($point="POINT(-29.8368 30.9096)", $radius=2)
{
$km = 0.009;
$center = "GeomFromText('$point')";
$radius = $radius*$km;
...