x_ite 5.0.0 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/components/annotation.js +2 -2
- package/dist/assets/components/annotation.min.js +1 -1
- package/dist/assets/components/cad-geometry.js +2 -2
- package/dist/assets/components/cad-geometry.min.js +1 -1
- package/dist/assets/components/cube-map-texturing.js +2 -2
- package/dist/assets/components/cube-map-texturing.min.js +1 -1
- package/dist/assets/components/dis.js +2 -2
- package/dist/assets/components/dis.min.js +1 -1
- package/dist/assets/components/event-utilities.js +2 -2
- package/dist/assets/components/event-utilities.min.js +1 -1
- package/dist/assets/components/geometry2d.js +2 -2
- package/dist/assets/components/geometry2d.min.js +1 -1
- package/dist/assets/components/geospatial.js +2 -2
- package/dist/assets/components/geospatial.min.js +1 -1
- package/dist/assets/components/h-anim.js +2 -2
- package/dist/assets/components/h-anim.min.js +1 -1
- package/dist/assets/components/key-device-sensor.js +2 -2
- package/dist/assets/components/key-device-sensor.min.js +1 -1
- package/dist/assets/components/layout.js +2 -2
- package/dist/assets/components/layout.min.js +1 -1
- package/dist/assets/components/nurbs.js +2 -2
- package/dist/assets/components/nurbs.min.js +1 -1
- package/dist/assets/components/particle-systems.js +2 -2
- package/dist/assets/components/particle-systems.min.js +1 -1
- package/dist/assets/components/picking.js +2 -2
- package/dist/assets/components/picking.min.js +1 -1
- package/dist/assets/components/projective-texture-mapping.js +2 -2
- package/dist/assets/components/projective-texture-mapping.min.js +1 -1
- package/dist/assets/components/rigid-body-physics.js +2 -2
- package/dist/assets/components/rigid-body-physics.min.js +1 -1
- package/dist/assets/components/scripting.js +2 -2
- package/dist/assets/components/scripting.min.js +1 -1
- package/dist/assets/components/texturing-3d.js +2 -2
- package/dist/assets/components/texturing-3d.min.js +1 -1
- package/dist/assets/components/volume-rendering.js +2 -2
- package/dist/assets/components/volume-rendering.min.js +1 -1
- package/dist/assets/components/x_ite.js +2 -2
- package/dist/assets/components/x_ite.min.js +1 -1
- package/dist/assets/shaders/webgl1/Phong.fs +3 -3
- package/dist/assets/shaders/webgl2/Phong.fs +3 -3
- package/dist/example.html +2 -2
- package/dist/x_ite.css +2 -2
- package/dist/x_ite.js +14 -45
- package/dist/x_ite.min.js +4 -4
- package/dist/x_ite.zip +0 -0
- package/docs/_config.yml +1 -1
- package/docs/index.md +2 -2
- package/package.json +3 -3
- package/src/assets/shaders/webgl1/Phong.fs +3 -3
- package/src/assets/shaders/webgl2/Phong.fs +3 -3
- package/src/x_ite/Base/X3DBaseNode.js +8 -2
- package/src/x_ite/Browser/NURBS/NURBS.js +51 -51
- package/src/x_ite/Browser/VERSION.js +1 -1
- package/src/x_ite/Components/Grouping/X3DGroupingNode.js +17 -16
- package/src/x_ite/Components/NURBS/Contour2D.js +53 -14
- package/src/x_ite/Components/NURBS/ContourPolyline2D.js +15 -12
- package/src/x_ite/Components/NURBS/NurbsCurve2D.js +9 -9
- package/src/x_ite/Components/NURBS/NurbsOrientationInterpolator.js +9 -9
- package/src/x_ite/Components/NURBS/NurbsPositionInterpolator.js +6 -6
- package/src/x_ite/Components/NURBS/NurbsSet.js +31 -27
- package/src/x_ite/Components/NURBS/NurbsSurfaceInterpolator.js +10 -10
- package/src/x_ite/Components/NURBS/NurbsSweptSurface.js +5 -5
- package/src/x_ite/Components/NURBS/NurbsSwungSurface.js +4 -4
- package/src/x_ite/Components/NURBS/NurbsTextureCoordinate.js +6 -6
- package/src/x_ite/Components/NURBS/NurbsTrimmedSurface.js +46 -7
- package/src/x_ite/Components/NURBS/X3DNurbsSurfaceGeometryNode.js +30 -32
- package/src/x_ite/Components/Shape/Material.js +0 -20
- package/src/x_ite/Components/Shape/PhysicalMaterial.js +0 -12
- package/src/x_ite/Components/Shape/X3DOneSidedMaterialNode.js +0 -8
|
@@ -131,7 +131,7 @@ function (Fields,
|
|
|
131
131
|
},
|
|
132
132
|
tessellate: function (type)
|
|
133
133
|
{
|
|
134
|
-
|
|
134
|
+
const array = this .array;
|
|
135
135
|
|
|
136
136
|
array .length = 0;
|
|
137
137
|
|
|
@@ -143,22 +143,22 @@ function (Fields,
|
|
|
143
143
|
|
|
144
144
|
// Order and dimension are now positive numbers.
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
const
|
|
147
147
|
closed = this .getClosed (this ._order .getValue (), this ._knot, this ._weight, this ._controlPoint),
|
|
148
148
|
weights = this .getWeights (this .weights, this ._controlPoint .length, this ._weight),
|
|
149
149
|
controlPoints = this .getControlPoints (this .controlPoints, closed, this ._order .getValue (), weights, this ._controlPoint);
|
|
150
150
|
|
|
151
151
|
// Knots
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
const
|
|
154
154
|
knots = this .getKnots (this .knots, closed, this ._order .getValue (), this ._controlPoint .length, this ._knot),
|
|
155
155
|
scale = knots .at (-1) - knots [0];
|
|
156
156
|
|
|
157
157
|
// Initialize NURBS tessellator
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
const degree = this ._order .getValue () - 1;
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
const surface = this .surface = (this .surface || nurbs) ({
|
|
162
162
|
boundary: ["open"],
|
|
163
163
|
degree: [degree],
|
|
164
164
|
knots: [knots],
|
|
@@ -169,7 +169,7 @@ function (Fields,
|
|
|
169
169
|
this .sampleOptions .resolution [0] = this .getTessellation (knots .length);
|
|
170
170
|
this .sampleOptions .haveWeights = Boolean (weights);
|
|
171
171
|
|
|
172
|
-
|
|
172
|
+
const
|
|
173
173
|
mesh = nurbs .sample (this .mesh, surface, this .sampleOptions),
|
|
174
174
|
points = mesh .points;
|
|
175
175
|
|
|
@@ -177,7 +177,7 @@ function (Fields,
|
|
|
177
177
|
{
|
|
178
178
|
case 0:
|
|
179
179
|
{
|
|
180
|
-
for (
|
|
180
|
+
for (let i = 0, length = points .length; i < length; i += 2)
|
|
181
181
|
{
|
|
182
182
|
array .push (points [i], points [i + 1]);
|
|
183
183
|
}
|
|
@@ -186,7 +186,7 @@ function (Fields,
|
|
|
186
186
|
}
|
|
187
187
|
case 1:
|
|
188
188
|
{
|
|
189
|
-
for (
|
|
189
|
+
for (let i = 0, length = points .length; i < length; i += 2)
|
|
190
190
|
{
|
|
191
191
|
array .push (points [i], 0, points [i + 1]);
|
|
192
192
|
}
|
|
@@ -195,7 +195,7 @@ function (Fields,
|
|
|
195
195
|
}
|
|
196
196
|
case 2:
|
|
197
197
|
{
|
|
198
|
-
for (
|
|
198
|
+
for (let i = 0, length = points .length; i < length; i += 2)
|
|
199
199
|
{
|
|
200
200
|
array .push (new Vector3 (points [i], points [i + 1], 0));
|
|
201
201
|
}
|
|
@@ -177,22 +177,22 @@ function (Fields,
|
|
|
177
177
|
|
|
178
178
|
// Order and dimension are now positive numbers.
|
|
179
179
|
|
|
180
|
-
|
|
180
|
+
const
|
|
181
181
|
closed = this .getClosed (this ._order .getValue (), this ._knot, this ._weight, this .controlPointNode),
|
|
182
182
|
weights = this .getWeights (this .weights, this .controlPointNode .getSize (), this ._weight),
|
|
183
183
|
controlPoints = this .getControlPoints (this .controlPoints, closed, this ._order .getValue (), weights, this .controlPointNode);
|
|
184
184
|
|
|
185
185
|
// Knots
|
|
186
186
|
|
|
187
|
-
|
|
187
|
+
const
|
|
188
188
|
knots = this .getKnots (this .knots, closed, this ._order .getValue (), this .controlPointNode .getSize (), this ._knot),
|
|
189
189
|
scale = knots .at (-1) - knots [0];
|
|
190
190
|
|
|
191
191
|
// Initialize NURBS tessellator
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
const degree = this ._order .getValue () - 1;
|
|
194
194
|
|
|
195
|
-
|
|
195
|
+
const surface = this .surface = (this .surface || nurbs) ({
|
|
196
196
|
boundary: ["open"],
|
|
197
197
|
degree: [degree],
|
|
198
198
|
knots: [knots],
|
|
@@ -202,7 +202,7 @@ function (Fields,
|
|
|
202
202
|
|
|
203
203
|
this .sampleOptions .haveWeights = Boolean (weights);
|
|
204
204
|
|
|
205
|
-
|
|
205
|
+
const
|
|
206
206
|
mesh = nurbs .sample (this .mesh, surface, this .sampleOptions),
|
|
207
207
|
points = mesh .points,
|
|
208
208
|
interpolator = this .interpolator;
|
|
@@ -210,11 +210,11 @@ function (Fields,
|
|
|
210
210
|
interpolator ._key .length = 0;
|
|
211
211
|
interpolator ._keyValue .length = 0;
|
|
212
212
|
|
|
213
|
-
for (
|
|
213
|
+
for (let i = 0, length = points .length - 3; i < length; i += 3)
|
|
214
214
|
{
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
215
|
+
const direction = new Vector3 (points [i + 3] - points [i + 0],
|
|
216
|
+
points [i + 4] - points [i + 1],
|
|
217
|
+
points [i + 5] - points [i + 2]);
|
|
218
218
|
|
|
219
219
|
interpolator ._key .push (knots [0] + i / (length - 3 + (3 * closed)) * scale);
|
|
220
220
|
interpolator ._keyValue. push (new Rotation4 (Vector3 .zAxis, direction));
|
|
@@ -173,22 +173,22 @@ function (Fields,
|
|
|
173
173
|
|
|
174
174
|
// Order and dimension are now positive numbers.
|
|
175
175
|
|
|
176
|
-
|
|
176
|
+
const
|
|
177
177
|
closed = this .getClosed (this ._order .getValue (), this ._knot, this ._weight, this .controlPointNode),
|
|
178
178
|
weights = this .getWeights (this .weights, this .controlPointNode .getSize (), this ._weight),
|
|
179
179
|
controlPoints = this .getControlPoints (this .controlPoints, closed, this ._order .getValue (), weights, this .controlPointNode);
|
|
180
180
|
|
|
181
181
|
// Knots
|
|
182
182
|
|
|
183
|
-
|
|
183
|
+
const
|
|
184
184
|
knots = this .getKnots (this .knots, closed, this ._order .getValue (), this .controlPointNode .getSize (), this ._knot),
|
|
185
185
|
scale = knots .at (-1) - knots [0];
|
|
186
186
|
|
|
187
187
|
// Initialize NURBS tessellator
|
|
188
188
|
|
|
189
|
-
|
|
189
|
+
const degree = this ._order .getValue () - 1;
|
|
190
190
|
|
|
191
|
-
|
|
191
|
+
const surface = this .surface = (this .surface || nurbs) ({
|
|
192
192
|
boundary: ["open"],
|
|
193
193
|
degree: [degree],
|
|
194
194
|
knots: [knots],
|
|
@@ -198,7 +198,7 @@ function (Fields,
|
|
|
198
198
|
|
|
199
199
|
this .sampleOptions .haveWeights = Boolean (weights);
|
|
200
200
|
|
|
201
|
-
|
|
201
|
+
const
|
|
202
202
|
mesh = nurbs .sample (this .mesh, surface, this .sampleOptions),
|
|
203
203
|
points = mesh .points,
|
|
204
204
|
interpolator = this .interpolator;
|
|
@@ -206,7 +206,7 @@ function (Fields,
|
|
|
206
206
|
interpolator ._key .length = 0;
|
|
207
207
|
interpolator ._keyValue .length = 0;
|
|
208
208
|
|
|
209
|
-
for (
|
|
209
|
+
for (let i = 0, length = points .length; i < length; i += 3)
|
|
210
210
|
{
|
|
211
211
|
interpolator ._key .push (knots [0] + i / (length - 3) * scale);
|
|
212
212
|
interpolator ._keyValue. push (new Fields .SFVec3f (points [i], points [i + 1], points [i + 2]));
|
|
@@ -66,18 +66,6 @@ function (Fields,
|
|
|
66
66
|
{
|
|
67
67
|
"use strict";
|
|
68
68
|
|
|
69
|
-
function remove (array, first, last, range, rfirst, rlast)
|
|
70
|
-
{
|
|
71
|
-
var set = { };
|
|
72
|
-
|
|
73
|
-
for (var i = rfirst; i < rlast; ++ i)
|
|
74
|
-
set [getId (range [i])] = true;
|
|
75
|
-
|
|
76
|
-
function compare (value) { return set [getId (value)]; }
|
|
77
|
-
|
|
78
|
-
return array .remove (first, last, compare);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
69
|
function NurbsSet (executionContext)
|
|
82
70
|
{
|
|
83
71
|
X3DChildNode .call (this, executionContext);
|
|
@@ -131,49 +119,53 @@ function (Fields,
|
|
|
131
119
|
{
|
|
132
120
|
// Add bounding boxes
|
|
133
121
|
|
|
134
|
-
for (
|
|
135
|
-
|
|
136
|
-
bbox .add (this .geometryNodes [i] .getBBox ());
|
|
137
|
-
}
|
|
122
|
+
for (const geometryNode of this .geometryNodes)
|
|
123
|
+
bbox .add (geometryNode .getBBox ());
|
|
138
124
|
|
|
139
125
|
return bbox;
|
|
140
126
|
},
|
|
141
127
|
set_tessellationScale__: function ()
|
|
142
128
|
{
|
|
143
|
-
|
|
129
|
+
const tessellationScale = Math .max (0, this ._tessellationScale .getValue ());
|
|
144
130
|
|
|
145
|
-
for (
|
|
146
|
-
|
|
131
|
+
for (const geometryNode of this .geometryNodes)
|
|
132
|
+
geometryNode .setTessellationScale (tessellationScale);
|
|
147
133
|
},
|
|
148
134
|
set_addGeometry__: function ()
|
|
149
135
|
{
|
|
150
136
|
this ._addGeometry .setTainted (true);
|
|
151
137
|
|
|
152
138
|
this ._addGeometry .erase (remove (this ._addGeometry, 0, this ._addGeometry .length,
|
|
153
|
-
this ._geometry,
|
|
139
|
+
this ._geometry, 0, this ._geometry .length),
|
|
154
140
|
this ._addGeometry .length);
|
|
155
141
|
|
|
156
|
-
for (
|
|
157
|
-
this ._geometry .push (
|
|
142
|
+
for (const geometry of this ._addGeometry)
|
|
143
|
+
this ._geometry .push (geometry);
|
|
158
144
|
|
|
145
|
+
this ._addGeometry .length = 0;
|
|
159
146
|
this ._addGeometry .setTainted (false);
|
|
160
147
|
},
|
|
161
148
|
set_removeGeometry__: function ()
|
|
162
149
|
{
|
|
150
|
+
this ._removeGeometry .setTainted (true);
|
|
151
|
+
|
|
163
152
|
this ._geometry .erase (remove (this ._geometry, 0, this ._geometry .length,
|
|
164
153
|
this ._removeGeometry, 0, this ._removeGeometry .length),
|
|
165
|
-
this .
|
|
154
|
+
this ._geometry .length);
|
|
155
|
+
|
|
156
|
+
this ._removeGeometry .length = 0;
|
|
157
|
+
this ._removeGeometry .setTainted (false);
|
|
166
158
|
},
|
|
167
159
|
set_geometry__: function ()
|
|
168
160
|
{
|
|
169
|
-
for (
|
|
170
|
-
|
|
161
|
+
for (const geometryNode of this .geometryNodes)
|
|
162
|
+
geometryNode .setTessellationScale (1);
|
|
171
163
|
|
|
172
164
|
this .geometryNodes .length = 0;
|
|
173
165
|
|
|
174
|
-
for (
|
|
166
|
+
for (const node of this ._geometry)
|
|
175
167
|
{
|
|
176
|
-
|
|
168
|
+
const geometryNode = X3DCast (X3DConstants .X3DNurbsSurfaceGeometryNode, node);
|
|
177
169
|
|
|
178
170
|
if (geometryNode)
|
|
179
171
|
this .geometryNodes .push (geometryNode);
|
|
@@ -183,5 +175,17 @@ function (Fields,
|
|
|
183
175
|
},
|
|
184
176
|
});
|
|
185
177
|
|
|
178
|
+
function remove (array, first, last, range, rfirst, rlast)
|
|
179
|
+
{
|
|
180
|
+
const set = new Set ();
|
|
181
|
+
|
|
182
|
+
for (let i = rfirst; i < rlast; ++ i)
|
|
183
|
+
set .add (range [i]);
|
|
184
|
+
|
|
185
|
+
function compare (value) { return set .has (value); }
|
|
186
|
+
|
|
187
|
+
return array .remove (first, last, compare);
|
|
188
|
+
}
|
|
189
|
+
|
|
186
190
|
return NurbsSet;
|
|
187
191
|
});
|
|
@@ -136,7 +136,7 @@ function (Fields,
|
|
|
136
136
|
},
|
|
137
137
|
set_fraction__: (function ()
|
|
138
138
|
{
|
|
139
|
-
|
|
139
|
+
const
|
|
140
140
|
a = new Vector3 (0, 0, 0),
|
|
141
141
|
b = new Vector3 (0, 0, 0),
|
|
142
142
|
c = new Vector3 (0, 0, 0),
|
|
@@ -146,13 +146,13 @@ function (Fields,
|
|
|
146
146
|
|
|
147
147
|
return function ()
|
|
148
148
|
{
|
|
149
|
-
|
|
149
|
+
const
|
|
150
150
|
fraction = this ._set_fraction .getValue (),
|
|
151
151
|
texCoordsArray = this .geometry .getTexCoords (),
|
|
152
152
|
normalArray = this .geometry .getNormals (),
|
|
153
153
|
verticesArray = this .geometry .getVertices ();
|
|
154
154
|
|
|
155
|
-
for (
|
|
155
|
+
for (let i4 = 0, i3 = 0, length = texCoordsArray .length; i4 < length; i4 += 12, i3 += 9)
|
|
156
156
|
{
|
|
157
157
|
a .set (texCoordsArray [i4 + 0], texCoordsArray [i4 + 1], 0);
|
|
158
158
|
b .set (texCoordsArray [i4 + 4], texCoordsArray [i4 + 5], 0);
|
|
@@ -164,18 +164,18 @@ function (Fields,
|
|
|
164
164
|
|
|
165
165
|
if (line .intersectsTriangle (a, b, c, uvt))
|
|
166
166
|
{
|
|
167
|
-
|
|
167
|
+
const
|
|
168
168
|
u = uvt .u,
|
|
169
169
|
v = uvt .v,
|
|
170
170
|
t = uvt .t;
|
|
171
171
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
172
|
+
const normal = new Vector3 (t * normalArray [i3 + 0] + u * normalArray [i3 + 3] + v * normalArray [i3 + 6],
|
|
173
|
+
t * normalArray [i3 + 1] + u * normalArray [i3 + 4] + v * normalArray [i3 + 7],
|
|
174
|
+
t * normalArray [i3 + 2] + u * normalArray [i3 + 5] + v * normalArray [i3 + 8]);
|
|
175
175
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
const position = new Vector3 (t * verticesArray [i4 + 0] + u * verticesArray [i4 + 4] + v * verticesArray [i4 + 8],
|
|
177
|
+
t * verticesArray [i4 + 1] + u * verticesArray [i4 + 5] + v * verticesArray [i4 + 9],
|
|
178
|
+
t * verticesArray [i4 + 2] + u * verticesArray [i4 + 6] + v * verticesArray [i4 + 10]);
|
|
179
179
|
|
|
180
180
|
this ._normal_changed = normal;
|
|
181
181
|
this ._position_changed = position;
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
******************************************************************************/
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
define ([
|
|
50
|
+
define ([
|
|
51
51
|
"x_ite/Fields",
|
|
52
52
|
"x_ite/Base/X3DFieldDefinition",
|
|
53
53
|
"x_ite/Base/FieldDefinitionArray",
|
|
@@ -104,7 +104,7 @@ function (Fields,
|
|
|
104
104
|
this ._crossSectionCurve .addInterest ("set_crossSectionCurve__", this);
|
|
105
105
|
this ._trajectoryCurve .addInterest ("set_trajectoryCurve__", this);
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
const extrusion = this .extrusion;
|
|
108
108
|
|
|
109
109
|
extrusion ._beginCap = false;
|
|
110
110
|
extrusion ._endCap = false;
|
|
@@ -149,7 +149,7 @@ function (Fields,
|
|
|
149
149
|
if (! this .trajectoryCurveNode)
|
|
150
150
|
return;
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
const extrusion = this .extrusion;
|
|
153
153
|
|
|
154
154
|
extrusion ._crossSection = this .crossSectionCurveNode .tessellate (0);
|
|
155
155
|
extrusion ._spine = this .trajectoryCurveNode .tessellate (0);
|
|
@@ -165,9 +165,9 @@ function (Fields,
|
|
|
165
165
|
|
|
166
166
|
if (! this ._ccw .getValue ())
|
|
167
167
|
{
|
|
168
|
-
|
|
168
|
+
const normals = this .getNormals ();
|
|
169
169
|
|
|
170
|
-
for (
|
|
170
|
+
for (let i = 0, length = normals .length; i < length; ++ i)
|
|
171
171
|
normals [i] = -normals [i];
|
|
172
172
|
}
|
|
173
173
|
|
|
@@ -104,7 +104,7 @@ function (Fields,
|
|
|
104
104
|
this ._profileCurve .addInterest ("set_profileCurve__", this);
|
|
105
105
|
this ._trajectoryCurve .addInterest ("set_trajectoryCurve__", this);
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
const extrusion = this .extrusion;
|
|
108
108
|
|
|
109
109
|
extrusion ._beginCap = false;
|
|
110
110
|
extrusion ._endCap = false;
|
|
@@ -149,7 +149,7 @@ function (Fields,
|
|
|
149
149
|
if (! this .trajectoryCurveNode)
|
|
150
150
|
return;
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
const extrusion = this .extrusion;
|
|
153
153
|
|
|
154
154
|
extrusion ._crossSection = this .profileCurveNode .tessellate (0);
|
|
155
155
|
extrusion ._spine = this .trajectoryCurveNode .tessellate (1);
|
|
@@ -165,9 +165,9 @@ function (Fields,
|
|
|
165
165
|
|
|
166
166
|
if (! this ._ccw .getValue ())
|
|
167
167
|
{
|
|
168
|
-
|
|
168
|
+
const normals = this .getNormals ();
|
|
169
169
|
|
|
170
|
-
for (
|
|
170
|
+
for (let i = 0, length = normals .length; i < length; ++ i)
|
|
171
171
|
normals [i] = -normals [i];
|
|
172
172
|
}
|
|
173
173
|
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
******************************************************************************/
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
define ([
|
|
50
|
+
define ([
|
|
51
51
|
"x_ite/Fields",
|
|
52
52
|
"x_ite/Base/X3DFieldDefinition",
|
|
53
53
|
"x_ite/Base/FieldDefinitionArray",
|
|
@@ -105,20 +105,20 @@ function (Fields,
|
|
|
105
105
|
},
|
|
106
106
|
getControlPoints: function (texWeights)
|
|
107
107
|
{
|
|
108
|
-
|
|
108
|
+
const
|
|
109
109
|
controlPointArray = this ._controlPoint .getValue (),
|
|
110
110
|
controlPoints = this .controlPoints;
|
|
111
111
|
|
|
112
|
-
for (
|
|
112
|
+
for (let u = 0, uDimension = this ._uDimension .getValue (); u < uDimension; ++ u)
|
|
113
113
|
{
|
|
114
|
-
|
|
114
|
+
let cp = controlPoints [u];
|
|
115
115
|
|
|
116
116
|
if (! cp)
|
|
117
117
|
cp = controlPoints [u] = [ ];
|
|
118
118
|
|
|
119
|
-
for (
|
|
119
|
+
for (let v = 0, vDimension = this ._vDimension .getValue (); v < vDimension; ++ v)
|
|
120
120
|
{
|
|
121
|
-
|
|
121
|
+
const
|
|
122
122
|
index = v * uDimension + u,
|
|
123
123
|
p = cp [v] || new Vector4 (),
|
|
124
124
|
i = index * 2;
|
|
@@ -112,19 +112,46 @@ function (Fields,
|
|
|
112
112
|
{
|
|
113
113
|
X3DNurbsSurfaceGeometryNode .prototype .initialize .call (this);
|
|
114
114
|
|
|
115
|
-
this .
|
|
115
|
+
this ._addTrimmingContour .addInterest ("set_addTrimmingContour__", this);
|
|
116
|
+
this ._removeTrimmingContour .addInterest ("set_removeTrimmingContour__", this);
|
|
117
|
+
this ._trimmingContour .addInterest ("set_trimmingContour__", this);
|
|
116
118
|
|
|
117
119
|
this .set_trimmingContour__ ();
|
|
118
120
|
},
|
|
121
|
+
set_addTrimmingContour__: function ()
|
|
122
|
+
{
|
|
123
|
+
this ._addTrimmingContour .setTainted (true);
|
|
124
|
+
|
|
125
|
+
this ._addTrimmingContour .erase (remove (this ._addTrimmingContour, 0, this ._addTrimmingContour .length,
|
|
126
|
+
this ._trimmingContour, 0, this ._trimmingContour .length),
|
|
127
|
+
this ._addTrimmingContour .length);
|
|
128
|
+
|
|
129
|
+
for (const trimmingContour of this ._addTrimmingContour)
|
|
130
|
+
this ._trimmingContour .push (trimmingContour);
|
|
131
|
+
|
|
132
|
+
this ._addTrimmingContour .length = 0;
|
|
133
|
+
this ._addTrimmingContour .setTainted (false);
|
|
134
|
+
},
|
|
135
|
+
set_removeTrimmingContour__: function ()
|
|
136
|
+
{
|
|
137
|
+
this ._removeTrimmingContour .setTainted (true);
|
|
138
|
+
|
|
139
|
+
this ._trimmingContour .erase (remove (this ._trimmingContour, 0, this ._trimmingContour .length,
|
|
140
|
+
this ._removeTrimmingContour, 0, this ._removeTrimmingContour .length),
|
|
141
|
+
this ._trimmingContour .length);
|
|
142
|
+
|
|
143
|
+
this ._removeTrimmingContour .length = 0;
|
|
144
|
+
this ._removeTrimmingContour .setTainted (false);
|
|
145
|
+
},
|
|
119
146
|
set_trimmingContour__: function ()
|
|
120
147
|
{
|
|
121
|
-
|
|
148
|
+
const trimmingContourNodes = this .trimmingContourNodes;
|
|
122
149
|
|
|
123
150
|
trimmingContourNodes .length = 0;
|
|
124
151
|
|
|
125
|
-
for (
|
|
152
|
+
for (const node of this ._trimmingContour)
|
|
126
153
|
{
|
|
127
|
-
|
|
154
|
+
const trimmingContourNode = X3DCast (X3DConstants .Contour2D, node);
|
|
128
155
|
|
|
129
156
|
if (trimmingContourNode)
|
|
130
157
|
trimmingContourNodes .push (trimmingContourNode);
|
|
@@ -132,16 +159,28 @@ function (Fields,
|
|
|
132
159
|
},
|
|
133
160
|
getTrimmingContours: function ()
|
|
134
161
|
{
|
|
135
|
-
|
|
162
|
+
const
|
|
136
163
|
trimmingContourNodes = this .trimmingContourNodes,
|
|
137
164
|
trimmingContours = [ ];
|
|
138
165
|
|
|
139
|
-
for (
|
|
140
|
-
|
|
166
|
+
for (const trimmingContourNode of trimmingContourNodes)
|
|
167
|
+
trimmingContourNode .addTrimmingContour (trimmingContours);
|
|
141
168
|
|
|
142
169
|
return trimmingContours;
|
|
143
170
|
},
|
|
144
171
|
});
|
|
145
172
|
|
|
173
|
+
function remove (array, first, last, range, rfirst, rlast)
|
|
174
|
+
{
|
|
175
|
+
const set = new Set ();
|
|
176
|
+
|
|
177
|
+
for (let i = rfirst; i < rlast; ++ i)
|
|
178
|
+
set .add (range [i]);
|
|
179
|
+
|
|
180
|
+
function compare (value) { return set .has (value); }
|
|
181
|
+
|
|
182
|
+
return array .remove (first, last, compare);
|
|
183
|
+
}
|
|
184
|
+
|
|
146
185
|
return NurbsTrimmedSurface;
|
|
147
186
|
});
|