Lines (object)

The Lines object implements a Geometry made of line segments. Each segment corresponds to attribute index pairs.

The Lines have a raycastThickness member that defines the lines’ thickness for bounding volume and SpatialQueryable methods.

注釈

For functions treating elements such as SpatialQuery.getElementsInBBox, an element corresponds to a line segment.

Lines Lines Lines BaseGeometry BaseGeometry Lines->BaseGeometry Geometry Geometry Lines->Geometry SpatialQueryable SpatialQueryable Lines->SpatialQueryable StatisticSourceWithAutoRegisterMember StatisticSourceWithAutoRegisterMember BaseGeometry->StatisticSourceWithAutoRegisterMember ThreadsafeMetaDataOwner ThreadsafeMetaDataOwner BaseGeometry->ThreadsafeMetaDataOwner Versioned Versioned BaseGeometry->Versioned

Members

GeometryAttributes attributes Container for all attributes.
String debugName Name that will be printed in descriptions.
UInt32 structureVersion Version of the geometry structure itself, excluding the GeometryAttributes content.
Boolean computeGPUBoundingVolume If positions are on the GPU: if true, the bounding volume is computed, else an infinite bbox is returned.
ThreadsafeMetaDataContainer metaData Container for holding various user data (Geometry specific), such as the BoundingBox cache data, or raycast acceleration structures and data (Octree).
UInt32[] indices Point index pairs for segments
Scalar raycastThickness Thickness to be used for SpatialQueryable methods
/*
** Example: Lines
*/

require Geometry;
  
operator entry() {

                      //Create a XZ square
                      Lines lines = Lines();
                      lines.addPoints( 4 );
                      
                      lines.setPointPosition( 0, Vec3(0,0,0) );
                      lines.setPointPosition( 1, Vec3(1,0,0) );
                      lines.setPointPosition( 2, Vec3(1,0,1) );
                      lines.setPointPosition( 3, Vec3(0,0,1) );
                      
                      lines.addClosedLine( 0, 3 );
                      
                      Size segmentCount = lines.lineCount();
                      for( Size i = 0; i < segmentCount; ++i ) {
                        Size startPoint, endPoint;
                        lines.getLineAttributeIndices( i, startPoint, endPoint );
                        report("Segment " + i + " from " + lines.getPointPosition(startPoint) + " to " + lines.getPointPosition(endPoint) );
                      }
  
}

/*
** Output:

Segment 0 from {x:+0.0,y:+0.0,z:+0.0} to {x:+1.0,y:+0.0,z:+0.0}
Segment 1 from {x:+1.0,y:+0.0,z:+0.0} to {x:+1.0,y:+0.0,z:+1.0}
Segment 2 from {x:+1.0,y:+0.0,z:+1.0} to {x:+0.0,y:+0.0,z:+1.0}
Segment 3 from {x:+0.0,y:+0.0,z:+1.0} to {x:+0.0,y:+0.0,z:+0.0}

*/

Methods

  Lines ( in Lines other )
  Lines ( in String debugName )
  Lines ()
  addClosedLine ! ( in UInt32 ptIdxStart, in UInt32 ptIdxEnd )
  addLine ! ( in UInt32 ptIdxStart, in UInt32 ptIdxEnd )
  addLine ! ( in Vec3 start, in Vec3 end )
  addLineStrip ! ( in Vec3 strip[] )
  addLineStrips ! ( in Vec3 strip[], in Size counts[] )
Size addPoints ! ( in Size count )
  addSegment ! ( in UInt32 ptIdx0, in UInt32 ptIdx1 )
  addSegmentedLine ! ( in Vec3 from, in Vec3 to, in Integer numSegments )
  applyTransform ! ( in Mat44 transform )
  applyTransform ! ( in Xfo transform )
  clear ! ()
Lines clone ? ()
  cloneMembersTo ? ( io Lines that )
  convertToCPU ! ()
  convertToGPU ! ()
  copy ! ( in Geometry src )
  copy ! ( in Lines src )
