GeometryInterfaces.kl

Interfaces

Geometry (interface)

The Geometry interface regroups a set of function that should be implemented by every Geometry type.

Geometry Geometry Geometry Curves Curves Curves->Geometry DrawElements DrawElements DrawElements->Geometry Lines Lines Lines->Geometry Points Points Points->Geometry PolygonMesh PolygonMesh PolygonMesh->Geometry

Functions

  applyTransform ! ( in Mat44 transform )
  applyTransform ! ( in Xfo transform )
  convertToCPU ! ()
  convertToGPU ! ()
  copy ! ( in Geometry src )
Size elementCount ? ()
Vec3[] getAllPointPositions ? ()
Ref<GeometryAttributes> getAttributes ? ()
LocalBoundingVolume getBoundingVolume ? ()
String getDebugName ? ()
String getDesc ? ( in Boolean withAttributes, in Boolean useUnitTestPrint )
LocalBoundingVolume getElementBoundingVolume ? ( in Size index )
UInt32 getMemType ? ()
Ref<ThreadsafeMetaDataContainer> getMetaData ? ()
Vec3 getPointPosition ? ( in Size point )
UInt32 getStructureVersion ? ()
UInt32 getVersion ? ()
Size pointCount ? ()
  setAllPointPositions ! ( in Vec3 positions[] )
  setPointPosition ! ( in Size point, in Vec3 position )

Functions in detail

Geometry.applyTransform! ( in Mat44 transform )

Transforms the positions of the geometry (and normals if applicable)


Geometry.applyTransform! ( in Xfo transform )

Transforms the positions of the geometry (and normals if applicable)


Geometry.convertToCPU! ()


Geometry.convertToGPU! ()


Geometry.copy! ( in Geometry src )

Copies all the data from source Geometry, including attributes.


Size Geometry.elementCount? ()

Returns the number of elements for this Geometry. Elements are geometry specific: polygons for PolygonMesh, line segments for Lines, points for Points...


Vec3[] Geometry.getAllPointPositions? ()

Returns all point positions


Ref<GeometryAttributes> Geometry.getAttributes? ()

Returns the associated attribute container, if any.

注釈

the usage and meaning of attribute values is geometry specific.


LocalBoundingVolume Geometry.getBoundingVolume? ()

Returns the local bounding volume of the geometry (typically a bounding box around the point positions)


String Geometry.getDebugName? ()

Returns the debug name used when constructing the geometry.


String Geometry.getDesc? ( in Boolean withAttributes, in Boolean useUnitTestPrint )

Returns a description of the Geometry.


LocalBoundingVolume Geometry.getElementBoundingVolume? ( in Size index )

Returns the bounding volume of an element. Elements are geometry specific: polygons for PolygonMesh, line segments for Lines, points for Points...


UInt32 Geometry.getMemType? ()

Returns the memory location id. CPU = 0, GPU = 1, VSM = 2;


Ref<ThreadsafeMetaDataContainer> Geometry.getMetaData? ()

Returns the metaData container for this Geometry.


Vec3 Geometry.getPointPosition? ( in Size point )

Returns the position of a point.


UInt32 Geometry.getStructureVersion? ()

Returns the version of the geometry structure including the the attribute set (but not attribute values).


UInt32 Geometry.getVersion? ()

Returns the version of the geometry including attribute values


Size Geometry.pointCount? ()

Returns the number of points.


Geometry.setAllPointPositions! ( in Vec3 positions[] )

Sets all point positions


Geometry.setPointPosition! ( in Size point, in Vec3 position )

Sets the positions of a point.

SpatialQuery (interface)

The SpatialQuery interface wraps a temporary query object that holds the spatial query context for a given SpatialQueryable geometry. To be valid, this query object needs to be used between a SpatialQueryable.beginSpatialQuery and SpatialQueryable.endSpatialQuery bracket, which allows to recycle the SpatialQuery to avoid the cost of memory allocations. See ジオメトリを用いた空間分析群(Spatial queries)の使用 and 空間分析(SpatialQuery)オブジェクトの使用 for more details.

SpatialQuery SpatialQuery SpatialQuery LinesSpatialQuery LinesSpatialQuery LinesSpatialQuery->SpatialQuery PointsSpatialQuery PointsSpatialQuery PointsSpatialQuery->SpatialQuery PolygonMeshSpatialQuery PolygonMeshSpatialQuery PolygonMeshSpatialQuery->SpatialQuery

