Find the polygon area on a sphere bounded by points - polygon

I am trying to find the area of a polygon on a sphere. I have the azimuth and elevation angles (lat/lon). Is there an algorithm that will do this. If it were on a flat plane, I could approximate using a convex hull, but these points are occupying a significant portion of the sphere.

Related

How to create a non-intersecting polygon in 3D containing n given points on a sphere?

I have the coordinates of n points on a sphere and I know they are all coplanar. How can I find the edges of the polygon which has the vertex the n given points?
OK, your problem is weird ordering.
Project all points onto any convenient plane - the simplest approach is using OXY, OXZ or OYZ plane (choose one that is not perpendicular to your plane) - in this case you just use (P[i].X. P[i].Y, 0) for P[i] point and sort projected 2D points by angle against the first point - it works because points on sphere arc form convex polygon. Then use this ordering as polygon vertex indexes.

How to determine if point is inside skewed conical frustum

I'm trying to work out whether a point is inside an ellipsoid cone formed between a point and a circle in 3D space. The cone is ellipsoid because the point is not perpendicular to the centre of the circle. See diagram below:
So I know:
The position of the point forming the apex of the cone: x
The location of the centre of the circle: c
The radius of the circle: r
The locations of various points I want to determine if they are inside the cone: y, z
Here is a top view of the same diagram:
I do not care about the base of the cone - I want points contained within the cone stretched effectively to infinity.
I've found formulae for working out whether a point is within an ellipsoid cone given the major/minor axis, but having difficulty working out how to do it when the ellipsoid cone is formed from a circle at an angle.
Thanks for any help!
With a conic you could probably determine distance from the axis and a semi major and minor and compute it directly.
Harder is some arbitrary shape.
If the cone has the point in the Z Axis direction, and you know a point in XYZ... then you should be able to draw an ellipse at that particular Z level. Maybe draw it with 360 segments.
Once you have your point and your ellipse, then you can test ellipse segment to see if there is an intersection in X & Y.
Imaging a circle at 0,0,0 with radius 1. And a point at 0,0,0 there are 2Y intersections at +/- 90 degrees and 2 X intersections happening at 0 and 180
If the point is at 2,0,0 you still have 2 intersections in X but they are to the left, and you want one to the left and one to the right.
Zero intersections mean. That you are outside the hoop.
Repeat across the 360 segments and determine how to handle points "on a line" and how close "on" is.

Calculate X/Y/Z of point on surface sphere from a Y change

I'm not really sure how to phrase this question.
I'm looking for a way to calculate the new X/Y/Z point on the surface of a sphere(which has a known radius) from an known X/Y/Z point where the Y has been increased irrelevantly to the sphere. If I can get the radius of the plane of this Y within the sphere then this would be enough but I'm having a hard time visualizing this.
The closer the Y is to the top of the sphere, the greater the change in the radius. But I'm unsure how to calculate the radius of this circle on the plane within the sphere based only on the radius of the sphere and the height increased from the center.
In this image, if the bottom green slab is at Y=0; and the second is at Y=5 and the radius of the sphere is 10, what's the radius of the circle where the top green slab intercepts the circle.
If your sphere is centered on the origin, you can calculate the planar circle radius at offset y=b by considering the circle at the intersection of the xy plane at the origin. This gives you a circle of radius r. The point (a, b) lying on this circle indicates |a| will be the radius of the intersected circle you want. Using the triangle formed between the x axis and the line between the origin and (a,b), we know that a = r*cos(arcsin(b / r)).

Mapping a Coplanar Set of 3D points to Their Planar 2D Coordinates

I have a set of 3D points of a mesh and normals at each point. Points lie on the same plane which are obtained from cutting a 3d model along an arbitrary plane.
The problem is - I need to map these 3D points to their planar 2d coordinates (u,v), that can be used to form Delaunay triangulation of the mesh. So I need a transformation matrix that transforms these 3d coplanar points to their planar 2D coordinates.
The simple solution would be to define a plane perpendicular at all points to your normal vectors. In that case, you simply let the Z component of each vector to the point on your surface equal 0 giving you a two-dimensional representation of your surface on the defined plane. Your transformation (or properly rotation) matrix is then defined with respect to the plane.
The details of the approach are given at plane (Geometry) and the nuts and bolts of how to do it are shown at Defining a plane in R3 with a point and normal vector.

Calculating shortest path between 2 points on a flat map of the Earth

How do you draw the curve representing the shortest distance between 2 points on a flat map of the Earth?
Of course, the line would not be a straight line because the Earth is curved. (For example, the shortest distance between 2 airports is curved.)
EDIT: THanks for all the answers guys - sorry I was slow to choose solution :/
I get this sort of information from the Aviation Formulary.
In this case:
Distance between points
The great circle distance d between
two points with coordinates
{lat1,lon1} and {lat2,lon2} is given
by:
d=acos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(lon1-lon2))
A mathematically equivalent formula,
which is less subject to rounding
error for short distances is:
d=2*asin(sqrt((sin((lat1-lat2)/2))^2 +
cos(lat1)*cos(lat2)*(sin((lon1-lon2)/2))^2))
And
Intermediate points on a great circle
In previous sections we have found
intermediate points on a great circle
given either the crossing latitude or
longitude. Here we find points
(lat,lon) a given fraction of the
distance (d) between them. Suppose the
starting point is (lat1,lon1) and the
final point (lat2,lon2) and we want
the point a fraction f along the great
circle route. f=0 is point 1. f=1 is
point 2. The two points cannot be
antipodal ( i.e. lat1+lat2=0 and
abs(lon1-lon2)=pi) because then the
route is undefined. The intermediate
latitude and longitude is then given
by:
A=sin((1-f)*d)/sin(d)
B=sin(f*d)/sin(d)
x = A*cos(lat1)*cos(lon1) + B*cos(lat2)*cos(lon2)
y = A*cos(lat1)*sin(lon1) + B*cos(lat2)*sin(lon2)
z = A*sin(lat1) + B*sin(lat2)
lat=atan2(z,sqrt(x^2+y^2))
lon=atan2(y,x)
To draw the 3D shortest path between two points on Earth's surface onto a 2D map of Earth's surface, you have to know how the 3D surface of Earth was projected onto the 2D map in question. If you know the projection used, you just need to apply it to the 3D shortest path to project it onto the 2D map. If you don't know the exact projection used, but have access to it through some sort of interface (ie. input 3D surface coords -> output 2D map coords), you could sample points along the 3D surface path, generate their corresponding map points through said interface, and then approximate the projected path with line segments/bezier curves/etc. through the projected sample points.

Resources