Class TLcdCartesian

java.lang.Object
com.luciad.geometry.cartesian.TLcdCartesian

public class TLcdCartesian extends Object
Utility class for Cartesian calculations.
  • Constructor Details

    • TLcdCartesian

      public TLcdCartesian()
  • Method Details

    • distance2D

      public static double distance2D(ILcdPoint aP1, ILcdPoint aP2)
      Calculates the distance between two ILcdPoint objects aP1 and aP2.
      Parameters:
      aP1 - first point.
      aP2 - second point.
      Returns:
      the distance between the points aP1 and aP2.
    • squaredDistance2D

      public static double squaredDistance2D(ILcdPoint aP1, ILcdPoint aP2)
      Calculates the squared distance between two ILcdPoint objects aP1 and aP2.
      Parameters:
      aP1 - first point.
      aP2 - second point.
      Returns:
      the squared distance between the points aP1 and aP2.
    • distance2D

      public static double distance2D(double aX1, double aY1, double aX2, double aY2)
      Calculates the distance between two cartesian points (aX1,aY1) and (aX2,aY2).
      Parameters:
      aX1 - x-coordinate of the first point.
      aY1 - y-coordinate of the first point.
      aX2 - x-coordinate of the second point.
      aY2 - y-coordinate of the second point.
      Returns:
      the distance between the points (aX1,aY1) and (aX2,aY2).
    • squaredDistance2D

      public static double squaredDistance2D(double aX1, double aY1, double aX2, double aY2)
      Calculates the squared distance between two cartesian points (aX1,aY1) and (aX2,aY2).
      Parameters:
      aX1 - x-coordinate of the first point.
      aY1 - y-coordinate of the first point.
      aX2 - x-coordinate of the second point.
      aY2 - y-coordinate of the second point.
      Returns:
      the distance between the points (aX1,aY1) and (aX2,aY2).
    • distance3D

      public static double distance3D(ILcdPoint aP1, ILcdPoint aP2)
      Calculates the distance between two ILcdPoint objects aP1 and aP2.
      Parameters:
      aP1 - first point.
      aP2 - second point.
      Returns:
      the distance between the points aP1 and aP2.
    • squaredDistance3D

      public static double squaredDistance3D(ILcdPoint aP1, ILcdPoint aP2)
      Calculates the squared distance between two ILcdPoint objects aP1 and aP2.
      Parameters:
      aP1 - first point.
      aP2 - second point.
      Returns:
      the squared distance between the points aP1 and aP2.
    • distance3D

      public static double distance3D(double aX1, double aY1, double aZ1, double aX2, double aY2, double aZ2)
      Calculates the distance between two cartesian points (aX1,aY1,aZ1) and (aX2,aY2,aZ2).
      Parameters:
      aX1 - x-coordinate of the first point.
      aY1 - y-coordinate of the first point.
      aZ1 - z-coordinate of the first point.
      aX2 - x-coordinate of the second point.
      aY2 - y-coordinate of the second point.
      aZ2 - z-coordinate of the second point.
      Returns:
      the distance between the points (aX1,aY1,aZ1) and (aX2,aY2,aZ2).
    • squaredDistance3D

      public static double squaredDistance3D(double aX1, double aY1, double aZ1, double aX2, double aY2, double aZ2)
      Calculates the squared distance between two cartesian points (aX1,aY1,aZ1) and (aX2,aY2,aZ2).
      Parameters:
      aX1 - x-coordinate of the first point.
      aY1 - y-coordinate of the first point.
      aZ1 - z-coordinate of the first point.
      aX2 - x-coordinate of the second point.
      aY2 - y-coordinate of the second point.
      aZ2 - z-coordinate of the second point.
      Returns:
      the squared distance between the points (aX1,aY1,aZ1) and (aX2,aY2,aZ2).
    • area

      public static double area(ILcdPoint[] aPts, int aN)
      Surface area of a polygon given with cartesian coordinates. The segments of the polygon must not be self-intersecting. The area of a polygon is positive if the points are given counterclockwise, negative otherwise.

      Constraints: aN > 2 and aPts.length ≥ aN

      Parameters:
      aPts - array of ILcdPoint objects.
      aN - aPts[0..aN-1] defines the polygon.
      Returns:
      the surface area in meters2 (if coordinates given in meters). Sign positive for polygons specified counterclockwise, negative otherwise.
    • area

      public static double area(ILcdShape aShape)
      Calculates the geodesic area of a shape.

      Following shapes are supported:

      • ILcdPolygon that doesn't self-intersect
      • ILcdComplexPolygon that is geometrically valid: no individual polygon can be self-intersecting, and no two polygons may intersect. Nested polygons are allowed.
      • ILcdSurface with external and internal rings as polygons. The surface must also be geometrically valid.
      • ILcdShapeList containing supported shapes.

      This method does not fully check the validity of the arguments, since it is computationally too expensive to do so. Passing an unsupported shape may result in an IllegalArgumentException being thrown, or may result in an undefined return value.

      Parameters:
      aShape - a shape adhering to the requirements above
      Returns:
      the surface area in meter2, always positive
      Since:
      2022.0
      See Also:
    • forwardAzimuth2D

      public static double forwardAzimuth2D(ILcdPoint aP1, ILcdPoint aP2)
      Forward azimuth from aP1 to aP2 in RADIANS! The resulting value lies between [0.0, 2.0*Math.PI]. Forward azimuth is the angle between the Y-axis and the line from aP1 to aP2. Measured positive CLOCKWISE!
      Parameters:
      aP1 - start point.
      aP2 - end point.
      Returns:
      the forward azimuth in RADIANS.
    • forwardAzimuth2D

      public static double forwardAzimuth2D(double aX1, double aY1, double aX2, double aY2)
      Forward azimuth from (aX1,aY1) to (aX2,aY2) in RADIANS! The resulting value lies between [0.0, 2.0*Math.PI]. Forward azimuth is the angle between the Y-axis and the line from (aX1,aY1) to (aX2,aY2). Measured positive CLOCKWISE!
      Parameters:
      aX1 - x-coordinate of the start point.
      aY1 - y-coordinate of the start point.
      aX2 - x-coordinate of the end point.
      aY2 - y-coordinate of the end point.
      Returns:
      the forward azimuth in RADIANS.
    • forwardAngle2D

      public static double forwardAngle2D(ILcdPoint aP1, ILcdPoint aP2)
      Forward angle from aP1 to aP2 in RADIANS! The resulting value lies between [-Math.PI, Math.PI]. Forward angle is the angle between the Y-axis and the line from aP1 to aP2. Measured positive CLOCKWISE!
      Parameters:
      aP1 - start point.
      aP2 - end point.
      Returns:
      the forward angle in RADIANS.
    • forwardAngle2D

      public static double forwardAngle2D(double aX1, double aY1, double aX2, double aY2)
      Forward angle from (aX1,aY1) to (aX2,aY2) in RADIANS! The resulting value lies between [-Math.PI, Math.PI]. Forward angle is the angle between the Y-axis and the line from (aX1,aY1) to (aX2,aY2). Measured positive CLOCKWISE!
      Parameters:
      aX1 - x-coordinate of the start point.
      aY1 - y-coordinate of the start point.
      aX2 - x-coordinate of the end point.
      aY2 - y-coordinate of the end point.
      Returns:
      the forward angle in RADIANS.
    • orientation2D

      public static int orientation2D(ILcdPoint[] aPts, int aN)
      Calculate the orientation of a polygon of points.
      Parameters:
      aPts - array of ILcd2DEditablePoint objects (first point is not repeated), never null
      aN - aPts[0..aN-1] number of points.
      Returns:
      the orientation of the polygon.
    • orientation2D

      public static int orientation2D(ILcdPointList aPointList)
      Calculate the orientation of a polygon of points.

      Constraints: aN > 2 and aPts.length ≥ aN

      Parameters:
      aPointList - polygon (first point is not repeated), never null
      Returns:
      ILcdPolygon.CLOCKWISE or ILcdPolygon.COUNTERCLOCKWISE.
      Throws:
      NullPointerException - if the pointlist is null
    • elliptical2DPointSFCT

      public static void elliptical2DPointSFCT(double aA, double aB, double aAngle, ILcd2DEditablePoint a2DEditablePointSFCT)
      Calculates an ILcd2DEditablePoint on an ellipse with semi-major axis aA and semi-minor axis aB and an aAngle from the semi-major axis measured in degrees, positive COUNTERCLOCKWISE. The line with angle aAlpha starts from the center of the ellipse.
      Parameters:
      aA - semi-major axis of the ellipse.
      aB - semi-minor axis of the ellipse.
      aAngle - angle from the semi-major axis, measured in degrees, positive COUNTERCLOCKWISE.
      a2DEditablePointSFCT - the resulting point as side effect.
    • ellipticalDistance2D

      public static double ellipticalDistance2D(double aA, double aB, double aAngle)
      Calculates the cartesian distance between the center of an ellipse with semi-major axis aA and semi-minor axis aB and a point located on the ellipse at an aAngle from the semi-major axis measured in degrees positive COUNTERCLOCKWISE.
      Parameters:
      aA - semi-major axis of the ellipse.
      aB - semi-minor axis of the ellipse.
      aAngle - angle from the semi-major axis, measured in degrees, positive COUNTERCLOCKWISE.
      Returns:
      the cartesian distance between the center of an ellipse with semi-major axis aA and semi-minor axis aB and a point located on the ellipse at an aAngle from the semi-major axis measured in degrees positive COUNTERCLOCKWISE.
    • closestPointOnShape

      public static double closestPointOnShape(ILcdPoint aPoint, ILcdShape aShape, ILcd2DEditablePoint aResultSFCT)
      Finds the shortest cartesian distance from the given point to the given shape. The corresponding point on the shape is returned in the side effect parameter.

      This methods supports linear ILcdPolyline and ILcdPolygon instances.

      Parameters:
      aPoint - the starting point
      aShape - the shape for which to find the point closest to aPoint
      aResultSFCT - side-effect parameter for the resulting point
      Returns:
      the shortest cartesian distance
      Throws:
      IllegalArgumentException - if the provided shape is not supported
    • closestPointOnLineSegment

      public static double closestPointOnLineSegment(ILcdPoint aP0, ILcdPoint aP1, ILcdPoint aP2, ILcd2DEditablePoint aClosestPointSFCT)
      Calculates the closest point on a line segment aP0-aP1 from a point aP2. The distance between the points aP2 and this closest point is returned as a result. The coordinates of the closest point are available within the side effect parameter aClosestPointSFCT.
      Parameters:
      aP0 - an end point of the line segment.
      aP1 - an end point of the line segment.
      aP2 - point from which to search the closest point on the line segment.
      aClosestPointSFCT - the closest point on the line segment as side effect.
      Returns:
      the distance to the closest point on the line segment.
    • closestPointOnLineSegment

      public static double closestPointOnLineSegment(double aX0, double aY0, double aX1, double aY1, double aX2, double aY2, ILcd2DEditablePoint aClosestPointSFCT)
      Calculates the closest point on a line segment (aX0,aY0)-(aX1,aY1) from a point (aX2,aY2). The distance between the points (aX2,aY2) and this closest point is returned as a result. The coordinates of the closest point are available within the side effect parameter aClosestPointSFCT.
      Parameters:
      aX0 - x-coordinate of the first end point of the line segment.
      aY0 - y-coordinate of the first end point of the line segment.
      aX1 - x-coordinate of the second end point of the line segment.
      aY1 - y-coordinate of the second end point of the line segment.
      aX2 - x-coordinate of the point from which to search for the closest point on the line segment.
      aY2 - y-coordinate of the point from which to search for the closest point on the line segment.
      aClosestPointSFCT - the closest point on the line segment as side effect.
      Returns:
      the distance to the closest point on the line segment.
    • intersects2DLS

      public static boolean intersects2DLS(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4)
      Check whether line segment aP1-aP2 and line segment aP3-aP4 intersect each other.
      Parameters:
      aP1 - an end point of the first line segment.
      aP2 - an end point of the first line segment.
      aP3 - an end point of the second line segment.
      aP4 - an end point of the second line segment.
      Returns:
      true if they have an intersection point, false otherwise.
    • intersects2DLS

      public static boolean intersects2DLS(double aX1, double aY1, double aX2, double aY2, double aX3, double aY3, double aX4, double aY4)
      Checks whether line segment P1(aX1,aY1)-P2(aX2,aY2) intersects or overlaps line segment P3(aX3,aY3)-P4(aX4,aY4).
      Parameters:
      aX1 - x-coordinate of an end point of the first line segment.
      aY1 - y-coordinate of an end point of the first line segment.
      aX2 - x-coordinate of an end point of the first line segment.
      aY2 - y-coordinate of an end point of the first line segment.
      aX3 - x-coordinate of an end point of the second line segment.
      aY3 - y-coordinate of an end point of the second line segment.
      aX4 - x-coordinate of an end point of the second line segment.
      aY4 - y-coordinate of an end point of the second line segment.
      Returns:
      true if they have an intersection point or overlap, false otherwise.
    • parallel2DLS

      public static boolean parallel2DLS(double aX1, double aY1, double aX2, double aY2, double aX3, double aY3, double aX4, double aY4)
      Checks whether line segment P1(aX1,aY1)-P2(aX2,aY2) is parallel with line segment P3(aX3,aY3)-P4(aX4,aY4).
      Parameters:
      aX1 - x-coordinate of an end point of the first line segment.
      aY1 - y-coordinate of an end point of the first line segment.
      aX2 - x-coordinate of an end point of the first line segment.
      aY2 - y-coordinate of an end point of the first line segment.
      aX3 - x-coordinate of an end point of the second line segment.
      aY3 - y-coordinate of an end point of the second line segment.
      aX4 - x-coordinate of an end point of the second line segment.
      aY4 - y-coordinate of an end point of the second line segment.
      Returns:
      true if the line segments are parallel, false otherwise.
    • intersectsLSWithCircularArc

      public static boolean intersectsLSWithCircularArc(double aX1, double aY1, double aX2, double aY2, double aXCenter, double aYCenter, double aRadius, double aStartAngle, double aArcAngle)
      Returns whether the line segment and the circular arc have an intersection. Angles are measured from the 3 o'clock position, positive counter-clockwise.
      Parameters:
      aX1 - x-coordinate of the first end point of the line segment.
      aY1 - y-coordinate of the first end point of the line segment.
      aX2 - x-coordinate of the second end point of the line segment.
      aY2 - y-coordinate of the second end point of the line segment.
      aXCenter - x-coordinate of the center of the circular arc.
      aYCenter - y-coordinate of the center of the circular arc.
      aRadius - radius of the circular arc.
      aStartAngle - start angle of the circular arc segment in decimal degrees.
      aArcAngle - extent of the arc segment in decimal degrees.
      Returns:
      whether the line segment and the circular arc have an intersection.
    • intersectsCircularArcWithCircularArc

      public static boolean intersectsCircularArcWithCircularArc(double aX1, double aY1, double aRadius1, double aStartAngle1, double aArcAngle1, double aX2, double aY2, double aRadius2, double aStartAngle2, double aArcAngle2)
      Returns whether the two circular arc segments intersect each other. Angles are measured from the 3 o'clock position, positive counter-clockwise.
      Parameters:
      aX1 - x-coordinate of the center of the circular arc.
      aY1 - y-coordinate of the center of the circular arc.
      aRadius1 - radius of the circular arc.
      aStartAngle1 - start angle of the circular arc segment in decimal degrees.
      aArcAngle1 - extent of the arc segment in decimal degrees.
      aX2 - x-coordinate of the center of the circular arc.
      aY2 - y-coordinate of the center of the circular arc.
      aRadius2 - radius of the circular arc.
      aStartAngle2 - start angle of the circular arc segment in decimal degrees.
      aArcAngle2 - extent of the arc segment in decimal degrees.
      Returns:
      whether the two circular arc segments intersect each other.
    • intersection2DLSSFCT

      @Deprecated public static void intersection2DLSSFCT(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4, ILcd2DEditablePoint a2DEditablePoint)
      Calculates the intersection point between the lines corresponding to the two line segments aP1-aP2 and aP3-aP4.
      Parameters:
      aP1 - an end point of the first line segment.
      aP2 - an end point of the first line segment.
      aP3 - an end point of the second line segment.
      aP4 - an end point of the second line segment.
      a2DEditablePoint - the intersection point of the two line segments as side effect.
    • intersection2DLSSFCT

      @Deprecated public static void intersection2DLSSFCT(double aX1, double aY1, double aX2, double aY2, double aX3, double aY3, double aX4, double aY4, ILcd2DEditablePoint a2DEditablePoint)
      Calculates the intersection point between the lines corresponding to the two line segments P1(aX1,aY1)-P2(aX2,aY2) and P3(aX3,aY3)-P4(aX4,aY4). If the two lines are parallel, the middle point between the end point of the first segment and the start point of the second segment is returned.
      Parameters:
      aX1 - x-coordinate of an end point of the first line segment.
      aY1 - y-coordinate of an end point of the first line segment.
      aX2 - x-coordinate of an end point of the first line segment.
      aY2 - y-coordinate of an end point of the first line segment.
      aX3 - x-coordinate of an end point of the second line segment.
      aY3 - y-coordinate of an end point of the second line segment.
      aX4 - x-coordinate of an end point of the second line segment.
      aY4 - y-coordinate of an end point of the second line segment.
      a2DEditablePoint - the intersection point of the two line segments as side effect.
    • intersection2DLines

      public static int intersection2DLines(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4, ILcd2DEditablePoint aResultSFCT)
      Calculates the intersection point between the line going through aP1 and aP2, and the line going through aP3 and aP4.
      If the two lines are parallel, there is no intersection point and this method returns false.
      Parameters:
      aP1 - the first point on the first line.
      aP2 - the second point on the first line.
      aP3 - the first point on the second line.
      aP4 - the second point on the second line.
      aResultSFCT - the intersection point of the two lines as side effect, if it exists. Can be null, if you're not interested in this result.
      Returns:
      0 if the lines are parallel, but don't coincide.
      1 if the lines intersect. The intersection point is stored in aResultSFCT.
      2 if the lines coincide.
      Since:
      2021.1
    • intersection2DLines

      public static int intersection2DLines(double aX1, double aY1, double aX2, double aY2, double aX3, double aY3, double aX4, double aY4, ILcd2DEditablePoint aResultSFCT)
      Calculates the intersection point between the line going through P1(aX1,aY1) and P2(aX2,aY2), and the line going through P3(aX3,aY3) and P4(aX4,aY4).
      If the two lines are parallel, there is no intersection point and this method returns false.
      Parameters:
      aX1 - x-coordinate of the first point on the first line.
      aY1 - y-coordinate of the first point on the first line.
      aX2 - x-coordinate of the second point on the first line.
      aY2 - y-coordinate of the second point on the first line.
      aX3 - x-coordinate of the first point on the second line.
      aY3 - y-coordinate of the first point on the second line.
      aX4 - x-coordinate of the second point on the second line.
      aY4 - y-coordinate of the second point on the second line.
      aResultSFCT - the intersection point of the two lines as side effect, if it exists. Can be null, if you're not interested in this result.
      Returns:
      0 if the lines are parallel, but don't coincide.
      1 if the lines intersect. The intersection point is stored in aResultSFCT.
      2 if the lines coincide.
      Since:
      2021.1
    • intersection2DLineSegments

      public static int intersection2DLineSegments(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4, ILcd2DEditablePoint aResult1SFCT, ILcd2DEditablePoint aResult2SFCT)
      Calculates the intersection point between the line segments P1(aX1,aY1)-P2(aX2,aY2) and P3(aX3,aY3)-P4(aX4,aY4), if it exists.
      Parameters:
      aP1 - the first end point of the first line segment.
      aP2 - the second end point of the first line segment.
      aP3 - the first end point of the second line segment.
      aP4 - the second end point of the second line segment.
      aResult1SFCT - the intersection point of the two line segments as side effect, if it exists, or one end point of the overlap segment in case the line segments overlap. Can be null, if you're not interested in this result.
      aResult2SFCT - the other end point of the overlap segment in case the line segments overlap. Can be null, if you're not interested in this result and aResult1SFCT is null as well.
      Returns:
      0 if the line segments do not intersect or overlap.
      1 if the line segments intersect. The intersection point is stored in aResult1SFCT.
      2 if the line segments overlap. The end points of the overlap segment are stored in aResult1SFCT and aResult2SFCT.
      Since:
      2021.1
    • intersection2DLineSegments

      public static int intersection2DLineSegments(double aX1, double aY1, double aX2, double aY2, double aX3, double aY3, double aX4, double aY4, ILcd2DEditablePoint aResult1SFCT, ILcd2DEditablePoint aResult2SFCT)
      Calculates the intersection point between the line segments P1(aX1,aY1)-P2(aX2,aY2) and P3(aX3,aY3)-P4(aX4,aY4), if it exists.
      Parameters:
      aX1 - x-coordinate of the first end point of the first line segment.
      aY1 - y-coordinate of the first end point of the first line segment.
      aX2 - x-coordinate of the second end point of the first line segment.
      aY2 - y-coordinate of the second end point of the first line segment.
      aX3 - x-coordinate of the first end point of the second line segment.
      aY3 - y-coordinate of the first end point of the second line segment.
      aX4 - x-coordinate of the second end point of the second line segment.
      aY4 - y-coordinate of the second end point of the second line segment.
      aResult1SFCT - the intersection point of the two line segments as side effect, if it exists, or one end point of the overlap segment in case the line segments overlap. Can be null, if you're not interested in this result.
      aResult2SFCT - the other end point of the overlap segment in case the line segments overlap. Can be null, if you're not interested in this result and aResult1SFCT is null as well.
      Returns:
      0 if the line segments do not intersect or overlap.
      1 if the line segments intersect. The intersection point is stored in aResult1SFCT.
      2 if the line segments overlap. The end points of the overlap segment are stored in aResult1SFCT and aResult2SFCT.
      Since:
      2021.1
    • contains2D

      public static boolean contains2D(double aX1, double aY1, double aX2, double aY2, double aXP, double aYP)
      Calculates whether a point lies on a given line segment.
      Parameters:
      aX1 - x-coordinate of an end point of the line segment.
      aY1 - y-coordinate of an end point of the line segment.
      aX2 - x-coordinate of an end point of the line segment.
      aY2 - y-coordinate of an end point of the line segment.
      aXP - x-coordinate of the point to test.
      aYP - y-coordinate of the point to test.
      Returns:
      whether the point lies on the given line segment.
    • contains3D

      public static boolean contains3D(double aX1, double aY1, double aZ1, double aX2, double aY2, double aZ2, double aXP, double aYP, double aZP)
      Calculates whether a point lies on a given line segment taking into account 3 coordinates.
      Parameters:
      aX1 - x-coordinate of an end point of the line segment.
      aY1 - y-coordinate of an end point of the line segment.
      aZ1 - z-coordinate of an end point of the line segment.
      aX2 - x-coordinate of an end point of the line segment.
      aY2 - y-coordinate of an end point of the line segment.
      aZ2 - z-coordinate of an end point of the line segment.
      aXP - x-coordinate of the point to test.
      aYP - y-coordinate of the point to test.
      aZP - z-coordinate of the point to test.
      Returns:
      whether the point lies on the given line segment.
    • contains2DLS

      public static boolean contains2DLS(double aX1, double aY1, double aX2, double aY2, double aX3, double aY3, double aX4, double aY4)
      Calculates whether line segment (aX1,aY1)-(aX2,aY2) contains the line segment (aX3,aY3)-(aX4,aY4).
      Parameters:
      aX1 - x-coordinate of an end point of the first line segment.
      aY1 - y-coordinate of an end point of the first line segment.
      aX2 - x-coordinate of an end point of the first line segment.
      aY2 - y-coordinate of an end point of the first line segment.
      aX3 - x-coordinate of an end point of the second line segment.
      aY3 - y-coordinate of an end point of the second line segment.
      aX4 - x-coordinate of an end point of the second line segment.
      aY4 - y-coordinate of an end point of the second line segment.
      Returns:
      whether the first line segments contains the second line segment.
    • intersects2DSR

      public static boolean intersects2DSR(double aX1, double aY1, double aWidth1, double aHeight1, double aX2, double aY2, double aWidth2, double aHeight2)
      Checks whether two 2D rectangles intersect.
      Parameters:
      aX1 - x-coordinate of lower left point of rectangle.
      aY1 - y-coordinate of lower left point of rectangle.
      aWidth1 - width of rectangle.
      aHeight1 - height of rectangle.
      aX2 - x-coordinate of lower left point of rectangle.
      aY2 - y-coordinate of lower left point of rectangle.
      aWidth2 - width of rectangle.
      aHeight2 - height of rectangle.
      Returns:
      true if the two 2D rectangles intersect, false otherwise.
    • overlaps2DSR

      public static boolean overlaps2DSR(double aX1, double aY1, double aWidth1, double aHeight1, double aX2, double aY2, double aWidth2, double aHeight2)
      Checks whether two 2D rectangles overlap.
      Parameters:
      aX1 - x-coordinate of lower left point of rectangle.
      aY1 - y-coordinate of lower left point of rectangle.
      aWidth1 - width of rectangle.
      aHeight1 - height of rectangle.
      aX2 - x-coordinate of lower left point of rectangle.
      aY2 - y-coordinate of lower left point of rectangle.
      aWidth2 - width of rectangle.
      aHeight2 - height of rectangle.
      Returns:
      true if the two 2D rectangles overlap, false otherwise.
    • overlaps2DSRLowLeft

      public static boolean overlaps2DSRLowLeft(double aX1, double aY1, double aWidth1, double aHeight1, double aX2, double aY2, double aWidth2, double aHeight2)
      Checks whether two 2D rectangles overlap. It includes the lower and left border for overlap, but excludes the upper and right border.
      Parameters:
      aX1 - x-coordinate of lower left point of rectangle.
      aY1 - y-coordinate of lower left point of rectangle.
      aWidth1 - width of rectangle.
      aHeight1 - height of rectangle.
      aX2 - x-coordinate of lower left point of rectangle.
      aY2 - y-coordinate of lower left point of rectangle.
      aWidth2 - width of rectangle.
      aHeight2 - height of rectangle.
      Returns:
      true if they overlap, false otherwise.
    • contains2DSR

      public static boolean contains2DSR(double aX1, double aY1, double aWidth1, double aHeight1, double aX2, double aY2, double aWidth2, double aHeight2)
      Checks whether a 2D rectangle contains another rectangle.
      Parameters:
      aX1 - x-coordinate of lower left point of rectangle.
      aY1 - y-coordinate of lower left point of rectangle.
      aWidth1 - width of rectangle.
      aHeight1 - height of rectangle.
      aX2 - x-coordinate of lower left point of rectangle.
      aY2 - y-coordinate of lower left point of rectangle.
      aWidth2 - width of rectangle.
      aHeight2 - height of rectangle.
      Returns:
      true if the first 2D rectangle contains the second one, false otherwise.
    • rectangleContains2D

      public static boolean rectangleContains2D(double aX, double aY, double aStartPointX, double aStartPointY, double aEndPointX, double aEndPointY, double aWidth)
      Checks whether the rectangle contains the 2D point aX,aY. The rectangle is defined by the line segment (aStartPoint,aEndPoint) as axis and aWidth as width. Half of the rectangle lies left of the axis, the other half at the right side of the axis.
      Parameters:
      aX - x-coordinate of point to test.
      aY - y-coordinate of point to test.
      aStartPointX - x-coordinate of start axis-point.
      aStartPointY - y-coordinate of start axis-point.
      aEndPointX - x-coordinate of end axis-point.
      aEndPointY - y-coordinate of end axis-point.
      aWidth - width of the (rotated) rectangle.
      Returns:
      true if the rectangle contains the 2D point, false otherwise.
    • simpleRectangleContains2D

      public static boolean simpleRectangleContains2D(double aX, double aY, double aPointX, double aPointY, double aWidth, double aHeight)
      Checks whether the 2D rectangle defined by the point (aPointX,aPointY), the width aWidth, and the height aHeight contains the 2D point (aX,aY).
      Parameters:
      aX - x-coordinate of point to test.
      aY - y-coordinate of point to test.
      aPointX - x-coordinate of lower left point of rectangle.
      aPointY - t-coordinate of lower left point of rectangle.
      aWidth - width of the rectangle.
      aHeight - height of the rectangle.
      Returns:
      true if the 2D rectangle contains the 2D point, false otherwise.
    • bufferContour2DOfSegmentSFCT

      public static void bufferContour2DOfSegmentSFCT(ILcdPoint aStartPoint, ILcdPoint aEndPoint, double aWidth, ILcd2DEditablePoint[] a2DEditablePointArraySFCT)
      Calculates the contour of the rectangle defined by aStartPoint, aEndPoint, and aWidth, as an array of ILcd2DEditablePoint objects. The ordering of the points of the contour is clockwise starting from the first point of the rectangle.

      An alternative implementation based on ILcdGeoBuffer objects is provided by computeBufferContour2D, which offers more flexibility regarding the contour representation at the end points (see ILcdGeoBuffer.getEndCapStyle).

      Parameters:
      aStartPoint - start axis point of the buffer segment.
      aEndPoint - end axis point of the buffer segment.
      aWidth - width of the buffer segment.
      a2DEditablePointArraySFCT - an initialized array of 4 ILcd2DEditablePoint which will contain the polygon.
    • contour2DOfBoundsSFCT

      public static void contour2DOfBoundsSFCT(ILcdBounds aBounds, ILcd2DEditablePoint[] a2DEditablePointArraySFCT)
      Calculates the contour of the given ILcdBounds, as an array of ILcd2DEditablePoint objects.
      Parameters:
      aBounds - an ILcdBounds 2D rectangle.
      a2DEditablePointArraySFCT - an initialized array of 4 ILcd2DEditablePoint objects which will contain the contour.
    • bufferContour2DOf2DPolyline

      public static void bufferContour2DOf2DPolyline(ILcdPointList aPointList, double aWidth, double aRadius, ILcd2DEditablePoint[] a2DEditablePointArraySFCT)
      Deprecated.
      Use bufferContour2DOf2DPolyline without the aRadius parameter instead.
      Calculates the contour of the buffer/corridor along a given ILcd2DEditablePolyline at a given width.
      Parameters:
      aPointList - axis of the buffer.
      aWidth - the Euclidian distance corresponding to the width of the buffer to be found along a2DPolyline.
      aRadius - Not used! The reason of the deprecation of this method.
      a2DEditablePointArraySFCT - an initialized array of a2DPolyline.countPoint * 2 ILcd2DEditablePoint objects which will contain the contour.
    • bufferContour2DOf2DPolyline

      public static void bufferContour2DOf2DPolyline(ILcdPointList aPointList, double aWidth, ILcd2DEditablePoint[] a2DEditablePointArraySFCT)
      Calculates the contour of the buffer/corridor along a given ILcd2DEditablePolyline at a given width. The ordering of the points of the contour is clockwise starting from the first point of the rectangle.

      This implementation has the following limitations:

      • contours with holes (i.e., caused by axis intersections) cannot be represented, since the contour is modeled as an ILcd2DEditablePoint array,
      • the corners of the contour at the axis points are sharp instead of rounded, which make it less suitable for buffers that have sharp angles between its consecutive axis segments; it has also has as consequence that the distance between the contour and the axis exceeds the given buffer distance in the corners.
      For an improved calculation of a buffer contour that overcomes these limitations, please refer to TLcdCartesian#computeBufferContour2D.
      Parameters:
      aPointList - axis of the buffer.
      aWidth - the Euclidian distance corresponding to the width of the buffer to be found along a2DPolyline.
      a2DEditablePointArraySFCT - an initialized array of a2DPolyline.countPoint * 2 ILcd2DEditablePoint objects which will contain the contour.
    • containsAngle

      public static boolean containsAngle(double aStartAngle, double aArcAngle, double aTargetAngle)
      Checks whether the angle aTargetAngle lies within the arc segment starting at aStartAngle extending over aArcAngle. All angles are in decimal degrees positive COUNTERCLOCKWISE.
      Parameters:
      aStartAngle - the start angle of the arc interval (decimal degrees).
      aArcAngle - the arc extent of the arc interval (decimal degrees).
      aTargetAngle - the angle to test (decimal degrees).
      Returns:
      true if aTargetAngle lies within the arc segment.
    • normalizeAngle

      public static double normalizeAngle(double aAngle)
      Normalizes aAngle to the interval ]-180, 180].
      Parameters:
      aAngle - angle to normalize (degrees).
      Returns:
      the normalized angle.
    • arcContains2D

      public static boolean arcContains2D(double aCenterX, double aCenterY, double aMajorAxis, double aMinorAxis, double aRotAngle, double aStartAngle, double aArcAngle, double aX, double aY)
      Returns whether a point lies on the elliptical arc segment. Angles are measured from the 3 o'clock position, positive counter-clockwise.
      Parameters:
      aCenterX - x-coordinate of the center point of the elliptical arc.
      aCenterY - y-coordinate of the center point of the elliptical arc.
      aMajorAxis - the major axis of the ellipse.
      aMinorAxis - the minor axis of the ellipse.
      aRotAngle - the rotation of the major axis (decimal degrees).
      aStartAngle - the start angle of the elliptical arc segment (decimal degrees).
      aArcAngle - the elliptical arc extent (decimal degrees).
      aX - x-coordinate of the point to be tested.
      aY - y-coordinate of the point to be tested.
      Returns:
      whether a point lies on the elliptical arc segment.
    • ellipseContains2D

      public static boolean ellipseContains2D(double aCenterX, double aCenterY, double aMajorAxis, double aMinorAxis, double aRotAngle, double aX, double aY)
      Returns whether a point lies within an ellipse. Angles are measured from the 3 o'clock position, positive counter-clockwise.
      Parameters:
      aCenterX - x-coordinate of the center point of the elliptical arc.
      aCenterY - y-coordinate of the center point of the elliptical arc.
      aMajorAxis - the major axis of the ellipse.
      aMinorAxis - the minor axis of the ellipse.
      aRotAngle - the rotation of the major axis (decimal degrees).
      aX - x-coordinate of the point to be tested.
      aY - y-coordinate of the point to be tested.
      Returns:
      whether a point lies within an ellipse.
    • computeBufferContour2D

      public static ILcdComplexPolygon computeBufferContour2D(ILcdGeoBuffer aBuffer)
      Calculates the contour of an ILcdGeoBuffer in the cartesian space. Only ILcdGeoBuffer objects with a base shape of the type ILcdPolyline, ILcdPolygon, ILcdComplexPolygon or ILcdPoint are supported.

      By definition, the contour of the buffer is constructed by creating a closed polygon around the axis, in which each point lies at a distance equal to the width from the axis - except for the end points, which can have a custom style (see ILcdGeoBuffer.getEndCapStyle()). The contour is modeled as a complex polygon (i.e., a composite polygon consisting of one or more polygons that each define an edge of the contour). In the simplest form, the contour is represented by a single polygon. In cases where the buffer intersects with itself, holes are formed and multiple polygons are used to define the contour.

      Parameters:
      aBuffer - the buffer for which the contour must be calculated.
      Returns:
      the contour of the buffer.
    • computeInsidePoint

      public static boolean computeInsidePoint(ILcdPointList aPointList, ILcd2DEditablePoint aInsidePointSFCT)
      Computes a point in the interior of the polygon defined by the given point list. The resulting point is guaranteed to be contained by the polygon.
      Parameters:
      aPointList - the polygon in which a point should be computed
      aInsidePointSFCT - side effect parameter that receives the coordinates of the point
      See Also:
    • computeInsidePoint

      public static boolean computeInsidePoint(ILcdPointList aPointList, List<? extends ILcdPointList> aExcludedPointLists, ILcd2DEditablePoint aInsidePointSFCT)
      Computes a point in the interior of the polygon defined by the given point list. The resulting point is guaranteed to be inside the given polygon, but not inside the excluded polygons.
      Parameters:
      aPointList - a polygon, defined as a point list
      aExcludedPointLists - a list of polygons that should be excluded from the result. I.e. the resulting point is guaranteed not to lie inside one of these polygons.
      aInsidePointSFCT - the point in which the result will be stored.
      Returns:
      returns if a point could be computed.
    • cartesianPointSFCT

      public static void cartesianPointSFCT(ILcdPoint aP1, ILcdPoint aP2, double aFraction, ILcd3DEditablePoint aPointSFCT)
      Interpolates linearly between the two given points.
      Parameters:
      aP1 - the first point
      aP2 - the second point
      aFraction - the distance between the first point and the interpolated point relative to the distance between the first and the second point.
      aPointSFCT - the linearly interpolated point on return of the method
    • cartesianPointSFCT

      public static void cartesianPointSFCT(ILcdPoint aPoint, double aDistance, double aAzimuth, ILcd2DEditablePoint aPointSFCT)
      Determines the point on the cartesian line through (aP1.getX(), aP1.getY()) located at a distance aDistance and forward azimuth aAzimuth.
      Parameters:
      aPoint - ILcdPoint on the ellipsoid.
      aDistance - distance expressed in meters.
      aAzimuth - forward azimuth expressed in degrees (zero maps to the north).
      aPointSFCT - side effect parameter that contains the result upon return of the method.
      Since:
      2019.0
    • areCollinear2D

      public static boolean areCollinear2D(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3)
      Checks whether the given points are collinear, which means they lie on a single line.
      Parameters:
      aP1 - the first point.
      aP2 - the second point.
      aP3 - the third point.
      Returns:
      true if the given points are collinear, false otherwise.
      Since:
      2021.1
    • areCollinear2D

      public static boolean areCollinear2D(double aX1, double aY1, double aX2, double aY2, double aX3, double aY3)
      Checks whether the points with the given coordinates are collinear, which means they lie on a single line.
      Parameters:
      aX1 - x-coordinate of the first point.
      aY1 - y-coordinate of the first point.
      aX2 - x-coordinate of the second point.
      aY2 - y-coordinate of the second point.
      aX3 - x-coordinate of the third point.
      aY3 - y-coordinate of the third point.
      Returns:
      true if the given points are collinear, false otherwise.
      Since:
      2021.1