ARKit中文文档

ARAnchor.h

ARAnchor : NSObject <NSCopying, NSSecureCoding> API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

表示3D空间中物理位置和方向的对象

  • 属 性
属性 属性 备注 SDK版本
NSUUID *identifier 锚的唯一标识符 iOS11.4
matrix_float4x4 transform 转换矩阵,用于定义锚点在世界坐标中的旋转,平移和缩放 iOS11.4

* 方 法

方法 说明 备注 SDK版本
- (instancetype)initWithTransform:(matrix_float4x4)transform 初始化一个新的锚点对象 iOS11.4
- (instancetype)init NS_UNAVAILABLE iOS11.4
+ (instancetype)new NS_UNAVAILABLE iOS11.4

* ARTrackable协 议

正在跟踪的场景中的真实世界对象或位置

  • 属 性

属性 属性 备注 SDK版本
BOOL isTracked 跟踪锚的状态 isTracked值用于确定锚变换的有效性。当不再检测到被跟踪的对象时相机图像,其锚点将返回NO为isTracked iOS11.4

ARCamera.h

ARAnchor : NSObject <NSCopying, NSSecureCoding> API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

  • ARTrackingState API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

描述摄像机跟踪状态的值

  • 属 性
属性 说明 备注 SDK版本
ARTrackingStateNotAvailable 跟踪不可用 iOS11.4
ARTrackingStateLimited 跟踪是有限的。请参阅跟踪原因了解详情 iOS11.4
ARTrackingStateNormal 跟踪是正常的 iOS11.4

* ARTrackingStateReason

描述相机跟踪状态受限的原因

  • 属 性
属性 说明 备注 SDK版本
ARTrackingStateReasonNone 跟踪不受限制 iOS11.4
ARTrackingStateReasonInitializing 由于正在进行初始化,跟踪受到限制 iOS11.4
ARTrackingStateReasonExcessiveMotion 由于相机的过度运动,跟踪受到限制 iOS11.4
ARTrackingStateReasonInsufficientFeatures 由于缺少相机可见的功能,因此跟踪受到限制 iOS11.4
ARTrackingStateReasonRelocalizing 由于进行重新定位,跟踪受到限制 iOS11.4

ARCamera : NSObject <NSCopying> API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

表示相机及其参数的模型

  • 属 性
属性 说明 备注 SDK版本
matrix_float4x4 transform 转换矩阵,用于定义摄像机在世界坐标中的旋转和平移 iOS11.4
vector_float3 eulerAngles 相机的方向定义为欧拉角 此向量中的组件顺序与旋转轴匹配:1.间距(x分量)是绕节点x轴的旋转(以弧度表示)2.偏航(y分量)是绕节点y轴的旋转(以弧度表示)3.滚动(z分量)是绕节点的z轴旋转(以弧度表示)ARKit以与组件相反的顺序应用这些旋转:1.roll 2.yaw 3.pitch iOS11.4
ARTrackingState trackingState 相机的跟踪状态 iOS11.4
ARTrackingStateReason 摄像机当前跟踪状态的原因 iOS11.4
matrix_float3x3 intrinsics 相机内在的 矩阵具有以下内容:fx 0 px0 fy py 0 0 1 fx和fy是以像素为单位的焦距。px和py是主要点的坐标,以像素为单位。原点位于左上角像素的中心。 iOS11.4
CGSize imageResolution 相机图像分辨率,以像素为单位 iOS11.4
matrix_float4x4 projectionMatrix 相机的投影矩阵 投影矩阵假设没有远剪裁平面限制 iOS11.4
- (CGPoint)projectPoint:(vector_float3)point orientation:(UIInterfaceOrientation)orientation viewportSize:(CGSize)viewportSize 将世界坐标系中的3D点投影到2D视口空间 iOS11.4
- (matrix_float4x4)projectionMatrixForOrientation:(UIInterfaceOrientation)orientation viewportSize:(CGSize)viewportSize zNear:(CGFloat)zNear zFar:(CGFloat)zFar 在给定渲染参数的情况下为相机创建投影矩阵 iOS11.4
- (matrix_float4x4)viewMatrixForOrientation:(UIInterfaceOrientation)orientation 给定界面方向,为摄像机创建视图矩阵 视图矩阵可用于将几何图形转换为给定方向的相机空间 iOS11.4

* 方 法

