ARPlaneAnchor

Information about the position and orientation of a real-world flat surface detected in a world-tracking AR session.

关于在世界跟踪AR Session中检测到的真实世界平面的位置和方向的信息。

Overview

When you run a world-tracking AR session whose planeDetection option is enabled, the session automatically adds to its list of anchors an ARPlaneAnchor object for each flat surface ARKit detects with the back-facing camera. Each plane anchor provides information about the estimated position and shape of the surface.

概述

当您运行启用了planeDetection选项的世界追踪AR Session时, Session会自动向ARKit使用后置摄像头检测到的每个平面的锚点列表添加一个ARPlaneAnchor对象。 每个平面锚点提供关于表面的估计位置和形状的信息。


                                 Determining Plane Orientation


alignment
The general orientation of the detected plane with respect to gravity.
检测到的平面相对于重力的大致方向。

ARPlaneAnchorAlignment
Values describing possible general orientations of a detected plane with respect to gravity.
描述检测平面相对于重力可能的总体方向的值。

Alignment Values

ARPlaneAnchorAlignmentHorizontal
The plane is perpendicular to gravity.
该平面垂直于重力。

Discussion

The transform property for a horizontal plane anchor includes no rotation about the x- or z-axis. Thus, using this anchor's transform to place a 3D model asset in your scene results in the model appearing "right side up".

讨论

水平平面锚点的transform属性不包含围绕x或z轴的旋转。 因此,使用此锚点的变换将3D模型资源放置在场景中会导致模型出现“右侧朝上”。

ARPlaneAnchorAlignmentVertical
The plane is parallel to gravity.
飞机与重力平行。

讨论

垂直平面锚点的transform属性包含旋转分量。 也就是说,变换矩阵表示旋转水平面以匹配检测到的表面的方向的结果。


                              Using Detailed Plane Geometry


geometry
A coarse triangle mesh representing the general shape of the detected plane.
表示检测到的平面的一般形状的粗糙三角形网格。

讨论

该网格提供了描述飞机的估计2D尺寸的顶点,索引和纹理坐标缓冲区。

您可以通过将这些缓冲区传递给您的首选渲染引擎来可视化平面几何图形。 要使用SceneKit可视化平面几何,请创建一个ARSCNPlaneGeometry实例并使用其updateFromPlaneGeometry:方法更新它以加工平面几何。


ARPlaneGeometry
A 3D mesh describing the shape of a detected plane in world-tracking AR sessions.
描述世界跟踪AR会话中检测到的平面形状的3D网格。

Overview

This class provides the estimated general shape of a detected plane, in the form of a detailed 3D mesh appropriate for use with various rendering technologies or for exporting 3D assets. (For a quick way to visualize a plane geometry using SceneKit, see the ARSCNPlaneGeometryclass.)

Unlike the ARPlaneAnchor center and extent properties, which estimate only a rectangular area for a detected plane, a plane anchor's geometry property provides a more detailed estimate of the 2D area covered by that plane. For example, if ARKit detects a circular tabletop, the resulting ARPlaneGeometry objects roughly match the general shape of the table. As the session continues to run, ARKit provides updated plane anchors whose associated geometry refines the estimated shape of the plane.

You can use this model to more precisely place 3D content that should appear only on a detected flat surface—for example, to ensure that virtual objects don't fall off the edge of a table. You can also use this model to create occlusion geometry, which hides other virtual content behind the detected surface in the camera image.

The shape of a plane geometry is always convex. (That is, the boundary polygon for a plane geometry is a minimal convex hull enclosing all points that ARKit recognizes or estimates are part of the plane.)

概述

此类提供检测平面的估计一般形状,采用适用于各种渲染技术或导出3D资产的详细3D网格形式。 (有关使用SceneKit可视化平面几何的快速方法,请参阅ARSCNPlaneGeometry类。)

与仅为被检测平面估计矩形区域的ARPlaneAnchor中心和范围属性不同,平面锚点的几何属性提供了该平面覆盖的二维区域的更详细估计。例如,如果ARKit检测到圆形桌面,则生成的ARPlaneGeometry对象大致与表的一般形状匹配。随着会话继续运行,ARKit提供更新的平面锚点,其关联的几何图形改进平面的估计形状。

您可以使用此模型更精确地放置应仅出现在检测到的平面上的3D内容 - 例如,以确保虚拟对象不会脱离桌子边缘。您也可以使用此模型创建遮挡几何图形,该遮挡几何图形将相机图像中检测到的表面后面的其他虚拟内容隐藏起来。

平面几何形状总是凸起的。 (也就是说,平面几何的边界多边形是一个包含ARKit识别或估计是平面一部分的所有点的最小凸包。)

Accessing Mesh Data

vertexCount
The number of elements in the vertices buffer.
顶点缓冲区中元素的数量。

vertices
A buffer of vertex positions for each point in the plane mesh.
平面网格中每个点的顶点位置缓冲区。

Discussion

Each float3 value in this buffer represents the position of a vertex in the mesh, in a coordinate system whose origin is defined by the owning plane anchor's transform matrix.

The vertexCount property provides the number of elements in the buffer. 

This buffer, together with the triangleIndices buffer, describes a mesh covering the entire surface of the plane. Use this mesh for purposes that involve the filled shape, such as rendering a solid 3D representation of the surface. If instead you only need to know the outline of the shape, see the boundaryVertices property.

讨论

此缓冲区中的每个float3值表示网格中顶点的位置,该坐标系的原点由拥有平面锚点的变换矩阵定义。

vertexCount属性提供缓冲区中元素的数量。

该缓冲区与三角形指标缓冲区一起描述覆盖平面整个表面的网格。 使用此网格用于涉及填充形状的目的,例如渲染表面的实体3D表示。 如果您只需要知道形状的轮廓,请参阅boundaryVertices属性。

textureCoordinateCount
The number of elements in the textureCoordinates buffer.
textureCoordinates缓冲中的元素数量。

textureCoordinates
A buffer of texture coordinate values for each point in the plane mesh.
平面网格中每个点的纹理坐标值的缓冲区。

Discussion

Each float2 value in this buffer represents the UV texture coordinates for the vertex at the corresponding index in the vertices buffer.

讨论

此缓冲区中的每个float2值表示顶点缓冲区中相应索引处顶点的UV纹理坐标。

triangleCount
The number of triangles described by the triangleIndices buffer.
由triangleIndices缓冲区描述的三角形的数量。

Discussion

Each set of three indices forms a triangle, so the number of indices in the triangleIndicesbuffer is three times the triangleCount value.

讨论

每组三个索引形成一个三角形,因此triangleIndices缓冲区中索引的数量是triangleCount值的三倍。

triangleIndices
A buffer of indices describing the triangle mesh formed by the plane geometry's vertex data.
索引的缓冲区,用于描述由平面几何的顶点数据形成的三角形网格。

Discussion

Each 16-bit integer value in this buffer represents an index into the vertices and textureCoordinates buffers. Each set of three indices identifies the vertices that form a single triangle in the mesh. (That is, this buffer is appropriate for use as an index buffer for a triangle mesh in GPU-based rendering or creating 3D model asset files.)

Each set of three indices forms a triangle, so the number of indices in the triangleIndicesbuffer is three times the triangleCount value.

讨论

此缓冲区中的每个16位整数值都表示顶点和textureCoordinates缓冲区的索引。 每组三个索引都标识形成网格中单个三角形的顶点。 (也就是说,此缓冲区适合用作基于GPU渲染或创建3D模型asset文件的三角形网格的索引缓冲区。)

每组三个索引形成一个三角形,因此triangleIndices缓冲区中索引的数量是triangleCount值的三倍。


                                   Finding Boundary Points


boundaryVertexCount
The number of elements in the boundaryVertices buffer.
boundaryVertices缓冲区中元素的数量。

boundaryVertices
A buffer of vertex positions for each point along the plane's boundary.
沿着平面边界的每个点的顶点位置的缓冲区。

Discussion

Each float3 value in this buffer represents the position of a vertex along the boundary polygon of the estimated plane, in a coordinate system whose origin is defined by the owning plane anchor's transform matrix.

The boundaryVertexCount property provides the number of elements in the buffer. 

This buffer defines the boundary polygon of the plane. Use it for purposes that require only that polygon's definition, such as rendering an outline of the plane's estimated shape or testing whether a point is inside the bounded region. If instead you need the filled shape (for example, to render a solid 3D representation of the surface), see the vertices property.

讨论

该缓冲区中的每个float3值表示一个坐标系中沿着所估计平面的边界多边形的顶点位置,该坐标系的原点由拥有平面锚的变换矩阵定义。

boundaryVertexCount属性提供缓冲区中元素的数量。

该缓冲区定义了该平面的边界多边形。 将它用于仅需要多边形定义的目的,例如渲染平面估计形状的轮廓或测试点是否位于有界区域内。 如果您需要填充的形状(例如,渲染表面的实体3D表示),请参阅顶点属性。

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 158,117评论 4 360
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 66,963评论 1 290
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 107,897评论 0 240
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 43,805评论 0 203
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,208评论 3 286
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,535评论 1 216
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,797评论 2 311
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,493评论 0 197
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,215评论 1 241
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,477评论 2 244
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 31,988评论 1 258
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,325评论 2 252
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 32,971评论 3 235
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,055评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,807评论 0 194
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,544评论 2 271
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,455评论 2 266

推荐阅读更多精彩内容