PageSourceSearch

https://stlbuddy.com/_next/static/chunks/9006-47b70018dff5e60e.js

js stlbuddy.com collected 2026-10-08 02:52:16 UTC 17,516 bytes, 370 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9006],{473:(e,t,i)=>{i.d(t,{G:()=>a});var n=i(87548),r=i(85339);n.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new r.I9Y(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},n.ShaderLib.line={uniforms:r.LlO.merge([n.UniformsLib.common,n.UniformsLib.fog,n.UniformsLib.line]),vertexShader:`
2		#include <common>
3		#include <color_pars_vertex>
4		#include <fog_pars_vertex>
5		#include <logdepthbuf_pars_vertex>
6		#include <clipping_planes_pars_vertex>
7
8		uniform float linewidth;
9		uniform vec2 resolution;
10
11		attribute vec3 instanceStart;
12		attribute vec3 instanceEnd;
13
14		attribute vec3 instanceColorStart;
15		attribute vec3 instanceColorEnd;
16
17		#ifdef WORLD_UNITS
18
19			varying vec4 worldPos;
20			varying vec3 worldStart;
21			varying vec3 worldEnd;
22
23			#ifdef USE_DASH
24
25				varying vec2 vUv;
26
27			#endif
28
29		#else
30
31			varying vec2 vUv;
32
33		#endif
34
35		#ifdef USE_DASH
36
37			uniform float dashScale;
38			attribute float instanceDistanceStart;
39			attribute float instanceDistanceEnd;
40			varying float vLineDistance;
41
42		#endif
43
44		void trimSegment( const in vec4 start, inout vec4 end ) {
45
46			// trim end segment so it terminates between the camera plane and the near plane
47
48			// conservative estimate of the near plane
49			float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
50			float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
51			float nearEstimate = - 0.5 * b / a;
52
53			float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
54
55			end.xyz = mix( start.xyz, end.xyz, alpha );
56
57		}
58
59		void main() {
60
61			#ifdef USE_COLOR
62
63				vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
64
65			#endif
66
67			#ifdef USE_DASH
68
69				vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
70				vUv = uv;
71
72			#endif
73
74			float aspect = resolution.x / resolution.y;
75
76			// camera space
77			vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
78			vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
79
80			#ifdef WORLD_UNITS
81
82				worldStart = start.xyz;
83				worldEnd = end.xyz;
84
85			#else
86
87				vUv = uv;
88
89			#endif
90
91			// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
92			// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
93			// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
94			// perhaps there is a more elegant solution -- WestLangley
95
96			bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
97
98			if ( perspective ) {
99
100				if ( start.z < 0.0 && end.z >= 0.0 ) {
101
102					trimSegment( start, end );
103
104				} else if ( end.z < 0.0 && start.z >= 0.0 ) {
105
106					trimSegment( end, start );
107
108				}
109
110			}
111
112			// clip space
113			vec4 clipStart = projectionMatrix * start;
114			vec4 clipEnd = projectionMatrix * end;
115
116			// ndc space
117			vec3 ndcStart = clipStart.xyz / clipStart.w;
118			vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
119
120			// direction
121			vec2 dir = ndcEnd.xy - ndcStart.xy;
122
123			// account for clip-space aspect ratio
124			dir.x *= aspect;
125			dir = normalize( dir );
126
127			#ifdef WORLD_UNITS
128
129				vec3 worldDir = normalize( end.xyz - start.xyz );
130				vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );
131				vec3 worldUp = normalize( cross( worldDir, tmpFwd ) );
132				vec3 worldFwd = cross( worldDir, worldUp );
133				worldPos = position.y < 0.5 ? start: end;
134
135				// height offset
136				float hw = linewidth * 0.5;
137				worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;
138
139				// don't extend the line if we're rendering dashes because we
140				// won't be rendering the endcaps
141				#ifndef USE_DASH
142
143					// cap extension
144					worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;
145
146					// add width to the box
147					worldPos.xyz += worldFwd * hw;
148
149					// endcaps
150					if ( position.y > 1.0 || position.y < 0.0 ) {
151
152						worldPos.xyz -= worldFwd * 2.0 * hw;
153
154					}
155
156				#endif
157
158				// project the worldpos
159				vec4 clip = projectionMatrix * worldPos;
160
161				// shift the depth of the projected points so the line
162				// segments overlap neatly
163				vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
164				clip.z = clipPose.z * clip.w;
165
166			#else
167
168				vec2 offset = vec2( dir.y, - dir.x );
169				// undo aspect ratio adjustment
170				dir.x /= aspect;
171				offset.x /= aspect;
172
173				// sign flip
174				if ( position.x < 0.0 ) offset *= - 1.0;
175
176				// endcaps
177				if ( position.y < 0.0 ) {
178
179					offset += - dir;
180
181				} else if ( position.y > 1.0 ) {
182
183					offset += dir;
184
185				}
186
187				// adjust for linewidth
188				offset *= linewidth;
189
190				// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
191				offset /= resolution.y;
192
193				// select end
194				vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
195
196				// back to clip space
197				offset *= clip.w;
198
199				clip.xy += offset;
200
201			#endif
202
203			gl_Position = clip;
204
205			vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
206
207			#include <logdepthbuf_vertex>
208			#include <clipping_planes_vertex>
209			#include <fog_vertex>
210
211		}
212		`,fragmentShader:`
213		uniform vec3 diffuse;
214		uniform float opacity;
215		uniform float linewidth;
216
217		#ifdef USE_DASH
218
219			uniform float dashOffset;
220			uniform float dashSize;
221			uniform float gapSize;
222
223		#endif
224
225		varying float vLineDistance;
226
227		#ifdef WORLD_UNITS
228
229			varying vec4 worldPos;
230			varying vec3 worldStart;
231			varying vec3 worldEnd;
232
233			#ifdef USE_DASH
234
235				varying vec2 vUv;
236
237			#endif
238
239		#else
240
241			varying vec2 vUv;
242
243		#endif
244
245		#include <common>
246		#include <color_pars_fragment>
247		#include <fog_pars_fragment>
248		#include <logdepthbuf_pars_fragment>
249		#include <clipping_planes_pars_fragment>
250
251		vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
252
253			float mua;
254			float mub;
255
256			vec3 p13 = p1 - p3;
257			vec3 p43 = p4 - p3;
258
259			vec3 p21 = p2 - p1;
260
261			float d1343 = dot( p13, p43 );
262			float d4321 = dot( p43, p21 );
263			float d1321 = dot( p13, p21 );
264			float d4343 = dot( p43, p43 );
265			float d2121 = dot( p21, p21 );
266
267			float denom = d2121 * d4343 - d4321 * d4321;
268
269			float numer = d1343 * d4321 - d1321 * d4343;
270
271			mua = numer / denom;
272			mua = clamp( mua, 0.0, 1.0 );
273			mub = ( d1343 + d4321 * ( mua ) ) / d4343;
274			mub = clamp( mub, 0.0, 1.0 );
275
276			return vec2( mua, mub );
277
278		}
279
280		void main() {
281
282			float alpha = opacity;
283			vec4 diffuseColor = vec4( diffuse, alpha );
284
285			#include <clipping_planes_fragment>
286
287			#ifdef USE_DASH
288
289				if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
290
291				if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
292
293			#endif
294
295			#ifdef WORLD_UNITS
296
297				// Find the closest points on the view ray and the line segment
298				vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
299				vec3 lineDir = worldEnd - worldStart;
300				vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
301
302				vec3 p1 = worldStart + lineDir * params.x;
303				vec3 p2 = rayEnd * params.y;
304				vec3 delta = p1 - p2;
305				float len = length( delta );
306				float norm = len / linewidth;
307
308				#ifndef USE_DASH
309
310					#ifdef USE_ALPHA_TO_COVERAGE
311
312						float dnorm = fwidth( norm );
313						alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
314
315					#else
316
317						if ( norm > 0.5 ) {
318
319							discard;
320
321						}
322
323					#endif
324
325				#endif
326
327			#else
328
329				#ifdef USE_ALPHA_TO_COVERAGE
330
331					// artifacts appear on some hardware if a derivative is taken within a conditional
332					float a = vUv.x;
333					float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
334					float len2 = a * a + b * b;
335					float dlen = fwidth( len2 );
336
337					if ( abs( vUv.y ) > 1.0 ) {
338
339						alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
340
341					}
342
343				#else
344
345					if ( abs( vUv.y ) > 1.0 ) {
346
347						float a = vUv.x;
348						float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
349						float len2 = a * a + b * b;
350
351						if ( len2 > 1.0 ) discard;
352
353					}
354
355				#endif
356
357			#endif
358
359			#include <logdepthbuf_fragment>
360			#include <color_fragment>
361
362			gl_FragColor = vec4( diffuseColor.rgb, alpha );
363
364			#include <tonemapping_fragment>
365			#include <colorspace_fragment>
366			#include <fog_fragment>
367			#include <premultiplied_alpha_fragment>
368
369		}
370		`};class a extends r.BKk{constructor(e){super({type:"LineMaterial",uniforms:r.LlO.clone(n.ShaderLib.line.uniforms),vertexShader:n.ShaderLib.line.vertexShader,fragmentShader:n.ShaderLib.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){!0===e!==this.dashed&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(!0===e!==this.alphaToCoverage&&(this.needsUpdate=!0),!0===e?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}},35330:(e,t,i)=>{i.d(t,{n:()=>s});var n=i(85339);let r=new n.NRn,a=new n.Pq0;class s extends n.CmU{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry",this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new n.qtW([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new n.qtW([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){let t=this.attributes.instanceStart,i=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),i.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let i=new n.LuO(t,6,1);return this.setAttribute("instanceStart",new n.eHs(i,3,0)),this.setAttribute("instanceEnd",new n.eHs(i,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let i=new n.LuO(t,6,1);return this.setAttribute("instanceColorStart",new n.eHs(i,3,0)),this.setAttribute("instanceColorEnd",new n.eHs(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new n.XJ7(e.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}
370computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new n.NRn);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),r.setFromBufferAttribute(t),this.boundingBox.union(r))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new n.iyt),null===this.boundingBox&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){let i=this.boundingSphere.center;this.boundingBox.getCenter(i);let n=0;for(let r=0,s=e.count;r<s;r++)a.fromBufferAttribute(e,r),n=Math.max(n,i.distanceToSquared(a)),a.fromBufferAttribute(t,r),n=Math.max(n,i.distanceToSquared(a));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}},71847:(e,t,i)=>{i.d(t,{A:()=>l});var n=i(12115);let r=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,i)=>i?i.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)},a=function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];return t.filter((e,t,i)=>!!e&&""!==e.trim()&&i.indexOf(e)===t).join(" ").trim()};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,n.forwardRef)((e,t)=>{let{color:i="currentColor",size:r=24,strokeWidth:o=2,absoluteStrokeWidth:l,className:d="",children:c,iconNode:u,...f}=e;return(0,n.createElement)("svg",{ref:t,...s,width:r,height:r,stroke:i,strokeWidth:l?24*Number(o)/Number(r):o,className:a("lucide",d),...!c&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0})(f)&&{"aria-hidden":"true"},...f},[...u.map(e=>{let[t,i]=e;return(0,n.createElement)(t,i)}),...Array.isArray(c)?c:[c]])}),l=(e,t)=>{let i=(0,n.forwardRef)((i,s)=>{let{className:l,...d}=i;return(0,n.createElement)(o,{ref:s,iconNode:t,className:a("lucide-".concat(r(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),"lucide-".concat(e),l),...d})});return i.displayName=r(e),i}},74956:(e,t,i)=>{let n,r;i.d(t,{b:()=>b});var a=i(85339),s=i(35330),o=i(473);let l=new a.IUQ,d=new a.Pq0,c=new a.Pq0,u=new a.IUQ,f=new a.IUQ,p=new a.IUQ,h=new a.Pq0,m=new a.kn4,v=new a.cZY,y=new a.Pq0,w=new a.NRn,g=new a.iyt,S=new a.IUQ;function x(e,t,i){return S.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),S.multiplyScalar(1/S.w),S.x=r/i.width,S.y=r/i.height,S.applyMatrix4(e.projectionMatrixInverse),S.multiplyScalar(1/S.w),Math.abs(Math.max(S.x,S.y))}class b extends a.eaF{constructor(e=new s.n,t=new o.G({color:0xffffff*Math.random()})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,n=new Float32Array(2*t.count);for(let e=0,r=0,a=t.count;e<a;e++,r+=2)d.fromBufferAttribute(t,e),c.fromBufferAttribute(i,e),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+d.distanceTo(c);let r=new a.LuO(n,2,1);return e.setAttribute("instanceDistanceStart",new a.eHs(r,1,0)),e.setAttribute("instanceDistanceEnd",new a.eHs(r,1,1)),this}raycast(e,t){let i,s,o=this.material.worldUnits,l=e.camera;null!==l||o||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');let d=void 0!==e.params.Line2&&e.params.Line2.threshold||0;n=e.ray;let c=this.matrixWorld,S=this.geometry,b=this.material;if(r=b.linewidth+d,null===S.boundingSphere&&S.computeBoundingSphere(),g.copy(S.boundingSphere).applyMatrix4(c),o)i=.5*r;else{let e=Math.max(l.near,g.distanceToPoint(n.origin));i=x(l,e,b.resolution)}if(g.radius+=i,!1!==n.intersectsSphere(g)){if(null===S.boundingBox&&S.computeBoundingBox(),w.copy(S.boundingBox).applyMatrix4(c),o)s=.5*r;else{let e=Math.max(l.near,w.distanceToPoint(n.origin));s=x(l,e,b.resolution)}w.expandByScalar(s),!1!==n.intersectsBox(w)&&(o?function(e,t){let i=e.matrixWorld,s=e.geometry,o=s.attributes.instanceStart,l=s.attributes.instanceEnd,d=Math.min(s.instanceCount,o.count);for(let s=0;s<d;
370s++){v.start.fromBufferAttribute(o,s),v.end.fromBufferAttribute(l,s),v.applyMatrix4(i);let d=new a.Pq0,c=new a.Pq0;n.distanceSqToSegment(v.start,v.end,c,d),c.distanceTo(d)<.5*r&&t.push({point:c,pointOnLine:d,distance:n.origin.distanceTo(c),object:e,face:null,faceIndex:s,uv:null,uv1:null})}}(this,t):function(e,t,i){let s=t.projectionMatrix,o=e.material.resolution,l=e.matrixWorld,d=e.geometry,c=d.attributes.instanceStart,w=d.attributes.instanceEnd,g=Math.min(d.instanceCount,c.count),S=-t.near;n.at(1,p),p.w=1,p.applyMatrix4(t.matrixWorldInverse),p.applyMatrix4(s),p.multiplyScalar(1/p.w),p.x*=o.x/2,p.y*=o.y/2,p.z=0,h.copy(p),m.multiplyMatrices(t.matrixWorldInverse,l);for(let t=0;t<g;t++){if(u.fromBufferAttribute(c,t),f.fromBufferAttribute(w,t),u.w=1,f.w=1,u.applyMatrix4(m),f.applyMatrix4(m),u.z>S&&f.z>S)continue;if(u.z>S){let e=u.z-f.z,t=(u.z-S)/e;u.lerp(f,t)}else if(f.z>S){let e=f.z-u.z,t=(f.z-S)/e;f.lerp(u,t)}u.applyMatrix4(s),f.applyMatrix4(s),u.multiplyScalar(1/u.w),f.multiplyScalar(1/f.w),u.x*=o.x/2,u.y*=o.y/2,f.x*=o.x/2,f.y*=o.y/2,v.start.copy(u),v.start.z=0,v.end.copy(f),v.end.z=0;let d=v.closestPointToPointParameter(h,!0);v.at(d,y);let p=a.cj9.lerp(u.z,f.z,d),g=p>=-1&&p<=1,x=h.distanceTo(y)<.5*r;if(g&&x){v.start.fromBufferAttribute(c,t),v.end.fromBufferAttribute(w,t),v.start.applyMatrix4(l),v.end.applyMatrix4(l);let r=new a.Pq0,s=new a.Pq0;n.distanceSqToSegment(v.start,v.end,s,r),i.push({point:s,pointOnLine:r,distance:n.origin.distanceTo(s),object:e,face:null,faceIndex:t,uv:null,uv1:null})}}}(this,l,t))}}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(l),this.material.uniforms.resolution.value.set(l.z,l.w))}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.