Functions

GeometryLocation getClosest ! ( in Vec3 position, in Vec3 scaling, in Scalar maxUnscaledDistance )
Size getElementsInBBox ! ( in Vec3 min, in Vec3 max )
Size getElementsInBSphere ! ( in Vec3 center, in Scalar radius )
Size getLineIntersections ! ( in Vec3 start, in Vec3 end, in UInt8 lineIntersectionType )
Size getQueriedElement ? ( in Size index )
GeometryLocation getQueriedLocation ? ( in Size index )
GeometryLocation raycast ! ( in Ray ray, in Boolean doubleSided, in Scalar coneThreshold, in Scalar maxDistance )

Functions in detail

GeometryLocation SpatialQuery.getClosest! ( in Vec3 position, in Vec3 scaling, in Scalar maxUnscaledDistance )

Finds the closest position of a Geometry from a specified local position, returns the result as a GeometryLocation . A hit was found if GeometryLocation.isValid is true. A scaling factor needs to be specified for proper support of non-uniform scaling, since it can influence the result. Properly calling SpatialQueryable.prepareForSpatialQueries beforehand can increase significatively the performance of multiple raycasts.

注釈

this function is threadsafe, as long as the Geometry is not modified, and SpatialQueryable.prepareForSpatialQueries is not called during this function.


Size SpatialQuery.getElementsInBBox! ( in Vec3 min, in Vec3 max )

Gets the elements intersecting a local bounding box. The definition of an element is Geometry-specific (polygon for PolygonMesh, segment for Lines, point for Points). The number of intersected elements is returned, and individual element indices must be gathered with the SpatialQuery.getQueriedElement before issuing another query.

Important: the returned values is a conservative approximation since only the bounding volume of the elements will be considered (eg: polygon’s bounding box for a PolygonMesh). This implies that some elements that are returned might not actually touch the queried bounding box (but are close to it). For more precision, the caller must perform additional filtering.

注釈

The choice to use SpatialQuery.getQueriedElement instead of simply returning an array of element indices avoids to allocate heap memory, which increases the performance.


Size SpatialQuery.getElementsInBSphere! ( in Vec3 center, in Scalar radius )

Gets the elements intersecting a local bounding sphere. The definition of an element is Geometry-specific (polygon for PolygonMesh, segment for Lines, point for Points). The number of intersected elements is returned, and individual element indices must be gathered with the SpatialQuery.getQueriedElement before issuing another query.

Important: the returned values is a conservative approximation since only the bounding volume of the elements will be considered (eg: polygon’s bounding box for a PolygonMesh). This implies that some elements that are returned might not actually touch the queried bounding sphere (but are close to it). For more precision, the caller must perform additional filtering.

注釈

The choice to use SpatialQuery.getQueriedElement instead of simply returning an array of element indices avoids to allocate heap memory, which increases the performance.


Size SpatialQuery.getLineIntersections! ( in Vec3 start, in Vec3 end, in UInt8 lineIntersectionType )

バージョン 1.13.0 で追加.

Gathers all intersections from a line, semi-line or line segment. The number of intersections is returned, and individual GeometryLocation can be retrieved using SpatialQuery.getQueriedLocation . Intersections will be sorted in the start to end direction.

  • if lineIntersectionType == SpatialQuery_lineIntersection : intersects with an infinite line passing through start and end
  • if lineIntersectionType == SpatialQuery_semiLineIntersection : intersects with a semi-line starting at start, passing through end and continuing infinitely in that direction
  • if lineIntersectionType == SpatialQuery_segmentIntersection : intersects with a segment starting at start and ending at end


Size SpatialQuery.getQueriedElement? ( in Size index )

Returns an element index gathered from a call to SpatialQuery.getElementsInBBox or SpatialQuery.getElementsInBSphere . The total element count is the returned value from these methods. Stored element indices are only valid until another query call is made.

注釈

The choice to use SpatialQuery.getQueriedElement instead of simply returning an array of element indices avoids to allocate heap memory, which increases the performance.


GeometryLocation SpatialQuery.getQueriedLocation? ( in Size index )

バージョン 1.13.0 で追加.