方法 说明 备注 SDK版本
- (instancetype)init iOS11.4
+ (instancetype)new iOS11.4

ARConfiguration.h

  • ARWorldAlignment API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

枚举常量用于指示世界对齐

  • 枚 举
常量 说明 备注 SDK版本
ARWorldAlignmentGravity 将世界与由矢量(0,-1,0)定义的重力对齐 iOS11.4
ARWorldAlignmentGravityAndHeading 将世界与由向量(0,-1,0)定义的重力对齐和向量(w.r.t. True North)由向量(0,0,-1)给出 iOS11.4
ARWorldAlignmentCamera 将世界与相机的方向对齐 iOS11.4

ARPlaneDetection API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

指示要检测的平面类型

  • 枚 举
常量 说明 备注 SDK版本
ARPlaneDetectionNone 没有运行平面检测 iOS11.4
ARPlaneDetectionHorizontal 平面检测确定场景中的水平平面 iOS11.4
ARPlaneDetectionVertical 平面检测确定场景中的垂直平面 iOS11.4

ARConfiguration : NSObject API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

  • 属 性
属性 说明 备注 SDK版本
BOOL isSupported 确定此设备是否支持ARConfiguration iOS11.4
NSArray<ARVideoFormat *> *supportedVideoFormats 此配置和设备支持的视频格式列表 列表中的第一个元素是会话输出的默认格式API_AVAILABLE(ios(11.3)) iOS11.4
ARVideoFormat *videoFormat 会话输出的视频格式 API_AVAILABLE(ios(11.3)) iOS11.4
ARWorldAlignment worldAlignment 确定坐标系应如何与世界对齐 默认为ARWorldAlignmentGravity iOS11.4
BOOL lightEstimationEnabled 启用或禁用光估计 默认情况下启用 iOS11.4
BOOL providesAudioData 确定是否捕获和提供音频数据 默认情况下禁用 iOS11.4

* 方 法

方法 说明 备注 SDK版本
- (instancetype)init iOS11.4
+ (instancetype)new iOS11.4

ARWorldTrackingConfiguration : ARConfiguration API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

  • 属 性
属性 说明 备注 SDK版本
BOOL autoFocusEnabled 启用或禁用连续自动对焦 默认情况下启用 iOS11.4
ARPlaneDetection planeDetection 要在场景中检测的平面类型 如果设置,将继续检测新平面并随时更新。检测到的飞机将被添加到会话中。 如果设置,将继续检测新平面并随时更新。检测到的飞机将被添加到会话中。ARPlaneAnchor对象。如果合并了两个平面,则将删除较新的平面。默认为ARPlaneDetectionNone
NSSet<ARReferenceImage *> *detectionImages 要在场景中检测的图 如果设置会话将尝试检测指定的图像。检测到图像时,会将ARImageAnchor添加到会话中 iOS11.3

* 方 法

方法 说明 备注 SDK版本
- (instancetype)init iOS11.4
+ (instancetype)new NS_SWIFT_UNAVAILABLE(“Use init() instead”) iOS11.4

AROrientationTrackingConfiguration : ARConfiguration API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

用于运行方向跟踪的配置

  • 属 性
属性 说明 备注 SDK版本
BOOL autoFocusEnabled 启用或禁用连续自动对焦 默认情况下启用 iOS11.4

* 方 法

方法 说明 备注 SDK版本
- (instancetype)init API_AVAILABLE(ios(11.3)) iOS11.4
+ (instancetype)new iOS11.4

ARFaceTrackingConfiguration : ARConfiguration API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

  • 方 法

方法 说明 备注 SDK版本
- (instancetype)init API_AVAILABLE(ios(11.3)) iOS11.4
+ (instancetype)new NS_SWIFT_UNAVAILABLE(“Use init() instead”) iOS11.4

ARError.h

ARErrorCode

  • 属 性

属性 说明 备注 SDK版本
ARErrorCodeUnsupportedConfiguration 不支持的配置 iOS11.4
ARErrorCodeSensorUnavailable 无法运行会话所需的传感器 iOS11.4
ARErrorCodeSensorFailed 传感器无法提供所需的输入 iOS11.4
ARErrorCodeCameraUnauthorized 应用程序无权使用相机。用户可以在设置中更改此设置 iOS11.4
ARErrorCodeWorldTrackingFailed 世界跟踪遇到致命错误 iOS11.4
ARErrorCodeInvalidReferenceImage 参考图像无效 API_AVAILABLE(ios(11.3)) iOS11.4

