Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>All you need to do is convert <a href="http://www.math.ucsd.edu/~byeap/math20c/math20cw2007/lecturenotes_files/06_02_06_F_20C.pdf" rel="nofollow noreferrer">from spherical to rectangular coordinates</a> if you think that really matters. </p> <p>I'm not sure that it does, because the java.awt.Polygon is merely a data structure holding for <em>pairs of values</em>. If you read the javadocs, they say</p> <blockquote> <p>The Polygon class encapsulates a description of a closed, two-dimensional region within a coordinate space. This region is bounded by an arbitrary number of line segments, each of which is one side of the polygon. Internally, a polygon comprises of a list of (x,y) coordinate pairs, where each pair defines a vertex of the polygon, and two successive pairs are the endpoints of a line that is a side of the polygon. The first and final pairs of (x,y) points are joined by a line segment that closes the polygon. </p> </blockquote> <p>They happen to label those points as x and y, which makes all of us think rectangular coordinates, but they need not be from your point of view. A bug on the service of your sphere would view it as a 2D space. Your radius is large and constant. You just can't count on using any of Polygon's methods (e.g., contains(), getBounds2D(), etc.)</p> <p>In this case, the important thing is your area calculation. You can use a Polygon for your area calculation, storing lats and longs, as long as you view Polygon as a data structure. </p> <p>You might also thing of abandoning this idea and writing your own. It's not too hard to create your own Point and Polygon for spherical coordinates and doing it all with that coordinate system in mind from the start. Better abstraction, less guessing for clients. Your attempt to reuse java.awt.Polygon is admirable, but not necessary.</p> <p>You can perform the area calculation easily by converting it to a contour integral and using Gaussian quadrature to integrate along each straight line boundary segment. You can even include the curvature of each segment at each integration point, since you know the formula. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload