UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 2.18 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{c as t,a as e}from"../../../../../chunks/vec32.js";import{create as i}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ElevationAgnosticBVH as s}from"./ElevationAgnosticBVH.js";import{intersectRayTrianglesWithVerticalOffsetENUGlobal as r,intersectRayTriangles as a}from"../../lib/RayIntersections.js";import{generateTriangleAabbsLocal as n,generateTriangleAabbsGlobal as h}from"../../lib/triangleIntersectionUtils.js";class l{constructor(t,e,r,a,n,h,l,o,c){this.componentIndex=t,this.vertexData=e,this.vertexStride=r,this.indexData=a,this.startTriangleNumber=n,this.endTriangleNumber=h,this.geometryMinZ=l,this.planetCenterZ=o,this.localMode=c,this.maxBspNodeDepth=8,this.minElementCountForBVH=20,this.minBspNodeElementCount=10,this.rayDirection=i(),this.ray0=i(),this.isVerticalRay=!1,this._triangleHitCallback=m,this.totalElevationOffset=0,this.normalRequired=!1,this._bvh=new s(h-n,this)}getAabbs2D(){return this.localMode?n(this.startTriangleNumber,this.endTriangleNumber,this.indexData,this.vertexData,this.vertexStride):h(this.startTriangleNumber,this.endTriangleNumber,this.indexData,this.vertexData,this.vertexStride,this.geometryMinZ,this.planetCenterZ)}get numTriangles(){return this.endTriangleNumber-this.startTriangleNumber}intersectRay(i,s,r,a,n,h){t(this.ray0,i),e(this.rayDirection,s,i),this.isVerticalRay=r,this.totalElevationOffset=a,this.normalRequired=h,this._triangleHitCallback=n,this._bvh.intersectRay(i,s,r),this._triangleHitCallback=m}intersectRange(t,e){const i=this._bvh.elementIndexMap;o(this.ray0,this.rayDirection,t,e,this.indexData,this.vertexData,this.vertexStride,this.totalElevationOffset,this.planetCenterZ,this.normalRequired,this._triangleHitCallback,i,this.startTriangleNumber)}getTriangleElevationOffset(t){return this.totalElevationOffset}}function o(t,e,i,s,n,h,l,o,m,c,g,u=null,b=0){0!==o?r(t,e,i,s,n,h,l,o,m,c,g,u,b):a(t,e,i,s,n,h,l,c,g,u,b)}function m(){}export{l as ComponentObjectElevationAgnosticComponentGeometryBVH,o as intersectTriangleRangeForComponent};