ARFaceAnchor.h

ARBlendShapeLocation

混合面几何的形状位置,每个位置定义了可以用提供的系数移位的面部区域

  • 属 性
属性 说明 备注 SDK版本
ARBlendShapeLocationBrowDownLeft 眉毛下垂向左 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationBrowDownRight 眉毛下垂向右 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationBrowInnerUp 眉间向内 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationBrowOuterUpLeft 眉毛外向左 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationBrowOuterUpRight 眉毛外向右 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationCheekPuff 脸颊膨胀 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationCheekSquintLeft 向左斜视 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationCheekSquintRight 向右斜视 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationEyeBlinkLeft 眨左眼 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationEyeBlinkRight 眨右眼 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationEyeLookDownLeft 眼睛看左下 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationEyeLookDownRight 眼睛看右下 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationEyeLookInLeft 眼睛看左内 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationEyeLookInRight 眼睛看右内 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationEyeLookOutLeft 眼睛看左外 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationEyeLookOutRight 眼睛看右外 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationEyeLookUpLeft 眼睛看左上 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationEyeLookUpRight 眼睛看右上 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationEyeSquintLeft 眼睛斜视左 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationEyeSquintRight 眼睛斜视右 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationEyeWideLeft 左眼大 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationEyeWideRight 右眼大 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationJawForward 下巴向前 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationJawLeft 下巴向左 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationJawOpen 下巴开 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationJawRight 下巴向右 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationMouthClose 闭嘴 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationMouthDimpleLeft 嘴巴留下了左酒窝 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationMouthDimpleRight 嘴巴留下了右酒窝 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationMouthFrownLeft 嘴皱眉左 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationMouthFrownRight 嘴皱眉右 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationMouthFunnel 口漏斗 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationMouthLeft 嘴巴左 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationMouthLowerDownLeft 嘴低下左 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationMouthLowerDownRight 嘴低下右 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationMouthPressLeft 嘴按左 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationMouthPressRight 嘴按右 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationMouthPucker 嘴里褶皱 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationMouthRight 嘴巴右 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationMouthRollLower 嘴卷降低 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationMouthRollUpper 嘴巴上卷 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationMouthShrugLower 嘴向下 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationMouthShrugUpper 嘴向上 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationMouthSmileLeft 微笑向左 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationMouthSmileRight 微笑向右 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationMouthStretchLeft 口伸展左 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationMouthStretchRight 口伸展右 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationMouthUpperUpLeft 嘴上部左上 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationMouthUpperUpRight 嘴上部右上 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationNoseSneerLeft 鼻子冷笑左 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARBlendShapeLocationNoseSneerRight 鼻子冷笑右 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4

ARFaceAnchor : ARAnchor <ARTrackable> API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

表示面部及其几何形状的锚点

  • 属 性
属性 说明 备注 SDK版本
ARFaceGeometry *geometry 基于计算的混合形状更新面几何 iOS11.4
NSDictionary<ARBlendShapeLocation, NSNumber*> *blendShapes 每个混合形状位置的混合形状系数的字典 混合形状系数定义了面部特定位置的中性形状的位移量 iOS11.4

* 方 法

方法 说明 备注 SDK版本
    (instancetype)initWithTransform:(matrix_float4x4)transform
NS_UNAVAILABLE iOS11.4

ARFaceGeometry.h

ARFaceGeometry : NSObject<NSSecureCoding, NSCopying> API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

表示面部几何的对象,面几何将具有恒定数量的三角形和顶点,只更新帧到帧的顶点位置

  • 属 性
属性 说明 备注 SDK版本
NSUInteger vertexCount 几何体的网格顶点数 NS_REFINED_FOR_SWIFT iOS11.4
const vector_float3 *vertices 几何的网格顶点 NS_REFINED_FOR_SWIFT iOS11.4
NSUInteger textureCoordinateCount 面几何的纹理坐标数 iOS11.4
const vector_float2 *textureCoordinates 面几何的纹理坐标数 NS_REFINED_FOR_SWIFT iOS11.4
NSUInteger triangleCount 面几何的三角形数 iOS11.4
const int16_t *triangleIndices 几何的三角形索引 NS_REFINED_FOR_SWIFT iOS11.4