Size elementCount ? ()
Vec3[] getAllPointPositions ? ()
Ref<GeometryAttributes> getAttributes ? ()
LocalBoundingVolume getBoundingVolume ? ()
String getDebugName ? ()
String getDesc ? ( in Boolean withAttributes )
String getDesc ? ( in Boolean withAttributes, in Boolean useUnitTestPrint )
LocalBoundingVolume getElementBoundingVolume ? ( in Size index )
UInt32[] getIndices ? ()
UInt32[][] getIndicesPerCurve ? ()
  getLineAttributeIndices ? ( in Size lineIndex, out Size start, out Size end )
  getLocationAttributeIndicesAndWeights ? ( in GeometryLocation location, out LocalL16UInt32Array attributeIndices, out LocalL16ScalarArray weights )
UInt32 getMemType ? ()
Ref<ThreadsafeMetaDataContainer> getMetaData ? ()
Xfo[] getPerPointTransforms ? ( in Vec3 upvector )
Vec3 getPointPosition ? ( in Size point )
Vec3 getPositionAtLocation ? ( in GeometryLocation location )
UInt32 getStructureVersion ? ()
UInt32 getVersion ? ()
  incrementPositionsVersion ! ()
Size lineCount ? ()
Size pointCount ? ()
  setAllPointPositions ! ( in Vec3 positions[] )
  setPointPosition ! ( in Size point, in Vec3 position )

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, out UInt32 attributeIndices[2], out Scalar weights[2] )
Size getLocationSegmentIndex ? ( in GeometryLocation location )
  getLocationSegmentWeights ? ( in GeometryLocation location, out Scalar point0Weight, out Scalar point1Weight )
  prepareForSpatialQueries ? ( in Size approximateNumberOfQueries, in GenericValueContainer options )
GeometryLocation raycast ? ( in Ray ray, in Boolean doubleSided, in Scalar coneThreshold, in Scalar maxDistance )
  removeSpatialQueryAcceleration ! ()

Primitives methods

  addArc ! ( in Xfo xfo, in Scalar radius, in Vec2 angleMinMax, in Integer detail )
  addAxes ! ( in Xfo xfo, in Scalar size )
  addCapsule ! ( in Xfo xfo, in Scalar radius, in Scalar height, in Integer detail )
  addCircle ! ( in Xfo xfo, in Scalar radius, in Size detail )
  addCross ! ( in Xfo xfo, in Scalar size )
  addGrid ! ( in Xfo xfo, in Scalar sizeX, in Scalar sizeY, in Scalar sizeZ, in Integer numXsections, in Integer numYsections, in Integer numZsections )
  addRectangle ! ( in Xfo xfo, in Scalar length, in Scalar width )
  addSphere ! ( in Xfo xfo, in Scalar radius, in Size detail )
  drawBoundingBox ! ( in Xfo xfo, in Vec3 bboxmin, in Vec3 bboxmax )
  drawCameraDisplay ! ( in Scalar focalDistance, in Scalar fovY, in Size windowWidth, in Size windowHeight )

Methods in detail

Lines ( in Lines other )

copy constructor


Lines ( in String debugName )

Constructor taking the string to be used as the name.

debugName the name displayed in debugging


Lines ()


Lines.addClosedLine! ( in UInt32 ptIdxStart, in UInt32 ptIdxEnd )

Adds multiple line segments referring to a loop of consecutive point indices (circular array). For example, ‘addClosedLine( 3, 6 )’ will create segments [3,4], [4,5], [5,6] and [6,3].

ptIdxStart First index of the first segment and last index of the last segment
First index of the last segment


Lines.addLine! ( in UInt32 ptIdxStart, in UInt32 ptIdxEnd )

Adds multiple line segments referring to consecutive point indices. For example, ‘addLine( 3, 6 )’ will create segments [3,4], [4,5] and [5,6].

