SpatialQueryable (interface)¶
The SpatialQueryable interface is implemented by geometries which support required spatial query operations such as raycast and getClosest. See ジオメトリを用いた空間分析群(Spatial queries)の使用 for more details about using spatial queries.
Functions¶
SpatialQueryable methods¶
Boolean | areGeometryLocationsEquivalent ? ( in GeometryLocation location0, in GeometryLocation location1 ) |
Ref<SpatialQuery> | beginSpatialQuery ? () |
endSpatialQuery ? ( in Ref<SpatialQuery> query ) | |
GeometryLocation | getClosest ? ( in Vec3 position, in Vec3 scaling, in Scalar maxUnscaledDistance ) |
getLocationAttributeIndicesAndWeights ? ( in GeometryLocation location, io LocalL16UInt32Array attributeIndices, io LocalL16ScalarArray weights ) | |
Vec3 | getPositionAtLocation ? ( in GeometryLocation location ) |
prepareForSpatialQueries ? ( in Size approximateNumberOfQueries, in GenericValueContainer options ) | |
GeometryLocation | raycast ? ( in Ray ray, in Boolean doubleSided, in Scalar coneThreshold, in Scalar maxDistance ) |
removeSpatialQueryAcceleration ! () |
Functions in detail¶
SpatialQueryable methods¶
Boolean SpatialQueryable.areGeometryLocationsEquivalent? ( in GeometryLocation location0, in GeometryLocation location1 )
バージョン 1.13.0 で追加.
Returns true if the geometry locations are equal or equivalent for this geometry.
注釈
For a PolygonMesh, geometry locations on points and edges can be different but equivalent when defined at the junction of different triangles (different polygon and/or triangle, but same point or edge location).
Ref<SpatialQuery> SpatialQueryable.beginSpatialQuery? ()
Returns a local SpatialQuery object for issuing one or multiple queries. The returned SpatialQuery object must be locally released by calling SpatialQueryable.endSpatialQuery, and should not be used afterward.
SpatialQueryable.endSpatialQuery? ( in Ref<SpatialQuery> query )
Releases (recycles) a query object previously obtained by a call to SpatialQueryable.beginSpatialQuery .
GeometryLocation SpatialQueryable.getClosest? ( in Vec3 position, in Vec3 scaling, in Scalar maxUnscaledDistance )
A shortcut to SpatialQuery.getClosest, without the need to call SpatialQueryable.beginSpatialQuery and SpatialQueryable.endSpatialQuery. See SpatialQuery.getClosest for more details.
SpatialQueryable.getLocationAttributeIndicesAndWeights? ( in GeometryLocation location, io LocalL16UInt32Array attributeIndices, io LocalL16ScalarArray weights )
For a GeometryLocation returned by this SpatialQueryable, returns the attribute indices and weights required to linearly interpolate attribute values. The GeometryLocation must be valid. See ジオメトリロケーション構造 for more details.
Vec3 SpatialQueryable.getPositionAtLocation? ( in GeometryLocation location )
From a GeometryLocation built from this Geometry, returns the local position. The location must be valid, and must have been created by this Geometry or one with the same structure, and no structure changes should have been made.
SpatialQueryable.prepareForSpatialQueries? ( in Size approximateNumberOfQueries, in GenericValueContainer options )
Builds an acceleration structure that will accelerate future queries such as SpatialQueryable.raycast or SpatialQueryable.getClosest . For built-in Geometry types, the default acceleration structure is the Octree, however it is possible to use a SparseGrid (see options parameter description). See 高速化構造 for more details about acceleration structures.
Important: prepareForSpatialQueries must be called if geometry’s structure or positions changed. Otherwise, the acceleration will be silently disabled.
Because building an acceleration structure incurs memory and computation overhead, this function should be called only when multiple queries are expected. The acceleration structure will remain attached to the geometry so it can be reused and incrementally updated, unless SpatialQueryable.removeSpatialQueryAcceleration is explicitly called.
注釈
Calling prepareForSpatialQueries is not threadsafe, and must be called before issuing parallel queries.
options | can be null, values are implementation specific, and can be configured by calling one of these: PrepareForSpatialQueries_setOctree, PrepareForSpatialQueries_setOctreeMaxDepth, PrepareForSpatialQueries_setSparseGrid, PrepareForSpatialQueries_setSparseGridCellSize, PrepareForSpatialQueries_setSparseGridAutoCellSizeMultiplier . |
approximateNumberOfQueries | an approximation of the number of queries (eg: raycast) that will be issued. Structures such as the Octree with choose their level of precision accordingly, to provide an optimal balance between build and query costs. |
GeometryLocation SpatialQueryable.raycast? ( in Ray ray, in Boolean doubleSided, in Scalar coneThreshold, in Scalar maxDistance )
A shortcut to SpatialQuery.raycast, without the need to call SpatialQueryable.beginSpatialQuery and SpatialQueryable.endSpatialQuery. See SpatialQuery.raycast for more details.
SpatialQueryable.removeSpatialQueryAcceleration! ()
Releases the cached acceleration structure created by SpatialQueryable.prepareForSpatialQueries, which will reduce memory usage. However, if future queries are expected for the same geometry (even if modified), calling this method can significatively reduce the performance, as the next SpatialQueryable.prepareForSpatialQueries will need to fully fully reallocate and rebuild on acceleration structure (prevents potential incremental updates).