* 方 法

方法 说明 备注 SDK版本
- (nullable instancetype)initWithBlendShapes:(NSDictionary<ARBlendShapeLocation, NSNumber*> *)blendShapes 通过应用一组给定的混合形状系数来创建并返回面几何 iOS11.4
- (instancetype)init NS_UNAVAILABLE iOS11.4
+ (instancetype)new NS_UNAVAILABLE iOS11.4

ARSCNFaceGeometry : SCNGeometry

表示面部的SceneKit几何体

  • 方 法

方法 说明 备注 SDK版本
+ (nullable instancetype)faceGeometryWithDevice:(id<MTLDevice>)device 使用Metal设备创建新的面几何 iOS11.4
+ (nullable instancetype)faceGeometryWithDevice:(id<MTLDevice>)device fillMesh:(BOOL)fillMesh 使用Metal设备创建新的面几何 iOS11.4
- (void)updateFromFaceGeometry:(ARFaceGeometry *)faceGeometry 使用面几何的顶点更新几何 iOS11.4
- (instancetype)init iOS11.4
+ (instancetype)new iOS11.4

ARFrame.h

ARFrame : NSObject <NSCopying>

  • 属 性
属性 说明 备注 SDK版本
NSTimeInterval timestamp 标识帧的时间戳 iOS11.4
CVPixelBufferRef capturedImage 帧的捕获图像 iOS11.4
AVDepthData *capturedDepthData 帧的捕获深度数据 深度数据仅在捕获深度数据的帧上提供面部跟踪 iOS11.4
NSTimeInterval capturedDepthDataTimestamp 场景中的锚点列表 iOS11.4
ARCamera *camera 相机提供设备的位置和方向以及相机参数 iOS11.4
NSArray<ARAnchor *> *anchor 场景中的锚点列表 iOS11.4
ARLightEstimate *lightEstimate 表示场景中光线的光估计 如果没有光估计,则返回niliOS11.4
ARPointCloud *rawFeaturePoints 场景中的特征点与帧的原点有关 特征点仅适用于使用世界跟踪的配置 iOS11.4
  • 方 法

方法 说明 备注 SDK版本
- (NSArray<ARHitTestResult *> *)hitTest:(CGPoint)point types:(ARHitTestResultType)types 在帧中搜索与捕获图像中的点对应的对象 捕获图像的坐标空间中的2D点可以指沿线段的任何点。在3D坐标空间中。命中测试是在该线段中找到世界中的对象的过程 iOS11.4
- (CGAffineTransform)displayTransformForOrientation:(UIInterfaceOrientation)orientation viewportSize:(CGSize)viewportSize 返回提供的视口大小和方向的显示变换 显示变换可用于转换图像空间坐标系中的归一化点。捕获图像到视图坐标空间中的标准化点。变换提供正确的旋转和方面填充,用于以给定的方向和大小呈现捕获的图像 iOS11.4
- (instancetype)init NS_UNAVAILABLE iOS11.4
+ (instancetype)new NS_UNAVAILABLE iOS11.4

ARHitTestResult.h

ARHitTestResultType API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

命中测试结果类型的选项集

  • 枚 举
常量 说明 备注 SDK版本
ARHitTestResultTypeFeaturePoint 与最近的特征点相交的结果类型 iOS11.4
ARHitTestResultTypeEstimatedHorizontalPlane 结果类型来自与当前帧确定的水平平面估计相交 iOS11.4
ARHitTestResultTypeEstimatedVerticalPlane 结果类型来自与当前帧确定的垂直平面估计相交 API_AVAILABLE(ios(11.3)) iOS11.4
ARHitTestResultTypeExistingPlane 结果类型与现有平面锚点相交 iOS11.4
ARHitTestResultTypeExistingPlaneUsingGeometry 结果类型与现有平面锚点相交,同时考虑平面的几何图形 iOS11.4

ARHitTestResult : NSObject API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

在命中测试期间发现交叉点的结果

  • 属 性

