# US 2021/0081490 A1 · Techniques for solving the spherical point-in-polygon problem

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0081490 A1
- Document ID: US20210081490A1
- Status: Published application
- Kind: A1
- Application number: 16/848,375
- Filed: 2020-04-14
- Published: 2021-03-18
- Earliest claimed: 2019-09-12
- Assignees: Oracle International Corporation
- Applicants: Oracle International Corporation
- Inventors: William Martinez Cortes; Shasank Kisan Chavan; Siva Ravada; Ying Hu
- Web page: https://patentgrep.com/patent/US20210081490A1

## CPC

- G06F 17/10: Complex mathematical operations {(function generation by table look-up G06F1/03; evaluation of elementary functions by calculation G06F7/544)}
- G06F 17/16: Matrix or vector computation {, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization (matrix transposition G06F7/78)}
- G06F 9/3887: {controlled by a single instruction for multiple data lanes [SIMD]}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Techniques described herein perform spherical PIP analysis by detecting whether a test ray (defined by a test point (TP) and a point (EP) that is external to a spherical polygon) crosses edge arcs (“edges”) of the polygon based on relative orientations of vertices of the test ray and edges. A classifier vector (CV) for a test ray is calculated based on the cross-product of the TP and the EP. Using the CV, the orientation of each vertex of the polygon with respect to the test ray is determined. Candidate edges having vertices with opposite orientations with respect to the test ray are identified. Crossing edges are determine by calculating CVs for each candidate edge, and determining orientations of the TP and EP with respect to each candidate edge. A set of crossing edges is determined, where the TP and the EP have opposite orientations with respect to each crossing edge.

## Claims

### Claim 1

A computer-executed method for determining whether a test point is within a spherical polygon comprising:
identifying an external point that is external to the spherical polygon;
wherein the spherical polygon is defined by a plurality of vertices and a plurality of edge arcs;
wherein each edge arc of the plurality of edge arcs connects a respective two vertices of the plurality of vertices;
identifying one or more candidate edge arcs, of the plurality of edge arcs, such that each candidate edge arc, of the one or more candidate edge arcs, is defined by a pair of vertices that have opposite orientations with respect to a test ray that is defined by the test point and the external point;
identifying a set of one or more crossing edge arcs, from the one or more candidate edge arcs, such that the test point and the external point have opposite orientations with respect to each crossing edge arc of the set of one or more crossing edge arcs; and
storing information, which is at least based on a cardinality of the set of one or more crossing edge arcs, indicating whether the test point is within the spherical polygon;
wherein the method is performed by one or more computing devices.

### Claim 2 (depends on 1)

The computer-executed method of claim 1, wherein data defining the plurality of vertices of the spherical polygon is stored in columnar format, the method further comprising:
using SIMD instructions to perform one or more operations, on the vertices of the spherical polygon, in parallel;
wherein the one or more operations comprises one or more of:
performing dot products;
computing distance values;
comparing distance values;
performing cross products;
identifying minimum and/or maximum values;
identifying negative values; or
comparing values to a predetermined threshold value.

### Claim 3 (depends on 1)

The computer-executed method of claim 1, wherein:
a particular candidate edge arc, of the one or more candidate edge arcs, is defined by a first vertex and a second vertex;
identifying the particular candidate edge arc comprises:
performing a first dot product, for the first vertex, with respect to a classifier vector that is based on a cross product of the test ray to produce a first scalar result,
performing a second dot product, for the second vertex, with respect to the classifier vector to produce a second scalar result, and
determining a first orientation of the first vertex based on the first scalar result and a second orientation of the second vertex based on the second scalar result,
wherein the first orientation is opposite from the second orientation.

### Claim 4 (depends on 3)

The computer-executed method of claim 3, wherein said performing the first dot product and said performing the second dot product are performed in parallel.

### Claim 5 (depends on 1)

The computer-executed method of claim 1, further comprising:
receiving a request to determine whether the test point is within the spherical polygon; and
providing the information, which is at least based on the cardinality of the set of one or more crossing edge arcs, as a response to the request.

### Claim 6 (depends on 1)

The computer-executed method of claim 1, further comprising:
calculating a bounding sphere that bounds the spherical polygon; and
wherein said identifying the external point is based, at least in part, on the bounding sphere.

### Claim 7 (depends on 6)

The computer-executed method of claim 6, further comprising determining that a second test point is outside the spherical polygon by determining that the second test point is outside the bounding sphere.

### Claim 8 (depends on 7)

The computer-executed method of claim 7, wherein determining that the second test point is outside the bounding sphere is performed, in parallel, with determining whether a third test point is outside the bounding sphere.

### Claim 9 (depends on 1)