Returns a location gathered from a call to SpatialQuery.getLineIntersections . The total element count is the returned value from that method. Stored locations are only valid until another query call is made.

注釈

The choice to use SpatialQuery.getQueriedLocation instead of simply returning an array of locations avoids to allocate heap memory, which increases the performance.


GeometryLocation SpatialQuery.raycast! ( in Ray ray, in Boolean doubleSided, in Scalar coneThreshold, in Scalar maxDistance )

Raycasts a Geometry and returns the result as a GeometryLocation . A hit was found if GeometryLocation.isValid is true. Properly calling SpatialQueryable.prepareForSpatialQueries beforehand can increase significatively the performance of multiple raycasts.

注釈

this function is threadsafe, as long as the Geometry is not modified, and SpatialQueryable.prepareForSpatialQueries is not called during this function.

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.

SpatialQueryable SpatialQueryable SpatialQueryable Lines Lines Lines->SpatialQueryable Points Points Points->SpatialQueryable PolygonMesh PolygonMesh PolygonMesh->SpatialQueryable

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.


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).

Types

GeometryLocation (struct)

The GeometryLocation struct represents the description of a location on the surface of a geometry such as a PolygonMesh. Members’ usage is Geometry type specific: see ジオメトリロケーション構造 .

Members

Size index Usage is Geometry type specific: see ジオメトリロケーション構造 .
Size subIndex Usage is Geometry type specific: see ジオメトリロケーション構造 .
Vec3 barycentric Usage is Geometry type specific: see ジオメトリロケーション構造 .

Methods

  GeometryLocation ( in GeometryLocation other )
  GeometryLocation ()
GeometryLocation clone ? ()
Boolean isValid ? ()

Functions

PrepareForSpatialQueries_setOctree

PrepareForSpatialQueries_setOctree ( io GenericValueContainer options )

Helper for initializing SpatialQueryable.prepareForSpatialQueries options: sets preferred acceleration method as Octree (which is the default).

PrepareForSpatialQueries_setOctreeMaxDepth

PrepareForSpatialQueries_setOctreeMaxDepth ( io GenericValueContainer options, in UInt8 octreeMaxDepth )

Helper for initializing SpatialQueryable.prepareForSpatialQueries options: sets Octree ‘s maximum depth.

PrepareForSpatialQueries_setSparseGrid

PrepareForSpatialQueries_setSparseGrid ( io GenericValueContainer options )

Helper for initializing SpatialQueryable.prepareForSpatialQueries options: sets preferred acceleration method as SparseGrid (default: Octree).

PrepareForSpatialQueries_setSparseGridCellSize

PrepareForSpatialQueries_setSparseGridCellSize ( io GenericValueContainer options, in Scalar cellSize )

Helper for initializing SpatialQueryable.prepareForSpatialQueries options: sets SparseGrid ‘s cellSize (default: auto cellSize).

PrepareForSpatialQueries_setSparseGridAutoCellSizeMultiplier

PrepareForSpatialQueries_setSparseGridAutoCellSizeMultiplier ( io GenericValueContainer options, in Scalar autoCellSizeMultiplier )

Helper for initializing SpatialQueryable.prepareForSpatialQueries options: sets SparseGrid ‘s auto cellSize factor (default: 1.0).

GetAttributeAtLocation

Vec4 GetAttributeAtLocation ( in Ref<SpatialQueryable> geometry, in GeometryLocation location, in Ref<Vec4Attribute> attribute )

GeometryLocation helper: evaluates a Vec4Attribute a specific location. The location must be valid, and must have been created by the Geometry or one with the same structure, and no structure changes should have been made.

GetAttributeAtLocation

Vec4 GetAttributeAtLocation ( in Ref<SpatialQueryable> geometry, in GeometryLocation location, in Ref<Vec4Attribute> attribute )

GeometryLocation helper: evaluates a Vec4Attribute a specific location. The location must be valid, and must have been created by the Geometry or one with the same structure, and no structure changes should have been made.

GetAttributeAtLocation

Vec4 GetAttributeAtLocation ( in Ref<SpatialQueryable> geometry, in GeometryLocation location, in Ref<Vec4Attribute> attribute )

GeometryLocation helper: evaluates a Vec4Attribute a specific location. The location must be valid, and must have been created by the Geometry or one with the same structure, and no structure changes should have been made.

GetAttributeAtLocation