属性 说明 备注 SDK版本
ARHitTestResultType type 命中测试结果的类型 iOS11.4
CGFloat distance 从相机到交叉点的距离(以米为单位) iOS11.4
matrix_float4x4 localTransform 用于定义交点的旋转,平移和比例的变换矩阵。相对于锚点或最近的特征点 iOS11.4
matrix_float4x4 worldTransform 用于定义交点的旋转,平移和比例的变换矩阵。相对于世界 iOS11.4
ARAnchor *anchor 击中测试相交的锚点 仅为现有的平面结果类型提供锚点 iOS11.4
- (instancetype)init NS_UNAVAILABLE iOS11.4
+ (instancetype)new NS_UNAVAILABLE iOS11.4

ARImageAnchor.h

ARImageAnchor : ARAnchor API_AVAILABLE(ios(11.3)) API_UNAVAILABLE(macos, watchos, tvos)

代表世界图像的锚

  • 属 性
属性 说明 备注 SDK版本
ARReferenceImage *referenceImage 参考检测到的图像 iOS11.4

* 方 法

方法 说明 备注 SDK版本
- (instancetype)initWithTransform:(matrix_float4x4)transform NS_UNAVAILABLE iOS11.4

ARLightEstimate.h

ARLightEstimate : NSObject API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

表示场景中光线的光估计

  • 属 性
属性 说明 备注 SDK版本
CGFloat ambientIntensity 照明的环境强度 在光线充足的环境中,此值接近1000.通常范围从0(非常暗)到2000左右(非常明亮) iOS11.4
CGFloat ambientColorTemperature 照明的环境色温 这指定了以开尔文为单位的照明的环境色温(6500对应于纯白色) iOS11.4

* 方 法

方法 说明 备注 SDK版本
- (instancetype)init NS_UNAVAILABLE iOS11.4
+ (instancetype)new NS_UNAVAILABLE iOS11.4

ARDirectionalLightEstimate : ARLightEstimate API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

定向光估计,表示场景中的光强度和方向

  • 属 性

属性 说明 备注 SDK版本
NSData *sphericalHarmonicsCoefficients 表示光强度的二度球谐函数系数 该数据是27个32位浮点值的数组,包含三个非交错数据集,对应的红色,绿色和蓝色系数集 iOS11.4
vector_float3 primaryLightDirection 光的主要方向 iOS11.4
CGFloat primaryLightIntensity 主要方向的光强度 iOS11.4

ARPlaneAnchor.h

ARPlaneAnchorAlignment API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

描述平面锚点对齐的值

  • 枚 举
常量 说明 备注 SDK版本
ARPlaneAnchorAlignmentHorizontal 相对于重力水平的平面 iOS11.4
ARPlaneAnchorAlignmentVertical 垂直于重力的平面 API_AVAILABLE(ios(11.3)) iOS11.4

ARPlaneAnchor : ARAnchor API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

代表世界平面的锚(平面在X和Z方向上定义,其中Y是表面的法线)

  • 属 性
属性 说明 备注 SDK版本
ARPlaneAnchorAlignment alignment 平面的对齐 iOS11.4
vector_float3 center 锚点坐标空间中平面的中心 iOS11.4
vector_float3 extent 锚点坐标空间中平面的范围 iOS11.4
ARPlaneGeometry *geometry 锚点坐标空间中平面的几何 API_AVAILABLE(ios(11.3)) iOS11.4

* 方 法

方法 说明 备注 SDK版本
- (instancetype)initWithTransform:(matrix_float4x4)transform NS_UNAVAILABLE iOS11.4

ARPlaneGeometry : NSObject<NSSecureCoding> API_AVAILABLE(ios(11.3))

表示平面几何的对象(平面几何体将具有越来越多的三角形,和顶点从一帧到另一帧更新)

  • 属 性
属性 说明 备注 SDK版本
NSUInteger vertexCount 几何体的网格顶点数 只读 iOS11.4
const vector_float3 *vertices 几何体的网格顶点 只读 iOS11.4
NSUInteger textureCoordinateCount 几何体的纹理坐标数 只读 iOS11.4
const vector_float2 *textureCoordinates 几何体的纹理坐标 只读 iOS11.4
NSUInteger triangleCount 几何体的三角形数量 只读 iOS11.4
const int16_t *triangleIndices 几何体的三角形索引 只读 iOS11.4
NSUInteger boundaryVertexCount 几何体的边界顶点数 只读 iOS11.4
const vector_float3 *boundaryVertices 几何体最外边界的顶点 只读 iOS11.4