ptIdxStart First index of the first segment
Last index of the last segment.


Lines.addLine! ( in Vec3 start, in Vec3 end )

Adds a line segment from start position to end position.

注釈

In order to share point values with other segments, use :Lines.addLine(UInt32 ptIdxStart, UInt32 ptIdxEnd)


Lines.addLineStrip! ( in Vec3 strip[] )

Adds a strip of line segments, defined as [ strip[0], strip[1] ], [ strip[1], strip[2] ], ...


Lines.addLineStrips! ( in Vec3 strip[], in Size counts[] )

Adds several line strips


Size Lines.addPoints! ( in Size count )

Adds N points and returns the index of the first of the consecutive indices.


Lines.addSegment! ( in UInt32 ptIdx0, in UInt32 ptIdx1 )

Adds a line segment referring to 2 point indices


Lines.addSegmentedLine! ( in Vec3 from, in Vec3 to, in Integer numSegments )

Adds a line that goes from from to to, subdivided in numSegments.


Lines.applyTransform! ( in Mat44 transform )

Geometry interface: transforms the positions of the geometry


Lines.applyTransform! ( in Xfo transform )

Geometry interface: transforms the positions of the geometry


Lines.clear! ()

Clears all data, including points and attributes. The version gets incremented.


Lines Lines.clone? ()

clone method


Lines.cloneMembersTo? ( io Lines that )


Lines.convertToCPU! ()


Lines.convertToGPU! ()


Lines.copy! ( in Geometry src )

Copies the content from the source Geometry.


Lines.copy! ( in Lines src )

Copies the content from the source Lines.


Size Lines.elementCount? ()

Geometry interface: return the number of line segment (same as Lines.lineCount)


Vec3[] Lines.getAllPointPositions? ()

Geometry interface: returns all point positions


Ref<GeometryAttributes> Lines.getAttributes? ()

Returns the associated GeometryAttributes container. Use Lines.getLineAttributeIndices to get attribute indices corresponding to a line segment.


LocalBoundingVolume Lines.getBoundingVolume? ()

Returns the bounding volume of the geometry, as computed from the positions attribute. This function will cache the bounding box given a specific version of the positions attribute, and will update it lazily, in a thread-safe fashion. The internal cache is stored in the BaseGeometry.metaData container.


String Lines.getDebugName? ()

Returns the debug name used when constructing the geometry.


String Lines.getDesc? ( in Boolean withAttributes )

Returns a String description of the Lines.

withAttributes include the attribute values in the desc.


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

Returns a String description of the Lines.

withAttributes include the attribute values in the desc.
useUnitTestPrint use the unitTestPrint method to ensure that the values are consistent accross platforms(used in unit testing).


LocalBoundingVolume Lines.getElementBoundingVolume? ( in Size index )

Geometry interface: return the bounding volume of a line segment (takes into account raycastThickness)


UInt32[] Lines.getIndices? ()

Returns the indices of the line segments


UInt32[][] Lines.getIndicesPerCurve? ()

Returns the indices for each curve as a separate array


Lines.getLineAttributeIndices? ( in Size lineIndex, out Size start, out Size end )

Returns the point indices corresponding to segment lineIndex.


Lines.getLocationAttributeIndicesAndWeights? ( in GeometryLocation location, out LocalL16UInt32Array attributeIndices, out LocalL16ScalarArray weights )


UInt32 Lines.getMemType? ()

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


Ref<ThreadsafeMetaDataContainer> Lines.getMetaData? ()

Returns the metaData container for this Geometry.


Xfo[] Lines.getPerPointTransforms? ( in Vec3 upvector )

Returns an aligned transform for each control point of the curve


Vec3 Lines.getPointPosition? ( in Size point )

Returns the position of a point.


Vec3 Lines.getPositionAtLocation? ( in GeometryLocation location )


UInt32 Lines.getStructureVersion? ()

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


UInt32 Lines.getVersion? ()

