Lines.kl

Types

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.

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 )