* 方 法

方法 说明 备注 SDK版本
- (instancetype)init NS_UNAVAILABLE iOS11.4
+ (instancetype)new NS_UNAVAILABLE iOS11.4

ARSCNPlaneGeometry : SCNGeometry API_AVAILABLE(ios(11.3))

  • 方 法

方法 说明 备注 SDK版本
+ (nullable instancetype)planeGeometryWithDevice:(id<MTLDevice>)device 使用Metal设备创建新的平面几何体 iOS11.4
- (void)updateFromPlaneGeometry:(ARPlaneGeometry *)planeGeometry 使用平面几何体的顶点更新几何体 iOS11.4

ARPointCloud.h

ARPointCloud : NSObject API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

  • 属 性
属性 说明 备注 SDK版本
NSUInteger count 点云中的点数 iOS11.4
const vector_float3 *points 包含点云的3D点 iOS11.4
const uint64_t *identifiers 包括点云的3D点标识符 iOS11.4

* 方 法

方法 说明 备注 SDK版本
- (instancetype)init NS_UNAVAILABLE iOS11.4
+ (instancetype)new NS_UNAVAILABLE iOS11.4

ARReferenceImage.h

ARReferenceImage : NSObject<NSCopying> API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

要在场景中检测的参考图像

  • 属 性
属性 说明 备注 SDK版本
NSString *name 用于标识图像的可选名称 iOS11.4
CGSize physicalSize 图像的物理尺寸,以米为单位 iOS11.4

* 方 法

方法 说明 备注 SDK版本
- (instancetype)initWithCGImage:(CGImageRef)image orientation:(CGImagePropertyOrientation)orientation physicalWidth:(CGFloat)physicalWidth 创建新的参考图像 iOS11.4
- (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer orientation:(CGImagePropertyOrientation)orientation physicalWidth:(CGFloat)physicalWidth 创建新的参考图像 iOS11.4
+ (nullable NSSet<ARReferenceImage *> *)referenceImagesInGroupNamed:(NSString *)name bundle:(nullable NSBundle *)bundle 返回指定资源组和包中的ARReferenceImages集 iOS11.4
- (instancetype)init NS_UNAVAILABLE iOS11.4
+ (instancetype)new NS_UNAVAILABLE iOS11.4

ARSCNView.h

ARSCNView : SCNView API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

将ARSession渲染集成到SceneKit中的视图(视图绘制相机背景,提供和更新相机,管理锚点的节点,并更新照明。)

  • 属 性
属性 说明 备注 SDK版本
id<ARSCNViewDelegate> delegate 指定渲染器代理 iOS11.4
ARSession *session 视图用于更新场景的会话 iOS11.4
SCNScene *scene 指定视图的场景 iOS11.4
BOOL automaticallyUpdatesLighting 确定视图是否将更新场景的光照 设置后,视图将自动为其创建和更新照明。光估计会话提供。默认为YES

* 方 法

方法 说明 备注 SDK版本
- (nullable ARAnchor *)anchorForNode:(SCNNode *)node 在场景层次结构中搜索与提供的节点关联的锚点 iOS11.4
- (nullable SCNNode *)nodeForAnchor:(ARAnchor *)anchor 返回已映射到特定锚点的节点 iOS11.4
- (NSArray<ARHitTestResult *> *)hitTest:(CGPoint)point types:(ARHitTestResultType)types 在当前帧中搜索与视图中的点对应的对象。视图坐标空间中的2D点可以指沿线段的任何点。在3D坐标空间中。命中测试是在该线段中找到世界中的对象的过程 iOS11.4

* 协 议

ARSCNViewDelegate <SCNSceneRendererDelegate, ARSessionObserver>代理

  • 方 法
方法 说明 备注 SDK版本
- (nullable SCNNode *)renderer:(id <SCNSceneRenderer>)renderer nodeForAnchor:(ARAnchor *)anchor 实现此目的以为给定锚提供自定义节点 此节点将自动添加到场景图中。如果未实现此方法,将自动创建节点。如果返回nil,则将忽略锚点 iOS11.4
- (void)renderer:(id <SCNSceneRenderer>)renderer didAddNode:(SCNNode *)node forAnchor:(ARAnchor *)anchor 在将新节点映射到给定锚点时调用 iOS11.4
- (void)renderer:(id <SCNSceneRenderer>)renderer willUpdateNode:(SCNNode *)node forAnchor:(ARAnchor *)anchor 在使用给定锚点的数据更新节点时调用 iOS11.4
- (void)renderer:(id <SCNSceneRenderer>)renderer didUpdateNode:(SCNNode *)node forAnchor:(ARAnchor *)anchor 使用给定锚点的数据更新节点时调用 iOS11.4
- (void)renderer:(id <SCNSceneRenderer>)renderer didRemoveNode:(SCNNode *)node forAnchor:(ARAnchor *)anchor 从已从给定锚点的场景图中删除映射节点时调用 iOS11.4

ARSCNDebugOptions API_AVAILABLE(ios(11.0))

ARSCNView扩展调试选项

  • 常 量

常量 说明 备注 SDK版本
ARSCNDebugOptionShowWorldOrigin 在场景中展示世界起源 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4
ARSCNDebugOptionShowFeaturePoints 在世界中显示检测到的3D要素点 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos) iOS11.4