The computer-executed method of claim 1, further comprising:
prior to said identifying one or more candidate edge arcs, determining whether the spherical polygon satisfies at least one over-size criterion;
wherein said identifying one or more candidate edge arcs is performed in response to determining that the spherical polygon does not satisfy the at least one over-size criterion; and
wherein the at least one over-size criterion comprises one or more of:
(a) a center of a minimum bounding box, for the plurality of vertices, is within a threshold distance to a center of a base sphere on which the spherical polygon resides,
(b) a center of a bounding sphere that bounds the spherical polygon is within a threshold distance to the origin of the base sphere, or
(c) the center of the bounding sphere is in an opposite direction, with respect to the origin of the base sphere, than the center of the minimum bounding box.

### Claim 10 (depends on 1)

The computer-executed method of claim 1, further comprising, prior to said identifying the one or more candidate edge arcs:
calculating a cross product based, at least in part, on the external point and the test point to produce a classifier vector;
for each vertex, of the plurality of vertices, determining a respective orientation of said each vertex with respect to the test ray by calculating a dot product for said each vertex based, at least in part, on said each vertex and the classifier vector.

### Claim 11 (depends on 1)

The computer-executed method of claim 1, further comprising:
calculating a cross product based, at least in part, on the external point and the test point to produce a classifier vector;
for each vertex, of the plurality of vertices:
calculating a respective scalar result of a dot product based, at least in part, on said each vertex and the classifier vector,
determining whether a magnitude of the respective scalar result is below a threshold magnitude,
if the magnitude of the respective scalar result is below the threshold magnitude, classifying said each vertex as near, and
if the magnitude of the respective scalar result is not below the threshold magnitude, classifying said each vertex as not near; and
identifying one or more coplanar edge arcs, of the plurality of edge arcs, based on both vertices of each coplanar edge arc, of the one or more coplanar edge arcs, being classified as near.

### Claim 12 (depends on 11)

The computer-executed method of claim 11, further comprising, for a particular coplanar edge arc of the one or more coplanar edge arcs:
based, at least in part, on distances between the external point and each of the test point, a first vertex of the particular coplanar edge arc, and a second vertex of the particular coplanar edge arc, identifying one of:
a special case in which the test ray does not cross the particular coplanar edge arc;
a special case in which the test point is on a border of the spherical polygon; or
a typical case in which processing of the test point continues as if the test ray were not coplanar with the particular coplanar edge arc.

### Claim 13 (depends on 1)

The computer-executed method of claim 1, further comprising:
determining whether the cardinality of the set of one or more crossing edge arcs is odd;
responsive to determining that the cardinality of the set of one or more crossing edge arcs is odd, determining that the test point is within the spherical polygon; and
responsive to determining that the cardinality of the set of one or more crossing edge arcs is not odd, determining that the test point is not within the spherical polygon.

### Claim 14

One or more non-transitory computer-readable media storing one or more sequences of instructions that, when executed by one or more processors, cause:
determining whether a test point is within a spherical polygon comprising:
identifying an external point that is external to the spherical polygon;
wherein the spherical polygon is defined by a plurality of vertices and a plurality of edge arcs;
wherein each edge arc of the plurality of edge arcs connects a respective two vertices of the plurality of vertices;
identifying one or more candidate edge arcs, of the plurality of edge arcs, such that each candidate edge arc, of the one or more candidate edge arcs, is defined by a pair of vertices that have opposite orientations with respect to a test ray that is defined by the test point and the external point;
identifying a set of one or more crossing edge arcs, from the one or more candidate edge arcs, such that the test point and the external point have opposite orientations with respect to each crossing edge arc of the set of one or more crossing edge arcs; and
storing information, which is at least based on a cardinality of the set of one or more crossing edge arcs, indicating whether the test point is within the spherical polygon.

### Claim 15 (depends on 14)

The one or more non-transitory computer-readable media of claim 14, wherein:
data defining the plurality of vertices of the spherical polygon is stored in columnar format; and
the one or more sequences of instructions further comprise instructions that, when executed by one or more processors, cause:
using SIMD instructions to perform one or more operations, on the vertices of the spherical polygon, in parallel;
wherein the one or more operations comprises one or more of:
performing dot products;
computing distance values;
comparing distance values;
performing cross products;
identifying minimum and/or maximum values;
identifying negative values; or
comparing values to a predetermined threshold value.

### Claim 16 (depends on 14)

The one or more non-transitory computer-readable media of claim 14, wherein:
a particular candidate edge arc, of the one or more candidate edge arcs, is defined by a first vertex and a second vertex;
identifying the particular candidate edge arc comprises:
performing a first dot product, for the first vertex, with respect to a classifier vector that is based on a cross product of the test ray to produce a first scalar result,
performing a second dot product, for the second vertex, with respect to the classifier vector to produce a second scalar result, and
determining a first orientation of the first vertex based on the first scalar result and a second orientation of the second vertex based on the second scalar result,
wherein the first orientation is opposite from the second orientation.