Returns the version of the geometry including attribute values


Lines.incrementPositionsVersion! ()

Helper for incrementing the version of the positions attribute after value changes. See Attribute versioning for more information.


Size Lines.lineCount? ()

Returns the number of line segments, which is not directly related to the number of points (points can be shared by multiple segments).


Size Lines.pointCount? ()

Returns the number of points, which is not directly related to the number of line segments (points can be shared by multiple segments).


Lines.setAllPointPositions! ( in Vec3 positions[] )

Geometry interface: sets all point positions


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

Sets the positions of a point.

注釈

Once positions have been set, call Lines.incrementPositionsVersion (see Attribute versioning)


SpatialQueryable methods

Boolean Lines.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> Lines.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.


Lines.endSpatialQuery? ( in Ref<SpatialQuery> query )

Releases (recycles) a query object previously obtained by a call to SpatialQueryable.beginSpatialQuery .


GeometryLocation Lines.getClosest? ( in Vec3 position, in Vec3 scaling, in Scalar maxUnscaledDistance )

Gets the closest location on the Lines geometry, taking into account the Lines.raycastThickness for the thickness of the line segments. See SpatialQueryable.getClosest for more details about this function and parameters.


Lines.getLocationAttributeIndicesAndWeights? ( in GeometryLocation location, out UInt32 attributeIndices[2], out Scalar weights[2] )

Returns the line segment point indices and weights corresponding to the location.


Size Lines.getLocationSegmentIndex? ( in GeometryLocation location )

Returns the line segment index corresponding to the location.


Lines.getLocationSegmentWeights? ( in GeometryLocation location, out Scalar point0Weight, out Scalar point1Weight )

Returns the line segment points’ weights corresponding to the location, where point0Weight and point1Weight correspond to segment’s start and end point.


Lines.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 Lines.raycast? ( in Ray ray, in Boolean doubleSided, in Scalar coneThreshold, in Scalar maxDistance )

Raycasts the Lines geometry, taking into account the Lines.raycastThickness for the thickness of the line segments (if > 1e-4). See SpatialQueryable.raycast for more details about this function and parameters.


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


Primitives methods

Lines.addArc! ( in Xfo xfo, in Scalar radius, in Vec2 angleMinMax, in Integer detail )

adds a line arc around the Y axis given a transform for the arc, a radius, a angular min and max as a Vec3 and a detail setting. the detail describes the number of line segments of the circle (minimum of 3).

angleMinMax [minAngle, maxAngle], in radians


Lines.addAxes! ( in Xfo xfo, in Scalar size )

Adds a transformed axe primitive, colored with X = red, Y = green, Z = blue


Lines.addCapsule! ( in Xfo xfo, in Scalar radius, in Scalar height, in Integer detail )

draws a capsule shape using lines. the detail describes the number of line segments for each circle (minimum of 3).


Lines.addCircle! ( in Xfo xfo, in Scalar radius, in Size detail )

Adds a transformed closed circle.


Lines.addCross! ( in Xfo xfo, in Scalar size )

Adds a transformed cross made of one line segment per axis


Lines.addGrid! ( in Xfo xfo, in Scalar sizeX, in Scalar sizeY, in Scalar sizeZ, in Integer numXsections, in Integer numYsections, in Integer numZsections )

Adds a transformed 3D grid


Lines.addRectangle! ( in Xfo xfo, in Scalar length, in Scalar width )

Adds a transformed rectangle


Lines.addSphere! ( in Xfo xfo, in Scalar radius, in Size detail )

Adds a sphere made of 3 circles, one in each axis plane


Lines.drawBoundingBox! ( in Xfo xfo, in Vec3 bboxmin, in Vec3 bboxmax )

Adds a transformed bounding box primitive


Lines.drawCameraDisplay! ( in Scalar focalDistance, in Scalar fovY, in Size windowWidth, in Size windowHeight )

Adds a transformed camera view pyramid with focal plane