ARSession.h

ARSessionRunOptions API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

运行会话的选项集(这些选项会改变在会话上调用run的行为。不提供选项将导致恢复跟踪的默认行为。从最后的已知位置并保留所有现有的锚点)

  • 常 量
常量 说明 备注 SDK版本
ARSessionRunOptionResetTracking 会话将重置跟踪 iOS11.4
ARSessionRunOptionRemoveExistingAnchors 会议将删除现有的锚点 iOS11.4

ARSession : NSObject API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

ARSession类在设备上配置和运行不同的增强现实技术

  • 属 性
属性 说明 备注 SDK版本
id <ARSessionDelegate> delegate 接收ARSession更新的代表 iOS11.4
dispatch_queue_t delegateQueue 执行委托调用的调度队列(如果未提供或为nil,则将在主队列上执行委托调用) iOS11.4
ARFrame *currentFrame 会话的当前帧 iOS11.4
ARConfiguration *configuration 会话当前使用的配置 iOS11.4

* 方 法

方法 说明 备注 SDK版本
- (void)runWithConfiguration:(ARConfiguration *)configuration 使用提供的配置运行会话(在已经启动的会话上调用run立即转换为使用新配置) iOS11.4
- (void)runWithConfiguration:(ARConfiguration *)configuration options:(ARSessionRunOptions)options 使用提供的配置和选项运行会话(在已经启动的会话上调用run立即转换为使用新配置。选项可用于在转换配置时更改默认行为) iOS11.4
- (void)pause 暂停会话(暂停后,将不再收到更新的更新会话直到再次调用run) iOS11.4
- (void)addAnchor:(ARAnchor *)anchor 向会话添加锚点(锚将添加到下一帧更新中) iOS11.4
- (void)removeAnchor:(ARAnchor *)anchor 从会话中删除锚点 锚将从后续帧更新中删除 iOS11.4
- (void)setWorldOrigin:(matrix_float4x4)relativeTransform NS_SWIFT_NAME(setWorldOrigin(relativeTransform:)) 将会话的世界原点设置为位置和方向由提供的转换指定 API_AVAILABLE(ios(11.3)) iOS11.4

* 协 议

ARSessionObserver <NSObject> API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

方法 说明 备注 SDK版本
- (void)session:(ARSession *)session didFailWithError:(NSError *)error 会话失败时调用此方法(如果失败,会话将暂停) iOS11.4
- (void)session:(ARSession *)session cameraDidChangeTrackingState:(ARCamera *)camera 当摄像机的跟踪状态发生变化时,会调用此方法 iOS11.4
- (void)sessionWasInterrupted:(ARSession *)session 会话中断时调用此方法 会话将被中断,不再能够跟踪何时,它无法接收所需的传感器数据。当视频捕获中断时会发生这种情况,例如,当应用程序发送到后台或有时多个前台应用程序(请参阅AVCaptureSessionInterruptionReason)。在中断结束之前,不会提供额外的帧更新。 iOS11.4
- (void)sessionInterruptionEnded:(ARSession *)session 会话中断结束时调用此方法 会话将从上次已知状态继续运行一次中断已经结束。如果设备已移动,则锚将未对齐。为避免这种情况,某些应用程序可能希望重置跟踪(请参阅ARSessionRunOptions)或尝试重新定位(参见- [ARSessionObserver sessionShouldAttemptRelocalization:])。 iOS11.4
- (BOOL)sessionShouldAttemptRelocalization:(ARSession *)session 在会话从暂停或中断恢复以确定之后调用此方法,会话是否应该尝试重新定位 为了避免未对齐的锚点,应用程序可能希望在之后尝试重定位会话暂停或中断。如果返回YES:会话将开始重新定位并且跟踪状态将切换到有限的原因重定位。如果成功的话,会话的跟踪状态将恢复正常。因为重定位取决于用户的位置,它可以无限期运行。希望放弃重定位的应用可以随时调用ARSessionRunOptionResetTracking运行 iOS11.4
- (void)session:(ARSession *)session didOutputAudioSampleBuffer:(CMSampleBufferRef)audioSampleBuffer 当会话输出新的音频样本缓冲区时调用此方法 iOS11.4

