com.supermap.ar.areffect.utils
Class ScreenPointTool
- java.lang.Object
-
- com.supermap.ar.areffect.utils.ScreenPointTool
-
public class ScreenPointTool extends java.lang.Object
Screen coordinate conversion tool AR coordinates => screen coordinates
-
-
Constructor Summary
Constructors Constructor and Description ScreenPointTool()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static <any>
convertToPixel(EffectView effectView, java.util.List<Point3D> point3DList)
Convert the AR scene coordinate set to screen pixel coordinatesstatic <any>
convertToPixel(EffectView effectView, java.util.List<Point3D> point3DList, boolean isModify)
Convert the AR scene coordinate set to screen pixel coordinatesstatic int[]
convertToScreenPoint(EffectView arView, Point3D point3D)
Converts the scene coordinates of points to screen coordinates that coordinate z is 0static int[]
convertToScreenPoint(EffectView arView, Vector3 vector3)
Converts the scene coordinates of points to screen coordinates that z-value is 0 Note: the origin of coordinates is the screen centerstatic Point2D
convertToScreenPoint2D(EffectView arView, Point3D point3D)
static int[][]
generateBounds(EffectView arView, java.util.List<Vector3> arVertexGroup)
Converts the vertex array on AR to the vertex of the maximum rectangle on the screen coordinates.static float
getDpScale(android.content.Context context)
Gets the ratio of dp value to the real scalestatic float
getScreenDensity(AREffectBaseView arEffectView)
Gets screen densitystatic int
getScreenDensityDPI(android.content.Context context)
Get the screen dpistatic float
getScreenHeight_DP(AREffectBaseView arEffectView)
Gets screen height Unit: dpstatic int
getScreenHeightPixel(android.content.Context context)
Gets the phone screen heightstatic float
getScreenWidth_DP(AREffectBaseView arEffectView)
Gets screen width Unit: dpstatic int
getScreenWidthPixel(android.content.Context context)
Gets the phone screen heightstatic Ray
screenPointToRay(AREffectBaseView arEffectView, int x, int y)
Converts screen coordinates to ray
-
-
-
Method Detail
-
convertToScreenPoint
public static int[] convertToScreenPoint(EffectView arView, Point3D point3D)
Converts the scene coordinates of points to screen coordinates that coordinate z is 0- Parameters:
point3D
-- Returns:
-
convertToScreenPoint2D
public static Point2D convertToScreenPoint2D(EffectView arView, Point3D point3D)
-
convertToScreenPoint
public static int[] convertToScreenPoint(EffectView arView, Vector3 vector3)
Converts the scene coordinates of points to screen coordinates that z-value is 0 Note: the origin of coordinates is the screen center- Parameters:
arView
-vector3
-- Returns:
-
generateBounds
public static int[][] generateBounds(EffectView arView, java.util.List<Vector3> arVertexGroup)
Converts the vertex array on AR to the vertex of the maximum rectangle on the screen coordinates. (bounds[0][0],bounds[0][1])----------------- | | | | -----------------(bounds[1][0],bounds[1][1])- Parameters:
arView
-arVertexGroup
-- Returns:
-
getScreenDensity
public static float getScreenDensity(AREffectBaseView arEffectView)
Gets screen density- Parameters:
arEffectView
-- Returns:
-
getDpScale
public static float getDpScale(android.content.Context context)
Gets the ratio of dp value to the real scale- Parameters:
context
-- Returns:
- 1 meter in the AR scene corresponds with how many dp value in a layout file
-
getScreenWidth_DP
public static float getScreenWidth_DP(AREffectBaseView arEffectView)
Gets screen width Unit: dp- Parameters:
arEffectView
-- Returns:
-
getScreenHeight_DP
public static float getScreenHeight_DP(AREffectBaseView arEffectView)
Gets screen height Unit: dp- Parameters:
arEffectView
-- Returns:
-
screenPointToRay
public static Ray screenPointToRay(AREffectBaseView arEffectView, int x, int y)
Converts screen coordinates to ray- Parameters:
arEffectView
-x
-y
-- Returns:
-
convertToPixel
public static <any> convertToPixel(EffectView effectView, java.util.List<Point3D> point3DList)
Convert the AR scene coordinate set to screen pixel coordinates- Parameters:
effectView
-point3DList
-- Returns:
- Screen coordinate set
-
getScreenHeightPixel
public static int getScreenHeightPixel(android.content.Context context)
Gets the phone screen height- Parameters:
context
-- Returns:
- height
-
getScreenWidthPixel
public static int getScreenWidthPixel(android.content.Context context)
Gets the phone screen height- Parameters:
context
-- Returns:
- Width
-
convertToPixel
public static <any> convertToPixel(EffectView effectView, java.util.List<Point3D> point3DList, boolean isModify)
Convert the AR scene coordinate set to screen pixel coordinates- Parameters:
effectView
- arViewpoint3DList
- Set of 3D points to be convertedisModify
- Whether to keep position mirroring- Returns:
- Screen coordinate set
-
getScreenDensityDPI
public static int getScreenDensityDPI(android.content.Context context)
Get the screen dpi- Parameters:
context
-- Returns:
-
-