Download node_modules/three/src/objects/LineSegments.js from SimWorld-AI/industrial-harbor-viewer: direct link, hf CLI and curl.
- Browser
- Download file 1.25 kB
-
https://huggingface.co/spaces/SimWorld-AI/industrial-harbor-viewer/resolve/main/node_modules/three/src/objects/LineSegments.js
- Command line
-
hf download hf://spaces/SimWorld-AI/industrial-harbor-viewer/node_modules/three/src/objects/LineSegments.js
-
curl -L -o LineSegments.js https://huggingface.co/spaces/SimWorld-AI/industrial-harbor-viewer/resolve/main/node_modules/three/src/objects/LineSegments.js
1.25 kB
| import { Line } from './Line.js'; | |
| import { Vector3 } from '../math/Vector3.js'; | |
| import { Float32BufferAttribute } from '../core/BufferAttribute.js'; | |
| const _start = /*@__PURE__*/ new Vector3(); | |
| const _end = /*@__PURE__*/ new Vector3(); | |
| class LineSegments extends Line { | |
| constructor( geometry, material ) { | |
| super( geometry, material ); | |
| this.isLineSegments = true; | |
| this.type = 'LineSegments'; | |
| } | |
| computeLineDistances() { | |
| const geometry = this.geometry; | |
| // we assume non-indexed geometry | |
| if ( geometry.index === null ) { | |
| const positionAttribute = geometry.attributes.position; | |
| const lineDistances = []; | |
| for ( let i = 0, l = positionAttribute.count; i < l; i += 2 ) { | |
| _start.fromBufferAttribute( positionAttribute, i ); | |
| _end.fromBufferAttribute( positionAttribute, i + 1 ); | |
| lineDistances[ i ] = ( i === 0 ) ? 0 : lineDistances[ i - 1 ]; | |
| lineDistances[ i + 1 ] = lineDistances[ i ] + _start.distanceTo( _end ); | |
| } | |
| geometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) ); | |
| } else { | |
| console.warn( 'THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' ); | |
| } | |
| return this; | |
| } | |
| } | |
| export { LineSegments }; | |