ARSessionDelegate <ARSessionObserver> API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

方法 说明 备注 SDK版本
- (void)session:(ARSession *)session didUpdateFrame:(ARFrame *)frame 更新新帧时调用此方法 iOS11.4
- (void)session:(ARSession *)session didAddAnchors:(NSArray<ARAnchor*>*)anchors 将新锚添加到会话时调用此方法 iOS11.4
- (void)session:(ARSession *)session didUpdateAnchors:(NSArray<ARAnchor*>*)anchors 将新锚添加到会话时调用此方法 iOS11.4
- (void)session:(ARSession *)session didRemoveAnchors:(NSArray<ARAnchor*>*)anchors 从会话中删除锚点时调用此方法 iOS11.4

ARSKView.h

  • 协议

ARSKViewDelegate <SKViewDelegate, ARSessionObserver> API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

方法 说明 备注 SDK版本
- (nullable SKNode *)view:(ARSKView *)view nodeForAnchor:(ARAnchor *)anchor 实现此目的以为给定锚提供自定义节点 此节点将自动添加到场景图中。如果未实现此方法,将自动创建节点。如果返回nil,则将忽略锚点。 iOS11.4
- (void)view:(ARSKView *)view didAddNode:(SKNode *)node forAnchor:(ARAnchor *)anchor 在将新节点映射到给定锚点时调用 iOS11.4
- (void)view:(ARSKView *)view willUpdateNode:(SKNode *)node forAnchor:(ARAnchor *)anchor 在使用给定锚点的数据更新节点时调用 iOS11.4
- (void)view:(ARSKView *)view didUpdateNode:(SKNode *)node forAnchor:(ARAnchor *)anchor 使用给定锚点的数据更新节点时调用 iOS11.4
- (void)view:(ARSKView *)view didRemoveNode:(SKNode *)node forAnchor:(ARAnchor *)anchor 从已从给定锚点的场景图中删除映射节点时调用 iOS11.4

ARSKView : SKView API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

将ARSession渲染集成到SpriteKit中的视图(视图绘制相机背景,并将锚点投影到地图并映射到节点)

属性 说明 备注 SDK版本
NSObject <ARSKViewDelegate> *delegate 指定视图的委托 iOS11.4
ARSession *session 视图用于更新视图的会话 iOS11.4

属性 说明 备注 SDK版本
- (nullable ARAnchor *)anchorForNode:(SKNode *)node 将ARSession渲染集成到SpriteKit中的视图 iOS11.4
- (nullable SKNode *)nodeForAnchor:(ARAnchor *)anchor 返回已映射到特定锚点的节点 iOS11.4
- (NSArray<ARHitTestResult *> *)hitTest:(CGPoint)point types:(ARHitTestResultType)types 在当前帧中搜索与视图中的点对应的对象 视图坐标空间中的2D点可以指沿线段的任何点。在3D坐标空间中。命中测试是在该线段中找到世界中的对象的过程 iOS11.4

ARVideoFormat : NSObject <NSCopying> API_AVAILABLE(ios(11.3))

  • 属性
属性 说明 备注 SDK版本
CGSize imageResolution 图像分辨率 iOS11.4
NSInteger framesPerSecond 帧率 iOS11.4

* 方 法

方法 说明 备注 SDK版本
- (instancetype)init NS_UNAVAILABLE iOS11.4
+ (instancetype)new NS_UNAVAILABLE iOS11.4

猜你喜欢

转载自blog.csdn.net/philm_ios/article/details/81036653