com.supermap.ar.areffect.preset
类 PresetUtils
- java.lang.Object
-
- com.supermap.ar.areffect.preset.PresetUtils
-
public class PresetUtils extends java.lang.Object
预置的工具类 主要方法: 在两点间(或在一个点集中)按间距插入点,返回点集
-
-
构造器概要
构造器 构造器和说明 PresetUtils()
-
方法概要
所有方法 静态方法 具体方法 限定符和类型 方法和说明 static java.lang.Integer
correctHitPoint(ARGeoVerticalRegion verticalRegion, Point3D targetPoint)
使用垂直面纠正碰撞点static Point3D
correctHitPoint(Point3D cameraPosition, Point3D currentHitPoint, java.util.List<Point3D> list)
纠正碰撞点位置static java.lang.Integer[]
correctHitPointBottom(ARGeoPrism geoPrism, Point3D targetPoint)
使用AR棱柱对象底面纠正碰撞点static java.lang.Integer[]
correctHitPointTop(ARGeoPrism geoPrism, Point3D targetPoint)
使用AR棱柱对象顶面纠正碰撞点static java.lang.Integer[]
correctHitPointVertical(ARGeoPrism geoPrism, Point3D targetPoint)
使用AR棱柱对象的侧面纠正碰撞点static java.util.List<Point3D>
genArcPoints(java.util.List<Point3D> points, float radius, int edgeNum)
根据圆角的半径和圆弧段数,在拐点处将拐点替换为弧段上的连续点static java.util.List<Point3D>
genNewPointsBySpacingDistance(java.util.List<Point3D> points, float spacingDistance)
根据固定的间隔距离spacingDistance和原有点集,生成新点集合static java.util.List<Point3D>
genNewPointsBySpacingDistance(Point3D a, Point3D b, float spacingDistance)
在两点间根据间距生成对应点集static java.util.List<Point3D>
genStripeLinePoints(java.util.List<Point3D> points, float lineWidth, float radius, int edgeNum)
根据折线点集生成平行与XOY面的可构成平滑宽线多边形的点集static java.util.List<Point3D>
genVerticalPoints(Point3D pointA, Point3D pointB, float width)
在平行XOY的平面上,获取垂直AB,且过端点AB,且距离为width的点集(AB不重合,共4个点) 3 --------- 2 \a---------b\ 0 --------- 1static java.util.List<Point3D>
getAllPointByHitResult(java.util.List<HitResult> hitResults)
根据ARCore的碰撞检测结果获取碰撞点坐标,可返回nullstatic Point3D
getCenterPoint(java.util.List<Point3D> sourceList)
从点集中获取中心点的位置static float
getCurrentCameraAzimuth(EffectView arView)
获取当前相机与相机启动时的夹角static java.util.List<Point3D>
getNonRepeatPoints(java.util.List<Point3D> list)
过滤前后相同的点static Point3D
getPointByHitResult(java.util.List<HitResult> hitResults0, HitTestMode hitTestMode)
根据ARCore的碰撞检测结果获取碰撞点坐标,可返回nullstatic Point3D
getPointByScreenRayTest(EffectBaseView arEffectBaseView, java.util.List<Point3D> list, float x, float y)
获取通过屏幕坐标生成的射线与list点集构成的平面的交点,返回值可为null 注意:当碰撞点,在朝向的后方也返回nullstatic Quaternion
getQuaternionByPoint3Ds(Point3D a, Point3D b, Point3D c)
获取不共线三点构成的平面相对水平面的旋转四元数static Quaternion
getQuaternionByVector(Vector v0, Vector v1)
获取单位向量V0旋转为单位向量V1的旋转四元数static Quaternion
getQuaternionByVector3(Vector3 v0, Vector3 v1)
获取单位向量V0旋转为单位向量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)
增加节点时,通过点击位置,判断是否增加节点,以及加在哪儿static int
getTouchNearPointIndex(Point3D p, java.util.List<Point3D> list)
获取一个点与一组点串,距离最近的点static boolean
isClockwiseAroundZ(java.util.ArrayList<Point3D> pointList, boolean status)
判断点集是否绕顺时针旋转static boolean
isInLineSegment(Point3D src, Point3D a, Point3D b)
判断src点是否在AB线段上static boolean
isInPolygon(Point3D src, java.util.List<Point3D> points, float tolerance)
判断空间中任意点,是否在空间某一平面上的多边形内static boolean
isInPolygon(Point src, java.util.List<Point> points)
判断平面上任意点,是否在空间某一平面上的多边形内
-
-
-
方法详细资料
-
isInPolygon
public static boolean isInPolygon(Point src, java.util.List<Point> points)
判断平面上任意点,是否在空间某一平面上的多边形内- 参数:
src
-points
- 首尾相连的点集- 返回:
-
isInPolygon
public static boolean isInPolygon(Point3D src, java.util.List<Point3D> points, float tolerance)
判断空间中任意点,是否在空间某一平面上的多边形内- 参数:
src
-points
- 首尾相连的点集tolerance
- 容限- 返回:
-
genStripeLinePoints
public static java.util.List<Point3D> genStripeLinePoints(java.util.List<Point3D> points, float lineWidth, float radius, int edgeNum)
根据折线点集生成平行与XOY面的可构成平滑宽线多边形的点集- 参数:
points
-lineWidth
-radius
-edgeNum
-- 返回:
-
genVerticalPoints
public static java.util.List<Point3D> genVerticalPoints(Point3D pointA, Point3D pointB, float width)
在平行XOY的平面上,获取垂直AB,且过端点AB,且距离为width的点集(AB不重合,共4个点) 3 --------- 2 \a---------b\ 0 --------- 1- 参数:
pointA
-pointB
-width
-- 返回:
-
genArcPoints
public static java.util.List<Point3D> genArcPoints(java.util.List<Point3D> points, float radius, int edgeNum)
根据圆角的半径和圆弧段数,在拐点处将拐点替换为弧段上的连续点- 参数:
points
-radius
-edgeNum
-- 返回:
-
getCenterPoint
public static Point3D getCenterPoint(java.util.List<Point3D> sourceList)
从点集中获取中心点的位置- 参数:
sourceList
-- 返回:
-
getQuaternionByVector
public static Quaternion getQuaternionByVector(Vector v0, Vector v1)
获取单位向量V0旋转为单位向量V1的旋转四元数- 参数:
v0
-v1
-- 返回:
-
getQuaternionByVector3
public static Quaternion getQuaternionByVector3(Vector3 v0, Vector3 v1)
获取单位向量V0旋转为单位向量V1的旋转四元数- 参数:
v0
-v1
-- 返回:
-
getQuaternionByPoint3Ds
public static Quaternion getQuaternionByPoint3Ds(Point3D a, Point3D b, Point3D c)
获取不共线三点构成的平面相对水平面的旋转四元数- 参数:
a
-b
-c
-- 返回:
-
correctHitPoint
public static Point3D correctHitPoint(Point3D cameraPosition, Point3D currentHitPoint, java.util.List<Point3D> list)
纠正碰撞点位置- 参数:
cameraPosition
- 相机位置currentHitPoint
- 源碰撞点list
- 碰撞对象的顶点(大于3个且不共线)- 返回:
-
getPointByScreenRayTest
public static Point3D getPointByScreenRayTest(EffectBaseView arEffectBaseView, java.util.List<Point3D> list, float x, float y)
获取通过屏幕坐标生成的射线与list点集构成的平面的交点,返回值可为null 注意:当碰撞点,在朝向的后方也返回null- 参数:
EffectBaseView
-list
- 碰撞对象的顶点(大于3个且不共线)x
- 屏幕x坐标值y
- 屏幕y坐标值- 返回:
-
correctHitPoint
public static java.lang.Integer correctHitPoint(ARGeoVerticalRegion verticalRegion, Point3D targetPoint)
使用垂直面纠正碰撞点- 参数:
verticalRegion
-targetPoint
-- 返回:
- 碰撞点位置所在part的索引
-
getPointByHitResult
public static Point3D getPointByHitResult(java.util.List<HitResult> hitResults0, HitTestMode hitTestMode)
根据ARCore的碰撞检测结果获取碰撞点坐标,可返回null- 参数:
hitResults0
-hitTestMode
-- 返回:
-
getAllPointByHitResult
public static java.util.List<Point3D> getAllPointByHitResult(java.util.List<HitResult> hitResults)
根据ARCore的碰撞检测结果获取碰撞点坐标,可返回null- 参数:
hitResults
-- 返回:
-
getCurrentCameraAzimuth
public static float getCurrentCameraAzimuth(EffectView arView)
获取当前相机与相机启动时的夹角- 参数:
arView
-- 返回:
-
getNonRepeatPoints
public static java.util.List<Point3D> getNonRepeatPoints(java.util.List<Point3D> list)
过滤前后相同的点- 参数:
list
-- 返回:
-
genNewPointsBySpacingDistance
public static java.util.List<Point3D> genNewPointsBySpacingDistance(Point3D a, Point3D b, float spacingDistance)
在两点间根据间距生成对应点集- 参数:
a
-b
-spacingDistance
-- 返回:
-
genNewPointsBySpacingDistance
public static java.util.List<Point3D> genNewPointsBySpacingDistance(java.util.List<Point3D> points, float spacingDistance)
根据固定的间隔距离spacingDistance和原有点集,生成新点集合- 参数:
points
-spacingDistance
-- 返回:
-
isInLineSegment
public static boolean isInLineSegment(Point3D src, Point3D a, Point3D b)
判断src点是否在AB线段上- 参数:
src
- 源点a
- 线段端点Ab
- 线段端点B- 返回:
- boolean
-
isClockwiseAroundZ
public static boolean isClockwiseAroundZ(java.util.ArrayList<Point3D> pointList, boolean status)
判断点集是否绕顺时针旋转- 参数:
pointList
- 点集status
- true时,表示首尾相连的点集- 返回:
- true时,为顺时针
-
getTouchNearPointIndex
public static int getTouchNearPointIndex(Point3D p, java.util.List<Point3D> list)
获取一个点与一组点串,距离最近的点- 参数:
p
- 点list
- 点集
-
getTouchNearPoint
public static InsertInfo getTouchNearPoint(Point3D p, java.util.List<Point3D> list)
增加节点时,通过点击位置,判断是否增加节点,以及加在哪儿- 参数:
p
- 点list
- 点集
-
correctHitPointVertical
public static java.lang.Integer[] correctHitPointVertical(ARGeoPrism geoPrism, Point3D targetPoint)
使用AR棱柱对象的侧面纠正碰撞点- 参数:
geoPrism
- AR棱柱对象targetPoint
- 相机前方的待校正的点- 返回:
- 碰撞点位置所在part的索引,对应part的对应顶点索引
-
correctHitPointBottom
public static java.lang.Integer[] correctHitPointBottom(ARGeoPrism geoPrism, Point3D targetPoint)
使用AR棱柱对象底面纠正碰撞点- 参数:
geoPrism
-targetPoint
-- 返回:
-
correctHitPointTop
public static java.lang.Integer[] correctHitPointTop(ARGeoPrism geoPrism, Point3D targetPoint)
使用AR棱柱对象顶面纠正碰撞点- 参数:
geoPrism
-targetPoint
-- 返回:
-
getScreenTouchNearPointIndex
public static int getScreenTouchNearPointIndex(android.graphics.Point p, java.util.List<android.graphics.Point> list)
获取触摸屏幕最近点序号- 参数:
p
-list
-- 返回:
-
-