|
55 | 55 |
|
56 | 56 | var threshold = 0.1; |
57 | 57 | var pointSize = 0.05; |
58 | | - var width = 150; |
59 | | - var length = 150; |
| 58 | + var width = 80; |
| 59 | + var length = 160; |
60 | 60 | var rotateY = new THREE.Matrix4().makeRotationY( 0.005 ); |
61 | 61 |
|
62 | 62 | init(); |
|
79 | 79 | var u = i / width; |
80 | 80 | var v = j / length; |
81 | 81 | var x = u - 0.5; |
82 | | - var y = ( Math.cos( u * Math.PI * 8 ) + Math.sin( v * Math.PI * 8 ) ) / 20; |
| 82 | + var y = ( Math.cos( u * Math.PI * 4 ) + Math.sin( v * Math.PI * 8 ) ) / 20; |
83 | 83 | var z = v - 0.5; |
84 | 84 |
|
85 | 85 | positions[ 3 * k ] = x; |
|
108 | 108 | function generatePointcloud( color, width, length ) { |
109 | 109 |
|
110 | 110 | var geometry = generatePointCloudGeometry( color, width, length ); |
111 | | - |
112 | 111 | var material = new THREE.PointsMaterial( { size: pointSize, vertexColors: THREE.VertexColors } ); |
113 | | - var pointcloud = new THREE.Points( geometry, material ); |
114 | 112 |
|
115 | | - return pointcloud; |
| 113 | + return new THREE.Points( geometry, material ); |
116 | 114 |
|
117 | 115 | } |
118 | 116 |
|
|
138 | 136 | geometry.setIndex( new THREE.BufferAttribute( indices, 1 ) ); |
139 | 137 |
|
140 | 138 | var material = new THREE.PointsMaterial( { size: pointSize, vertexColors: THREE.VertexColors } ); |
141 | | - var pointcloud = new THREE.Points( geometry, material ); |
142 | 139 |
|
143 | | - return pointcloud; |
| 140 | + return new THREE.Points( geometry, material ); |
144 | 141 |
|
145 | 142 | } |
146 | 143 |
|
|
167 | 164 | geometry.addGroup( 0, indices.length ); |
168 | 165 |
|
169 | 166 | var material = new THREE.PointsMaterial( { size: pointSize, vertexColors: THREE.VertexColors } ); |
170 | | - var pointcloud = new THREE.Points( geometry, material ); |
171 | 167 |
|
172 | | - return pointcloud; |
| 168 | + return new THREE.Points( geometry, material ); |
173 | 169 |
|
174 | 170 | } |
175 | 171 |
|
|
182 | 178 | clock = new THREE.Clock(); |
183 | 179 |
|
184 | 180 | camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 10000 ); |
185 | | - camera.position.set( 15, 15, 15 ); |
| 181 | + camera.position.set( 10, 10, 10 ); |
186 | 182 | camera.lookAt( scene.position ); |
187 | 183 | camera.updateMatrix(); |
188 | 184 |
|
189 | 185 | // |
190 | 186 |
|
191 | 187 | var pcBuffer = generatePointcloud( new THREE.Color( 1, 0, 0 ), width, length ); |
192 | | - pcBuffer.scale.set( 10, 10, 10 ); |
193 | | - pcBuffer.position.set( - 10, 0, 0 ); |
| 188 | + pcBuffer.scale.set( 5, 10, 10 ); |
| 189 | + pcBuffer.position.set( - 5, 0, 0 ); |
194 | 190 | scene.add( pcBuffer ); |
195 | 191 |
|
196 | 192 | var pcIndexed = generateIndexedPointcloud( new THREE.Color( 0, 1, 0 ), width, length ); |
197 | | - pcIndexed.scale.set( 10, 10, 10 ); |
| 193 | + pcIndexed.scale.set( 5, 10, 10 ); |
198 | 194 | pcIndexed.position.set( 0, 0, 0 ); |
199 | 195 | scene.add( pcIndexed ); |
200 | 196 |
|
201 | 197 | var pcIndexedOffset = generateIndexedWithOffsetPointcloud( new THREE.Color( 0, 1, 1 ), width, length ); |
202 | | - pcIndexedOffset.scale.set( 10, 10, 10 ); |
203 | | - pcIndexedOffset.position.set( 10, 0, 0 ); |
| 198 | + pcIndexedOffset.scale.set( 5, 10, 10 ); |
| 199 | + pcIndexedOffset.position.set( 5, 0, 0 ); |
204 | 200 | scene.add( pcIndexedOffset ); |
205 | 201 |
|
206 | 202 | pointclouds = [ pcBuffer, pcIndexed, pcIndexedOffset ]; |
|
0 commit comments