Oracle® Spatial Java API Reference
10g Release 2 (10.2)

B14373-02


oracle.spatial.topo
Class CompGeom

java.lang.Object
  extended by oracle.spatial.topo.CompGeom


public class CompGeom
extends java.lang.Object

Constructor Summary
CompGeom()
           

 

Method Summary
static void augmentMBR(Point2DD[] mbrAdd, Point2DD[] mbrTarget)
          Expands target MBR to encompass added one.
static void crossProduct(double[] r1, double[] r2, double[] result)
          3-D crossproduct via arrays.
static double crossProduct(double x1, double y1, double x2, double y2)
           
static double crossProduct(Point2DD p1, Point2DD p2)
           
static double dotProduct(double x1, double y1, double x2, double y2)
           
static double dotProduct(Point2DD p1, Point2DD p2)
           
static boolean incPointInPolygon(Point2DD p, Point2DD[] q, boolean state)
          Incremental Point in Polygon routine taking a string of coordinates representing a part (or all) of a ring boundary.
static boolean inSector(double px, double py, double sp1x, double sp1y, double sp2x, double sp2y, double sp3x, double sp3y)
          inSector determines whether a line drawn from the middle vertex of a triad of vertices to a test point lies within the sector defined by the triad.
static boolean inSector(Point2DD p, Point2DD[] sectorPoints)
          inSector determines whether a line drawn from the middle vertex of a triad of vertices to a test point lies within the sector defined by the triad.
static boolean lineLineIntersect(Point2DD a1, Point2DD a2, Point2DD b1, Point2DD b2, Point2DD c)
          Finds the open-set intersection of two line segments, if any.
static void main(java.lang.String[] args)
           
static boolean pointInMBR(double px, double py, double[][] mbr)
          Determines if a point is within the bounds of the specified rectangle.
static boolean pointInMBR(Point2DD p, Point2DD[] mbr)
          Determines if a point is within the bounds of the specified rectangle.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

CompGeom

public CompGeom()

Method Detail

dotProduct

public static double dotProduct(Point2DD p1,
                                Point2DD p2)

crossProduct

public static double crossProduct(Point2DD p1,
                                  Point2DD p2)

dotProduct

public static double dotProduct(double x1,
                                double y1,
                                double x2,
                                double y2)

crossProduct

public static double crossProduct(double x1,
                                  double y1,
                                  double x2,
                                  double y2)

crossProduct

public static void crossProduct(double[] r1,
                                double[] r2,
                                double[] result)
3-D crossproduct via arrays. Can preallocate result vector or not

inSector

public static boolean inSector(Point2DD p,
                               Point2DD[] sectorPoints)
inSector determines whether a line drawn from the middle vertex of a triad of vertices to a test point lies within the sector defined by the triad. In order the triad defines the sector in a clockwise direction. Results may be indeterminate for test points very near either segment defining the sector. If this is important, areSegmentsParallel() should be used since it has better control for lost precision.
Parameters:
p - The test point
sectorPoints - The triad to be tested. Vertex [0] and [2] are the endpoints. Vertex [1] is the central vertex.
Returns:
The boolean result; true if point is in the sector of the triad

inSector

public static boolean inSector(double px,
                               double py,
                               double sp1x,
                               double sp1y,
                               double sp2x,
                               double sp2y,
                               double sp3x,
                               double sp3y)
inSector determines whether a line drawn from the middle vertex of a triad of vertices to a test point lies within the sector defined by the triad. In order the triad defines the sector in a clockwise direction. Results may be indeterminate for test points very near either segment defining the sector. If this is important, areSegmentsParallel() should be used since it has better control for lost precision.
Parameters:
px - The test point x value
py - The test point y value
sp1x - x value of triad point 1
sp1y - y value of triad point 1
sp2x - x value of triad point 2, the central vertex
sp2y - y value of triad point 2
sp3x - x value of triad point 3
sp3y - y value of triad point 3
Returns:
The boolean result; true if point is in the sector of the triad

augmentMBR

public static void augmentMBR(Point2DD[] mbrAdd,
                              Point2DD[] mbrTarget)
Expands target MBR to encompass added one. If target MBR has null contents the added one is just copied into it.
Parameters:
mbrAdd - the one to be added
mbrTarget - the one that is augmented if necessary

pointInMBR

public static boolean pointInMBR(Point2DD p,
                                 Point2DD[] mbr)
                          throws java.lang.Exception
Determines if a point is within the bounds of the specified rectangle. Will return true for points on the boundary. Traps null mbr array but will allow and return false for null members of mbr array.
Parameters:
p - the point to be tested.
mbr - an array of Point2DD. [0] is the rectangle lower left corner. [1] is the rectangle upper right corner.
Returns:
true inside; false out; true on the boundary
Throws:
java.lang.Exception

pointInMBR

public static boolean pointInMBR(double px,
                                 double py,
                                 double[][] mbr)
Determines if a point is within the bounds of the specified rectangle. Will return true for points on the boundary. Traps null mbr array but will allow and return false for null members of mbr array.
Parameters:
px - x component of the point to be tested.
py - y component of the point to be tested.
mbr - a 2x2 array of doubles. First index is x,y. Second is min,max
Returns:
true inside; false out; true on the boundary

incPointInPolygon

public static boolean incPointInPolygon(Point2DD p,
                                        Point2DD[] q,
                                        boolean state)
Incremental Point in Polygon routine taking a string of coordinates representing a part (or all) of a ring boundary. Provides an incremental solution to the point in polygon problem. Input is an array of points representing vertices. The input state can be changed by each piece of data . Ordinarily use this with the return passed back on the input on the next piece of the polygon. If using this to incrementally solve the point in polygon problem, init state to FALSE, pass any consecutive group of coordinates with full closure on each other and on the start point, to include the possibility passing the whole polygon with the first coordinate repeated in the array. It makes no difference what orientation the strings of vertices have or in what sequence they are provided as long as they overlap each other's endpoints. As usual, this routine will return indeterminate results on the boundary. This must be tested for first, if important.
Parameters:
p - The test point
q - The portion or all of the polygon perimeter
state - the current in/out status of the determination. Set false intitially
Returns:
the new in/out status as a result of processing this piece of the boundary

lineLineIntersect

public static boolean lineLineIntersect(Point2DD a1,
                                        Point2DD a2,
                                        Point2DD b1,
                                        Point2DD b2,
                                        Point2DD c)
Finds the open-set intersection of two line segments, if any. An intersection is returned only if the lines cross within the open sets defined by their endpoints; that is, touching intersections involving the endpoints are returned false. Use should be made of the method onLine() and the equals() method of the Point2DD class for coincidence of endpoints if knowledge of these conditions is desired.
Parameters:
a1 - the first endpoint of line segment a
a2 - the second endpoint of line segment a
b1 - the first endpoint of line segment b
b2 - the second endpoint of line segment b
c - the intersection (if any). Not set if there is no intersection.
Returns:
true if there is an intersection; false otherwise

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Throws:
java.io.IOException

Oracle® Spatial Java API Reference
10g Release 2 (10.2)

B14373-02


Copyright © 2006, Oracle. All Rights Reserved.