Vec4 GetAttributeAtLocation ( in Ref<SpatialQueryable> geometry, in GeometryLocation location, in Ref<Vec4Attribute> attribute )

GeometryLocation helper: evaluates a Vec4Attribute a specific location. The location must be valid, and must have been created by the Geometry or one with the same structure, and no structure changes should have been made.

GetAttributeAtLocation

Vec4 GetAttributeAtLocation ( in Ref<SpatialQueryable> geometry, in GeometryLocation location, in Ref<Vec4Attribute> attribute )

GeometryLocation helper: evaluates a Vec4Attribute a specific location. The location must be valid, and must have been created by the Geometry or one with the same structure, and no structure changes should have been made.

GetAttributeAtLocation

Vec4 GetAttributeAtLocation ( in Ref<SpatialQueryable> geometry, in GeometryLocation location, in Ref<Vec4Attribute> attribute )

GeometryLocation helper: evaluates a Vec4Attribute a specific location. The location must be valid, and must have been created by the Geometry or one with the same structure, and no structure changes should have been made.

GetAttributeAtLocation

Vec4 GetAttributeAtLocation ( in Ref<SpatialQueryable> geometry, in GeometryLocation location, in Ref<Vec4Attribute> attribute )

GeometryLocation helper: evaluates a Vec4Attribute a specific location. The location must be valid, and must have been created by the Geometry or one with the same structure, and no structure changes should have been made.

GetAttributeAtLocation

Vec4 GetAttributeAtLocation ( in Ref<SpatialQueryable> geometry, in GeometryLocation location, in Ref<Vec4Attribute> attribute )

GeometryLocation helper: evaluates a Vec4Attribute a specific location. The location must be valid, and must have been created by the Geometry or one with the same structure, and no structure changes should have been made.

GetAttributeAtLocation

Vec4 GetAttributeAtLocation ( in Ref<SpatialQueryable> geometry, in GeometryLocation location, in Ref<Vec4Attribute> attribute )

GeometryLocation helper: evaluates a Vec4Attribute a specific location. The location must be valid, and must have been created by the Geometry or one with the same structure, and no structure changes should have been made.

GetAttributeAtLocation

Vec4 GetAttributeAtLocation ( in Ref<SpatialQueryable> geometry, in GeometryLocation location, in Ref<Vec4Attribute> attribute )

GeometryLocation helper: evaluates a Vec4Attribute a specific location. The location must be valid, and must have been created by the Geometry or one with the same structure, and no structure changes should have been made.

GetAttributeAtLocation

Vec4 GetAttributeAtLocation ( in Ref<SpatialQueryable> geometry, in GeometryLocation location, in Ref<Vec4Attribute> attribute )

GeometryLocation helper: evaluates a Vec4Attribute a specific location. The location must be valid, and must have been created by the Geometry or one with the same structure, and no structure changes should have been made.

GetAttributeAtLocation

Vec4 GetAttributeAtLocation ( in Ref<SpatialQueryable> geometry, in GeometryLocation location, in Ref<Vec4Attribute> attribute )

GeometryLocation helper: evaluates a Vec4Attribute a specific location. The location must be valid, and must have been created by the Geometry or one with the same structure, and no structure changes should have been made.

GetAttributeAtLocation

Vec4 GetAttributeAtLocation ( in Ref<SpatialQueryable> geometry, in GeometryLocation location, in Ref<Vec4Attribute> attribute )

GeometryLocation helper: evaluates a Vec4Attribute a specific location. The location must be valid, and must have been created by the Geometry or one with the same structure, and no structure changes should have been made.

GetAttributeAtLocation

Vec4 GetAttributeAtLocation ( in Ref<SpatialQueryable> geometry, in GeometryLocation location, in Ref<Vec4Attribute> attribute )

GeometryLocation helper: evaluates a Vec4Attribute a specific location. The location must be valid, and must have been created by the Geometry or one with the same structure, and no structure changes should have been made.

GetAttributeAtLocation

Vec4 GetAttributeAtLocation ( in Ref<SpatialQueryable> geometry, in GeometryLocation location, in Ref<Vec4Attribute> attribute )

GeometryLocation helper: evaluates a Vec4Attribute a specific location. The location must be valid, and must have been created by the Geometry or one with the same structure, and no structure changes should have been made.