com.supermap.ar.areffect.preset

Class PresetUtils

  • java.lang.Object
    • com.supermap.ar.areffect.preset.PresetUtils


  • public class PresetUtils
    extends java.lang.Object
    Predefined tool class Main function: Inserts points between two points (or a point set). Returns point set
    • Constructor Summary

      Constructors 
      Constructor and Description
      PresetUtils() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.lang.Integer correctHitPoint(ARGeoVerticalRegion verticalRegion, Point3D targetPoint)
      Correct impact points using the vertical plane
      static Point3D correctHitPoint(Point3D cameraPosition, Point3D currentHitPoint, java.util.List<Point3D> list)
      Corrects the position of the impact point
      static java.lang.Integer[] correctHitPointBottom(ARGeoPrism geoPrism, Point3D targetPoint)
      Correct collision points using the underside of the AR prism object
      static java.lang.Integer[] correctHitPointTop(ARGeoPrism geoPrism, Point3D targetPoint)
      Correct collision points using the top surface of the AR prism object
      static java.lang.Integer[] correctHitPointVertical(ARGeoPrism geoPrism, Point3D targetPoint)
      Correct collision points using the side of the AR prism object
      static java.util.List<Point3D> genArcPoints(java.util.List<Point3D> points, float radius, int edgeNum)
      Replaces the turning points with the continuous points on arcs at turning points according to the radius of rounded corner and the number of arcs
      static java.util.List<Point3D> genNewPointsBySpacingDistance(java.util.List<Point3D> points, float spacingDistance)
      Generates a new point set according to a certain interval spacingDistance and original point set
      static java.util.List<Point3D> genNewPointsBySpacingDistance(Point3D a, Point3D b, float spacingDistance)
      Generates the corresponding point set between two points according to the specified interval.
      static java.util.List<Point3D> genStripeLinePoints(java.util.List<Point3D> points, float lineWidth, float radius, int edgeNum)
      Generates point set that is used for composing polygon which is parallel with XOY according to polyline point set.
      static java.util.List<Point3D> genVerticalPoints(Point3D pointA, Point3D pointB, float width)
      In the plane parallel with XOY, gets the point set that is perpendicular to AB and passes AB and the distance is width (A doesn't overlap with B.
      static java.util.List<Point3D> getAllPointByHitResult(java.util.List<HitResult> hitResults) 
      static Point3D getCenterPoint(java.util.List<Point3D> sourceList)
      Gets the position of center from point set
      static float getCurrentCameraAzimuth(AREffectBaseView arView)
      Gets the angle between the current camera and the camera when it enables
      static java.util.List<Point3D> getNonRepeatPoints(java.util.List<Point3D> list)
      The same points before and after filtering
      static Point3D getPointByHitResult(java.util.List<HitResult> hitResults0, HitTestMode hitTestMode)
      Gets the coordinates of impact points according to the impact result of ARCore.
      static Point3D getPointByScreenRayTest(AREffectBaseView arEffectBaseView, java.util.List<Point3D> list, float x, float y)
      Gets the intersection points of the rays that are generated from the screen coordinates and the plane composed of list point set.
      static Quaternion getQuaternionByPoint3Ds(Point3D a, Point3D b, Point3D c)
      Gets the rotation quaternion of the plane composed of three points relative to horizontal plane
      static Quaternion getQuaternionByVector(Vector v0, Vector v1)
      Gets the rotation quaternion of unit vector V0 rotated to unit vector V1
      static Quaternion getQuaternionByVector3(Vector3 v0, Vector3 v1)
      Gets the rotation quaternion of unit vector V0 rotated to unit vector V1
      static int getScreenTouchNearPointIndex(android.graphics.Point p, java.util.List<android.graphics.Point> list) 
      static InsertInfo getTouchNearPoint(Point3D p, java.util.List<Point3D> list)
      To add a node, click the location to determine whether to add a node and where to add it
      static int getTouchNearPointIndex(Point3D p, java.util.List<Point3D> list)
      Gets the closest point to a string of points
      static boolean isClockwiseAroundZ(java.util.ArrayList<Point3D> pointList, boolean status)
      Determine whether the set of points rotates clockwise
      static boolean isInLineSegment(Point3D src, Point3D a, Point3D b)
      Check whether SRC is on the AB line segment
      static boolean isInPolygon(Point3D src, java.util.List<Point3D> points, float tolerance)
      Determines whether a point in a space falls in a polygon in a plane of the space
      static boolean isInPolygon(Point src, java.util.List<Point> points)
      Determines whether a point falls in a polygon in a plane
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PresetUtils

        public PresetUtils()
    • Method Detail

      • isInPolygon

        public static boolean isInPolygon(Point src,
                                          java.util.List<Point> points)
        Determines whether a point falls in a polygon in a plane
        Parameters:
        src -
        points - End-to-end point set
        Returns:
      • isInPolygon

        public static boolean isInPolygon(Point3D src,
                                          java.util.List<Point3D> points,
                                          float tolerance)
        Determines whether a point in a space falls in a polygon in a plane of the space
        Parameters:
        src -
        points - End-to-end point set
        tolerance - The tolerance
        Returns:
      • genStripeLinePoints

        public static java.util.List<Point3D> genStripeLinePoints(java.util.List<Point3D> points,
                                                                  float lineWidth,
                                                                  float radius,
                                                                  int edgeNum)
        Generates point set that is used for composing polygon which is parallel with XOY according to polyline point set.
        Parameters:
        points -
        lineWidth -
        radius -
        edgeNum -
        Returns:
      • genVerticalPoints

        public static java.util.List<Point3D> genVerticalPoints(Point3D pointA,
                                                                Point3D pointB,
                                                                float width)
        In the plane parallel with XOY, gets the point set that is perpendicular to AB and passes AB and the distance is width (A doesn't overlap with B. The total number of points is 4) 3 --------- 2 \a---------b\ 0 --------- 1
        Parameters:
        pointA -
        pointB -
        width -
        Returns:
      • genArcPoints

        public static java.util.List<Point3D> genArcPoints(java.util.List<Point3D> points,
                                                           float radius,
                                                           int edgeNum)
        Replaces the turning points with the continuous points on arcs at turning points according to the radius of rounded corner and the number of arcs
        Parameters:
        points -
        radius -
        edgeNum -
        Returns:
      • getCenterPoint

        public static Point3D getCenterPoint(java.util.List<Point3D> sourceList)
        Gets the position of center from point set
        Parameters:
        sourceList -
        Returns:
      • getQuaternionByVector

        public static Quaternion getQuaternionByVector(Vector v0,
                                                       Vector v1)
        Gets the rotation quaternion of unit vector V0 rotated to unit vector V1
        Parameters:
        v0 -
        v1 -
        Returns:
      • getQuaternionByVector3

        public static Quaternion getQuaternionByVector3(Vector3 v0,
                                                        Vector3 v1)
        Gets the rotation quaternion of unit vector V0 rotated to unit vector V1
        Parameters:
        v0 -
        v1 -
        Returns:
      • getQuaternionByPoint3Ds

        public static Quaternion getQuaternionByPoint3Ds(Point3D a,
                                                         Point3D b,
                                                         Point3D c)
        Gets the rotation quaternion of the plane composed of three points relative to horizontal plane
        Parameters:
        a -
        b -
        c -
        Returns:
      • correctHitPoint

        public static Point3D correctHitPoint(Point3D cameraPosition,
                                              Point3D currentHitPoint,
                                              java.util.List<Point3D> list)
        Corrects the position of the impact point
        Parameters:
        cameraPosition - Camera position
        currentHitPoint - source impact point
        list - the vertexes of the impact object (the vertex counts are bigger than 3 and not in the same line)
        Returns:
      • getPointByScreenRayTest

        public static Point3D getPointByScreenRayTest(AREffectBaseView arEffectBaseView,
                                                      java.util.List<Point3D> list,
                                                      float x,
                                                      float y)
        Gets the intersection points of the rays that are generated from the screen coordinates and the plane composed of list point set. The returned value can be null Note: when the impact point is toward the rear of the orientation, returns null.
        Parameters:
        arEffectBaseView -
        list - the vertexes of the impact object (the vertex counts are bigger than 3 and not in the same line)
        x - x coordinate of screen
        y - y coordinate of screen
        Returns:
      • correctHitPoint

        public static java.lang.Integer correctHitPoint(ARGeoVerticalRegion verticalRegion,
                                                        Point3D targetPoint)
        Correct impact points using the vertical plane
        Parameters:
        verticalRegion -
        targetPoint -
        Returns:
        index of part where the impact points locate
      • getPointByHitResult

        public static Point3D getPointByHitResult(java.util.List<HitResult> hitResults0,
                                                  HitTestMode hitTestMode)
        Gets the coordinates of impact points according to the impact result of ARCore. The function can return null
        Parameters:
        hitResults0 -
        hitTestMode -
        Returns:
      • getAllPointByHitResult

        public static java.util.List<Point3D> getAllPointByHitResult(java.util.List<HitResult> hitResults)
      • getCurrentCameraAzimuth

        public static float getCurrentCameraAzimuth(AREffectBaseView arView)
        Gets the angle between the current camera and the camera when it enables
        Parameters:
        arView -
        Returns:
      • getNonRepeatPoints

        public static java.util.List<Point3D> getNonRepeatPoints(java.util.List<Point3D> list)
        The same points before and after filtering
        Parameters:
        list -
        Returns:
      • genNewPointsBySpacingDistance

        public static java.util.List<Point3D> genNewPointsBySpacingDistance(Point3D a,
                                                                            Point3D b,
                                                                            float spacingDistance)
        Generates the corresponding point set between two points according to the specified interval.
        Parameters:
        a -
        b -
        spacingDistance -
        Returns:
      • genNewPointsBySpacingDistance

        public static java.util.List<Point3D> genNewPointsBySpacingDistance(java.util.List<Point3D> points,
                                                                            float spacingDistance)
        Generates a new point set according to a certain interval spacingDistance and original point set
        Parameters:
        points -
        spacingDistance -
        Returns:
      • isInLineSegment

        public static boolean isInLineSegment(Point3D src,
                                              Point3D a,
                                              Point3D b)
        Check whether SRC is on the AB line segment
        Parameters:
        src - Source point
        a - End of line segment A
        b - End of line segment B
        Returns:
        boolean
      • isClockwiseAroundZ

        public static boolean isClockwiseAroundZ(java.util.ArrayList<Point3D> pointList,
                                                 boolean status)
        Determine whether the set of points rotates clockwise
        Parameters:
        pointList - collection of points
        status - true represents a set of points end to end
        Returns:
        true,clockwise
      • getTouchNearPointIndex

        public static int getTouchNearPointIndex(Point3D p,
                                                 java.util.List<Point3D> list)
        Gets the closest point to a string of points
      • getTouchNearPoint

        public static InsertInfo getTouchNearPoint(Point3D p,
                                                   java.util.List<Point3D> list)
        To add a node, click the location to determine whether to add a node and where to add it
      • correctHitPointVertical

        public static java.lang.Integer[] correctHitPointVertical(ARGeoPrism geoPrism,
                                                                  Point3D targetPoint)
        Correct collision points using the side of the AR prism object
        Parameters:
        geoPrism - AR Prismatic object
        targetPoint - Point in front of the camera to be corrected
        Returns:
        Index of the part where the collision point is located, corresponding to the corresponding vertex index of the part
      • correctHitPointBottom

        public static java.lang.Integer[] correctHitPointBottom(ARGeoPrism geoPrism,
                                                                Point3D targetPoint)
        Correct collision points using the underside of the AR prism object
        Parameters:
        geoPrism -
        targetPoint -
        Returns:
      • correctHitPointTop

        public static java.lang.Integer[] correctHitPointTop(ARGeoPrism geoPrism,
                                                             Point3D targetPoint)
        Correct collision points using the top surface of the AR prism object
        Parameters:
        geoPrism -
        targetPoint -
        Returns:
      • getScreenTouchNearPointIndex

        public static int getScreenTouchNearPointIndex(android.graphics.Point p,
                                                       java.util.List<android.graphics.Point> list)