### Claim 17 (depends on 16)

The one or more non-transitory computer-readable media of claim 16, wherein said performing the first dot product and said performing the second dot product are performed in parallel.

### Claim 18 (depends on 14)

The one or more non-transitory computer-readable media of claim 14, wherein the one or more sequences of instructions further comprise instructions that, when executed by one or more processors, cause:
receiving a request to determine whether the test point is within the spherical polygon; and
providing the information, which is at least based on the cardinality of the set of one or more crossing edge arcs, as a response to the request.

### Claim 19 (depends on 14)

The one or more non-transitory computer-readable media of claim 14, wherein the one or more sequences of instructions further comprise instructions that, when executed by one or more processors, cause:
calculating a bounding sphere that bounds the spherical polygon; and
wherein said identifying the external point is based, at least in part, on the bounding sphere.

### Claim 20 (depends on 19)

The one or more non-transitory computer-readable media of claim 19, wherein the one or more sequences of instructions further comprise instructions that, when executed by one or more processors, cause determining that a second test point is outside the spherical polygon by determining that the second test point is outside the bounding sphere.

### Claim 21 (depends on 20)

The one or more non-transitory computer-readable media of claim 20, wherein determining that the second test point is outside the bounding sphere is performed, in parallel, with determining whether a third test point is outside the bounding sphere.

### Claim 22 (depends on 14)

The one or more non-transitory computer-readable media of claim 14, wherein the one or more sequences of instructions further comprise instructions that, when executed by one or more processors, cause:
prior to said identifying one or more candidate edge arcs, determining whether the spherical polygon satisfies at least one over-size criterion;
wherein said identifying one or more candidate edge arcs is performed in response to determining that the spherical polygon does not satisfy the at least one over-size criterion; and
wherein the at least one over-size criterion comprises one or more of:
(a) a center of a minimum bounding box, for the plurality of vertices, is within a threshold distance to a center of a base sphere on which the spherical polygon resides,
(b) a center of a bounding sphere that bounds the spherical polygon is within a threshold distance to the origin of the base sphere, or
(c) the center of the bounding sphere is in an opposite direction, with respect to the origin of the base sphere, than the center of the minimum bounding box.

### Claim 23 (depends on 14)

The one or more non-transitory computer-readable media of claim 14, wherein the one or more sequences of instructions further comprise instructions that, when executed by one or more processors, cause, prior to said identifying the one or more candidate edge arcs:
calculating a cross product based, at least in part, on the external point and the test point to produce a classifier vector;
for each vertex, of the plurality of vertices, determining a respective orientation of said each vertex with respect to the test ray by calculating a dot product for said each vertex based, at least in part, on said each vertex and the classifier vector.

### Claim 24 (depends on 14)

The one or more non-transitory computer-readable media of claim 14, wherein the one or more sequences of instructions further comprise instructions that, when executed by one or more processors, cause:
calculating a cross product based, at least in part, on the external point and the test point to produce a classifier vector;
for each vertex, of the plurality of vertices:
calculating a respective scalar result of a dot product based, at least in part, on said each vertex and the classifier vector,
determining whether a magnitude of the respective scalar result is below a threshold magnitude,
if the magnitude of the respective scalar result is below the threshold magnitude, classifying said each vertex as near, and
if the magnitude of the respective scalar result is not below the threshold magnitude, classifying said each vertex as not near; and
identifying one or more coplanar edge arcs, of the plurality of edge arcs, based on both vertices of each coplanar edge arc, of the one or more coplanar edge arcs, being classified as near.

### Claim 25 (depends on 24)

The one or more non-transitory computer-readable media of claim 24, wherein the one or more sequences of instructions further comprise instructions that, when executed by one or more processors, cause, for a particular coplanar edge arc of the one or more coplanar edge arcs:
based, at least in part, on distances between the external point and each of the test point, a first vertex of the particular coplanar edge arc, and a second vertex of the particular coplanar edge arc, identifying one of:
a special case in which the test ray does not cross the particular coplanar edge arc;
a special case in which the test point is on a border of the spherical polygon; or
a typical case in which processing of the test point continues as if the test ray were not coplanar with the particular coplanar edge arc.

### Claim 26 (depends on 14)

The one or more non-transitory computer-readable media of claim 14, wherein the one or more sequences of instructions further comprise instructions that, when executed by one or more processors, cause:
determining whether the cardinality of the set of one or more crossing edge arcs is odd;
responsive to determining that the cardinality of the set of one or more crossing edge arcs is odd, determining that the test point is within the spherical polygon; and
responsive to determining that the cardinality of the set of one or more crossing edge arcs is not odd, determining that the test point is not within the spherical polygon.
