@kitware/vtk.js 23.4.2 → 23.4.4
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/Common/Core/Math/Constants.js +12 -0
- package/Common/Core/Math/index.js +1 -1
- package/Common/Core/Math.js +1 -1
- package/Common/Core/ScalarsToColors/Constants.d.ts +18 -0
- package/Common/DataModel/AbstractPointLocator.d.ts +54 -0
- package/Common/DataModel/AbstractPointLocator.js +40 -0
- package/Common/DataModel/BoundingBox.d.ts +659 -0
- package/Common/DataModel/Collection.d.ts +118 -0
- package/Common/DataModel/Collection.js +113 -0
- package/Common/DataModel/DataSet/Constants.d.ts +27 -0
- package/Common/DataModel/EdgeLocator.d.ts +79 -0
- package/Common/DataModel/EdgeLocator.js +85 -0
- package/Common/DataModel/ITKHelper.d.ts +54 -0
- package/Common/DataModel/IncrementalOctreeNode.d.ts +297 -0
- package/Common/DataModel/IncrementalOctreeNode.js +640 -0
- package/Common/DataModel/IncrementalOctreePointLocator.d.ts +61 -0
- package/Common/DataModel/IncrementalOctreePointLocator.js +398 -0
- package/Common/DataModel/Locator.d.ts +43 -0
- package/Common/DataModel/Locator.js +37 -0
- package/Common/DataModel/Plane.js +1 -1
- package/Common/DataModel/PolyData/Constants.d.ts +6 -0
- package/Common/DataModel/PolyLine.d.ts +63 -0
- package/Common/DataModel/PolyLine.js +77 -0
- package/Common/DataModel/Polygon/Constants.js +12 -0
- package/Common/DataModel/Polygon.js +1 -1
- package/Common/DataModel/Quad/Constants.js +9 -0
- package/Common/DataModel/Quad.d.ts +91 -0
- package/Common/DataModel/Quad.js +235 -0
- package/Common/DataModel/SelectionNode/Constants.d.ts +27 -0
- package/Common/DataModel/Spline1D/Constants.js +17 -0
- package/Common/DataModel/Spline3D/Constants.d.ts +9 -0
- package/Common/Transform/Transform.js +51 -0
- package/Filters/Core/PolyDataNormals.js +124 -0
- package/Filters/General/ClipClosedSurface/Constants.js +10 -0
- package/Filters/General/ClipClosedSurface.d.ts +95 -0
- package/Filters/General/ClipClosedSurface.js +972 -0
- package/Filters/General/ContourTriangulator/Constants.js +6 -0
- package/Filters/General/ContourTriangulator/helper.js +1951 -0
- package/Filters/General/ContourTriangulator.d.ts +136 -0
- package/Filters/General/ContourTriangulator.js +202 -0
- package/Filters/General/ImageMarchingCubes.js +1 -1
- package/Filters/General/MoleculeToRepresentation.js +1 -1
- package/Filters/General/OBBTree/OBBNode.js +82 -0
- package/Filters/General/OBBTree/helper.js +92 -0
- package/Filters/General/OBBTree.js +1243 -0
- package/Filters/General/TubeFilter.js +1 -1
- package/Filters/Sources/LineSource.js +1 -1
- package/Filters/Sources/PlaneSource.js +1 -1
- package/Filters/Texture/TextureMapToPlane.js +1 -1
- package/Interaction/Manipulators/CompositeCameraManipulator.d.ts +68 -0
- package/Interaction/Manipulators/CompositeGestureManipulator.d.ts +168 -0
- package/Interaction/Manipulators/CompositeKeyboardManipulator.d.ts +48 -0
- package/Interaction/Manipulators/CompositeMouseManipulator.d.ts +149 -0
- package/Interaction/Manipulators/CompositeVRManipulator.d.ts +44 -0
- package/Interaction/Manipulators/GestureCameraManipulator.d.ts +34 -0
- package/Interaction/Manipulators/KeyboardCameraManipulator.js +1 -1
- package/Interaction/Manipulators/MouseBoxSelectorManipulator.d.ts +88 -0
- package/Interaction/Manipulators/MouseCameraAxisRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballMultiRotateManipulator.d.ts +32 -0
- package/Interaction/Manipulators/MouseCameraTrackballPanManipulator.d.ts +33 -0
- package/Interaction/Manipulators/MouseCameraTrackballPanManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.d.ts +33 -0
- package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.d.ts +67 -0
- package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballZoomManipulator.d.ts +45 -0
- package/Interaction/Manipulators/MouseCameraTrackballZoomToMouseManipulator.d.ts +26 -0
- package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseRangeManipulator.d.ts +53 -0
- package/Interaction/Style/InteractorStyleImage.d.ts +107 -0
- package/Interaction/Style/InteractorStyleMPRSlice.js +1 -1
- package/Interaction/Style/InteractorStyleManipulator.d.ts +348 -0
- package/Interaction/Style/InteractorStyleTrackballCamera.d.ts +170 -0
- package/Interaction/Widgets/ImageCroppingRegionsWidget.js +1 -1
- package/Interaction/Widgets/LabelRepresentation.js +1 -1
- package/Interaction/Widgets/OrientationMarkerWidget/Constants.d.ts +11 -0
- package/Interaction/Widgets/ResliceCursor/ResliceCursor.js +1 -1
- package/Interaction/Widgets/ResliceCursor/ResliceCursorLineRepresentation.js +1 -1
- package/Interaction/Widgets/ResliceCursor/ResliceCursorRepresentation.js +1 -1
- package/Proxy/Core/AbstractRepresentationProxy.d.ts +24 -0
- package/Proxy/Core/LookupTableProxy.d.ts +45 -0
- package/Proxy/Core/PiecewiseFunctionProxy.d.ts +62 -0
- package/Proxy/Core/ProxyManager.d.ts +115 -0
- package/Proxy/Core/SourceProxy.d.ts +22 -0
- package/Proxy/Core/View2DProxy.d.ts +7 -0
- package/Proxy/Core/View2DProxy.js +1 -1
- package/Proxy/Core/ViewProxy.d.ts +86 -0
- package/Proxy/Representations/SliceRepresentationProxy.d.ts +27 -0
- package/Proxy/Representations/VolumeRepresentationProxy.d.ts +44 -0
- package/README.md +2 -2
- package/Rendering/Core/AbstractImageMapper/helper.js +127 -0
- package/Rendering/Core/AbstractImageMapper.d.ts +82 -0
- package/Rendering/Core/AbstractImageMapper.js +44 -0
- package/Rendering/Core/Camera.js +1 -1
- package/Rendering/Core/CellPicker.js +1 -1
- package/Rendering/Core/ColorTransferFunction/ColorMaps.d.ts +24 -0
- package/Rendering/Core/ColorTransferFunction/Constants.d.ts +17 -0
- package/Rendering/Core/ColorTransferFunction.js +1 -1
- package/Rendering/Core/Coordinate/Constants.d.ts +14 -0
- package/Rendering/Core/Coordinate.js +1 -1
- package/Rendering/Core/Glyph3DMapper/Constants.d.ts +17 -0
- package/Rendering/Core/Glyph3DMapper.js +1 -1
- package/Rendering/Core/HardwareSelector.d.ts +84 -0
- package/Rendering/Core/ImageArrayMapper.d.ts +253 -0
- package/Rendering/Core/ImageArrayMapper.js +242 -0
- package/Rendering/Core/ImageMapper/Constants.d.ts +14 -0
- package/Rendering/Core/ImageMapper.js +1 -1
- package/Rendering/Core/ImageProperty/Constants.d.ts +9 -0
- package/Rendering/Core/ImageResliceMapper/Constants.d.ts +11 -0
- package/Rendering/Core/ImageResliceMapper/Constants.js +11 -0
- package/Rendering/Core/ImageResliceMapper.d.ts +245 -0
- package/Rendering/Core/ImageResliceMapper.js +70 -0
- package/Rendering/Core/InteractorObserver.d.ts +132 -0
- package/Rendering/Core/InteractorStyle/Constants.d.ts +16 -0
- package/Rendering/Core/InteractorStyle.d.ts +229 -0
- package/Rendering/Core/Light.js +1 -1
- package/Rendering/Core/Mapper/Constants.d.ts +26 -0
- package/Rendering/Core/Mapper.js +1 -1
- package/Rendering/Core/Picker.js +1 -1
- package/Rendering/Core/Prop/Constants.d.ts +9 -0
- package/Rendering/Core/Prop/Constants.js +9 -0
- package/Rendering/Core/Property/Constants.d.ts +24 -0
- package/Rendering/Core/Property2D/Constants.d.ts +9 -0
- package/Rendering/Core/RenderWindow.js +1 -1
- package/Rendering/Core/RenderWindowInteractor/Constants.d.ts +31 -0
- package/Rendering/Core/Renderer.js +1 -1
- package/Rendering/Core/VolumeMapper/Constants.d.ts +20 -0
- package/Rendering/Core/VolumeMapper.js +1 -1
- package/Rendering/Core/VolumeProperty/Constants.d.ts +16 -0
- package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager/CameraSynchronizer.js +129 -0
- package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager.js +131 -0
- package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.d.ts +80 -0
- package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.js +763 -0
- package/Rendering/OpenGL/HardwareSelector/Constants.d.ts +8 -0
- package/Rendering/OpenGL/HardwareSelector.d.ts +339 -0
- package/Rendering/OpenGL/ImageResliceMapper.js +996 -0
- package/Rendering/OpenGL/PolyDataMapper.js +1 -1
- package/Rendering/OpenGL/PolyDataMapper2D.js +1 -1
- package/Rendering/OpenGL/RenderWindow/Constants.d.ts +10 -0
- package/Rendering/OpenGL/RenderWindow/Constants.js +13 -0
- package/Rendering/OpenGL/RenderWindow/ContextProxy.js +70 -0
- package/Rendering/OpenGL/RenderWindow.d.ts +9 -2
- package/Rendering/OpenGL/RenderWindow.js +2 -1
- package/Rendering/OpenGL/glsl/vtkImageResliceMapperFS.glsl.js +3 -0
- package/Rendering/OpenGL/glsl/vtkImageResliceMapperVS.glsl.js +3 -0
- package/Rendering/WebGPU/Actor2D.js +151 -0
- package/Rendering/WebGPU/BufferManager.js +1 -1
- package/Rendering/WebGPU/CellArrayMapper.js +853 -0
- package/Rendering/WebGPU/IndexBuffer.js +397 -0
- package/Rendering/WebGPU/PolyDataMapper2D.js +99 -0
- package/Rendering/WebGPU/RenderWindow.js +3 -1
- package/Rendering/WebGPU/SimpleMapper.js +290 -0
- package/Widgets/Core/AbstractWidget.d.ts +187 -0
- package/Widgets/Core/AbstractWidgetFactory.d.ts +131 -0
- package/Widgets/Core/StateBuilder/color3Mixin.js +24 -0
- package/Widgets/Core/StateBuilder/orientationMixin.js +1 -1
- package/Widgets/Core/StateBuilder.d.ts +29 -0
- package/Widgets/Core/WidgetManager/Constants.d.ts +27 -0
- package/Widgets/Core/WidgetManager.d.ts +231 -0
- package/Widgets/Core/WidgetState.d.ts +81 -0
- package/Widgets/Manipulators/AbstractManipulator.d.ts +221 -0
- package/Widgets/Manipulators/AbstractManipulator.js +57 -0
- package/Widgets/Manipulators/LineManipulator.js +1 -1
- package/Widgets/Manipulators/TrackballManipulator.js +1 -1
- package/Widgets/Representations/GlyphRepresentation.js +325 -0
- package/Widgets/Representations/LineHandleRepresentation.js +116 -0
- package/Widgets/Representations/ResliceCursorContextRepresentation.js +1 -1
- package/Widgets/Representations/WidgetRepresentation.js +1 -1
- package/Widgets/Widgets3D/AngleWidget.js +1 -1
- package/Widgets/Widgets3D/InteractiveOrientationWidget.d.ts +40 -0
- package/Widgets/Widgets3D/LabelWidget/behavior.js +157 -0
- package/Widgets/Widgets3D/LabelWidget/state.js +22 -0
- package/Widgets/Widgets3D/LabelWidget.js +78 -0
- package/Widgets/Widgets3D/LineWidget/behavior.js +1 -1
- package/Widgets/Widgets3D/LineWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget.js +1 -1
- package/index.d.ts +133 -74
- package/package.json +1 -1
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
3
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
|
+
import macro from '../../macros.js';
|
|
5
|
+
import { f as vtkMath } from '../Core/Math/index.js';
|
|
6
|
+
import vtkBoundingBox from './BoundingBox.js';
|
|
7
|
+
import vtkIncrementalOctreeNode from './IncrementalOctreeNode.js';
|
|
8
|
+
import vtkAbstractPointLocator from './AbstractPointLocator.js';
|
|
9
|
+
import { VtkDataTypes } from '../Core/DataArray/Constants.js';
|
|
10
|
+
|
|
11
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12
|
+
|
|
13
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14
|
+
var vtkErrorMacro = macro.vtkErrorMacro;
|
|
15
|
+
|
|
16
|
+
function vtkIncrementalOctreePointLocator(publicAPI, model) {
|
|
17
|
+
// Set our className
|
|
18
|
+
model.classHierarchy.push('vtkIncrementalOctreePointLocator');
|
|
19
|
+
|
|
20
|
+
function getLeafContainer(node, pnt) {
|
|
21
|
+
return node.isLeaf() ? node : getLeafContainer(node.getChild(node.getChildIndex(pnt)), pnt);
|
|
22
|
+
} //------------------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
publicAPI.freeSearchStructure = function () {
|
|
26
|
+
model.octreeRootNode = null;
|
|
27
|
+
model.numberOfNodes = 0;
|
|
28
|
+
model.locatorPoints = null;
|
|
29
|
+
}; //------------------------------------------------------------------------------
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
publicAPI.findClosestPointInLeafNode = function (leafNode, point) {
|
|
33
|
+
// NOTE: dist2 MUST be initiated with a very huge value below, but instead of
|
|
34
|
+
// model.octreeMaxDimSize * model.octreeMaxDimSize * 4.0, because the point
|
|
35
|
+
// under check may be outside the octree and hence the squared distance can
|
|
36
|
+
// be greater than the latter or other similar octree-based specific values.
|
|
37
|
+
var dist2 = Number.MAX_VALUE;
|
|
38
|
+
|
|
39
|
+
if (leafNode.getPointIdSet() == null) {
|
|
40
|
+
return [-1, dist2];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
var numPts = 0;
|
|
44
|
+
var tmpDst = 0.0;
|
|
45
|
+
var tmpPnt = [];
|
|
46
|
+
var tmpIdx = -1;
|
|
47
|
+
var pntIdx = -1;
|
|
48
|
+
var idList = leafNode.getPointIdSet();
|
|
49
|
+
numPts = idList.length;
|
|
50
|
+
|
|
51
|
+
for (var i = 0; i < numPts; i++) {
|
|
52
|
+
tmpIdx = idList[i];
|
|
53
|
+
model.locatorPoints.getPoint(tmpIdx, tmpPnt);
|
|
54
|
+
tmpDst = vtkMath.distance2BetweenPoints(tmpPnt, point);
|
|
55
|
+
|
|
56
|
+
if (tmpDst < dist2) {
|
|
57
|
+
dist2 = tmpDst;
|
|
58
|
+
pntIdx = tmpIdx;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (dist2 === 0.0) {
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
idList = null;
|
|
67
|
+
return [pntIdx, dist2];
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
publicAPI.findClosestPointInSphere = function (point, radius2, maskNode, refDist2) {
|
|
71
|
+
var pointIndx = -1;
|
|
72
|
+
var minDist2 = Number.MAX_VALUE;
|
|
73
|
+
var nodesBase = [];
|
|
74
|
+
nodesBase.push(model.octreeRootNode);
|
|
75
|
+
var checkNode;
|
|
76
|
+
var childNode;
|
|
77
|
+
var distToData;
|
|
78
|
+
var tempDist2;
|
|
79
|
+
var tempPntId;
|
|
80
|
+
|
|
81
|
+
while (!nodesBase.length === 0 && minDist2 > 0.0) {
|
|
82
|
+
checkNode = nodesBase.top();
|
|
83
|
+
nodesBase.pop();
|
|
84
|
+
|
|
85
|
+
if (!checkNode.isLeaf()) {
|
|
86
|
+
for (var i = 0; i < 8; i++) {
|
|
87
|
+
childNode = checkNode.getChild(i); // use ( radius2 + radius2 ) to skip empty nodes
|
|
88
|
+
|
|
89
|
+
distToData = childNode.getNumberOfPoints() ? childNode.getDistance2ToBoundary(point, model.octreeRootNode, 1) : radius2 + radius2; // If a child node is not the mask node AND its distance, specifically
|
|
90
|
+
// the data bounding box (determined by the points inside or under) to
|
|
91
|
+
// the point, is less than the threshold radius (one exception is the
|
|
92
|
+
// point's container nodes), it is pushed to the stack as a suspect.
|
|
93
|
+
|
|
94
|
+
if (childNode !== maskNode && (distToData <= refDist2 || childNode.containsPoint(point) === 1)) {
|
|
95
|
+
nodesBase.push(childNode);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
childNode = null;
|
|
99
|
+
}
|
|
100
|
+
} else {
|
|
101
|
+
// now that the node under check is a leaf, let's find the closest
|
|
102
|
+
// point therein and the minimum distance
|
|
103
|
+
var _publicAPI$findCloses = publicAPI.findClosestPointInLeafNode(checkNode, point);
|
|
104
|
+
|
|
105
|
+
var _publicAPI$findCloses2 = _slicedToArray(_publicAPI$findCloses, 2);
|
|
106
|
+
|
|
107
|
+
tempPntId = _publicAPI$findCloses2[0];
|
|
108
|
+
tempDist2 = _publicAPI$findCloses2[1];
|
|
109
|
+
|
|
110
|
+
if (tempDist2 < minDist2) {
|
|
111
|
+
minDist2 = tempDist2;
|
|
112
|
+
pointIndx = tempPntId;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
checkNode = null;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return [minDist2 <= radius2 ? pointIndx : -1, minDist2];
|
|
120
|
+
}; //------------------------------------------------------------------------------
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
publicAPI.initPointInsertion = function (points, bounds) {
|
|
124
|
+
var _model$octreeRootNode;
|
|
125
|
+
var i = 0;
|
|
126
|
+
var bbIndex = 0;
|
|
127
|
+
|
|
128
|
+
if (points == null) {
|
|
129
|
+
vtkErrorMacro('a valid vtkPoints object required for point insertion');
|
|
130
|
+
return false;
|
|
131
|
+
} // destroy the existing octree, if any
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
publicAPI.freeSearchStructure();
|
|
135
|
+
model.locatorPoints = points; // obtain the threshold squared distance
|
|
136
|
+
|
|
137
|
+
model.insertTolerance2 = model.tolerance * model.tolerance; // Fix bounds
|
|
138
|
+
// (1) push out a little bit if the original volume is too flat --- a slab
|
|
139
|
+
// (2) pull back the x, y, and z's lower bounds a little bit such that
|
|
140
|
+
// points are clearly "inside" the spatial region. Point p is taken as
|
|
141
|
+
// "inside" range r = [r1, r2] if and only if r1 < p <= r2.
|
|
142
|
+
|
|
143
|
+
model.octreeMaxDimSize = 0.0;
|
|
144
|
+
|
|
145
|
+
var tmpBbox = _toConsumableArray(bounds);
|
|
146
|
+
|
|
147
|
+
var dimDiff = vtkBoundingBox.getLengths(bounds);
|
|
148
|
+
model.octreeMaxDimSize = Math.max.apply(Math, _toConsumableArray(dimDiff));
|
|
149
|
+
|
|
150
|
+
if (model.buildCubicOctree) {
|
|
151
|
+
// make the bounding box a cube and hence descendant octants cubes too
|
|
152
|
+
for (i = 0; i < 3; i++) {
|
|
153
|
+
if (dimDiff[i] !== model.octreeMaxDimSize) {
|
|
154
|
+
var delta = model.octreeMaxDimSize - dimDiff[i];
|
|
155
|
+
tmpBbox[2 * i] -= 0.5 * delta;
|
|
156
|
+
tmpBbox[2 * i + 1] += 0.5 * delta;
|
|
157
|
+
dimDiff[i] = model.octreeMaxDimSize;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
model.fudgeFactor = model.octreeMaxDimSize * 10e-6;
|
|
163
|
+
var minSideSize = model.octreeMaxDimSize * 10e-2;
|
|
164
|
+
|
|
165
|
+
for (i = 0; i < 3; i++) {
|
|
166
|
+
if (dimDiff[i] < minSideSize) {
|
|
167
|
+
// case (1) above
|
|
168
|
+
bbIndex = 2 * i;
|
|
169
|
+
var tempVal = tmpBbox[bbIndex];
|
|
170
|
+
tmpBbox[bbIndex] = tmpBbox[bbIndex + 1] - minSideSize;
|
|
171
|
+
tmpBbox[bbIndex + 1] = tempVal + minSideSize;
|
|
172
|
+
} else {
|
|
173
|
+
// case (2) above
|
|
174
|
+
tmpBbox[2 * i] -= model.fudgeFactor;
|
|
175
|
+
}
|
|
176
|
+
} // init the octree with an empty leaf node
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
model.octreeRootNode = vtkIncrementalOctreeNode.newInstance();
|
|
180
|
+
++model.numberOfNodes; // this call internally inits the middle (center) and data range, too
|
|
181
|
+
|
|
182
|
+
(_model$octreeRootNode = model.octreeRootNode).setBounds.apply(_model$octreeRootNode, _toConsumableArray(tmpBbox));
|
|
183
|
+
|
|
184
|
+
return true;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
publicAPI.findClosestPointInSphereWithTolerance = function (point, radius2, maskNode) {
|
|
188
|
+
return publicAPI.findClosestPointInSphere(point, radius2, maskNode, model.octreeMaxDimSize * model.octreeMaxDimSize * 4.0, radius2);
|
|
189
|
+
}; //------------------------------------------------------------------------------
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
publicAPI.findDuplicateFloatTypePointInVisitedLeafNode = function (leafNode, point) {
|
|
193
|
+
var tmpPnt;
|
|
194
|
+
var tmpIdx = -1;
|
|
195
|
+
var pntIdx = -1; // float thePnt[3]; // TODO
|
|
196
|
+
// thePnt[0] = static_cast<float>(point[0]);
|
|
197
|
+
// thePnt[1] = static_cast<float>(point[1]);
|
|
198
|
+
// thePnt[2] = static_cast<float>(point[2]);
|
|
199
|
+
|
|
200
|
+
var idList = leafNode.getPointIdSet(); // float* pFloat = (static_cast<vtkFloatArray*>(model.locatorPoints.getData())).getPointer(0);
|
|
201
|
+
|
|
202
|
+
var values = model.locatorPoints.getData();
|
|
203
|
+
|
|
204
|
+
for (var i = 0; i < idList.length; i++) {
|
|
205
|
+
tmpIdx = idList[i]; // eslint-disable-next-line no-bitwise
|
|
206
|
+
|
|
207
|
+
tmpPnt = (tmpIdx << 1) + tmpIdx;
|
|
208
|
+
|
|
209
|
+
if (point[0] === values[tmpPnt] && point[1] === values[tmpPnt + 1] && point[2] === values[tmpPnt + 2]) {
|
|
210
|
+
pntIdx = tmpIdx;
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return pntIdx;
|
|
216
|
+
}; //------------------------------------------------------------------------------
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
publicAPI.findDuplicateDoubleTypePointInVisitedLeafNode = function (leafNode, point) {
|
|
220
|
+
var tmpPnt;
|
|
221
|
+
var tmpIdx = -1;
|
|
222
|
+
var pntIdx = -1;
|
|
223
|
+
var idList = leafNode.getPointIdSet();
|
|
224
|
+
var values = model.locatorPoints.getData();
|
|
225
|
+
|
|
226
|
+
for (var i = 0; i < idList.length; i++) {
|
|
227
|
+
tmpIdx = idList[i]; // eslint-disable-next-line no-bitwise
|
|
228
|
+
|
|
229
|
+
tmpPnt = (tmpIdx << 1) + tmpIdx;
|
|
230
|
+
|
|
231
|
+
if (point[0] === values[tmpPnt] && point[1] === values[tmpPnt + 1] && point[2] === values[tmpPnt + 2]) {
|
|
232
|
+
pntIdx = tmpIdx;
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return pntIdx;
|
|
238
|
+
}; //------------------------------------------------------------------------------
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
publicAPI.findDuplicatePointInLeafNode = function (leafNode, point) {
|
|
242
|
+
if (leafNode.getPointIdSet() == null) {
|
|
243
|
+
return -1;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return model.locatorPoints.getDataType() === VtkDataTypes.FLOAT ? publicAPI.findDuplicateFloatTypePointInVisitedLeafNode(leafNode, point) : publicAPI.findDuplicateDoubleTypePointInVisitedLeafNode(leafNode, point);
|
|
247
|
+
}; //------------------------------------------------------------------------------
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
publicAPI.insertPoint = function (ptId, x) {
|
|
251
|
+
var leafcontainer = getLeafContainer(model.octreeRootNode, x);
|
|
252
|
+
|
|
253
|
+
var _leafcontainer$insert = leafcontainer.insertPoint(model.locatorPoints, x, model.maxPointsPerLeaf, ptId, 1, model.numberOfNodes);
|
|
254
|
+
|
|
255
|
+
model.numberOfNodes = _leafcontainer$insert.numberOfNodes;
|
|
256
|
+
}; //------------------------------------------------------------------------------
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
publicAPI.insertUniquePoint = function (point) {
|
|
260
|
+
// TODO: We have a mix of let and const here.
|
|
261
|
+
// eslint-disable-next-line prefer-const
|
|
262
|
+
var _publicAPI$isInserted = publicAPI.isInsertedPoint(point),
|
|
263
|
+
pointIdx = _publicAPI$isInserted.pointIdx,
|
|
264
|
+
leafContainer = _publicAPI$isInserted.leafContainer;
|
|
265
|
+
|
|
266
|
+
if (pointIdx > -1) {
|
|
267
|
+
return {
|
|
268
|
+
success: false,
|
|
269
|
+
idx: pointIdx
|
|
270
|
+
};
|
|
271
|
+
} // TODO: pointIdx
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
var numberOfNodes; // eslint-disable-next-line prefer-const
|
|
275
|
+
|
|
276
|
+
var _leafContainer$insert = leafContainer.insertPoint(model.locatorPoints, point, model.maxPointsPerLeaf, pointIdx, 2, model.numberOfNodes);
|
|
277
|
+
|
|
278
|
+
numberOfNodes = _leafContainer$insert.numberOfNodes;
|
|
279
|
+
pointIdx = _leafContainer$insert.pointIdx;
|
|
280
|
+
model.numberOfNodes = numberOfNodes;
|
|
281
|
+
return {
|
|
282
|
+
success: true,
|
|
283
|
+
idx: pointIdx
|
|
284
|
+
};
|
|
285
|
+
}; //------------------------------------------------------------------------------
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
publicAPI.insertNextPoint = function (x) {
|
|
289
|
+
var leafContainer = getLeafContainer(model.octreeRootNode, x);
|
|
290
|
+
|
|
291
|
+
var _leafContainer$insert2 = leafContainer.insertPoint(model.locatorPoints, x, model.maxPointsPerLeaf, -1, 2, model.numberOfNodes),
|
|
292
|
+
numberOfNodes = _leafContainer$insert2.numberOfNodes,
|
|
293
|
+
pointIdx = _leafContainer$insert2.pointIdx;
|
|
294
|
+
|
|
295
|
+
model.numberOfNodes = numberOfNodes;
|
|
296
|
+
return pointIdx;
|
|
297
|
+
}; //------------------------------------------------------------------------------
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
publicAPI.isInsertedPointForZeroTolerance = function (x) {
|
|
301
|
+
// the target leaf node always exists there since the root node of the
|
|
302
|
+
// octree has been initialized to cover all possible points to be inserted
|
|
303
|
+
// and therefore we do not need to check it here
|
|
304
|
+
var leafContainer = getLeafContainer(model.octreeRootNode, x);
|
|
305
|
+
var pointIdx = publicAPI.findDuplicatePointInLeafNode(leafContainer, x);
|
|
306
|
+
return {
|
|
307
|
+
pointIdx: pointIdx,
|
|
308
|
+
leafContainer: leafContainer
|
|
309
|
+
};
|
|
310
|
+
}; //------------------------------------------------------------------------------
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
publicAPI.isInsertedPointForNonZeroTolerance = function (x) {
|
|
314
|
+
// minDist2 // min distance to ALL existing points
|
|
315
|
+
// elseDst2 // min distance to other nodes (inner boundaries)
|
|
316
|
+
var dist2Ext; // min distance to an EXTended set of nodes
|
|
317
|
+
|
|
318
|
+
var pntIdExt; // the target leaf node always exists there since the root node of the
|
|
319
|
+
// octree has been initialized to cover all possible points to be inserted
|
|
320
|
+
// and therefore we do not need to check it here
|
|
321
|
+
|
|
322
|
+
var leafContainer = getLeafContainer(model.octreeRootNode, x);
|
|
323
|
+
|
|
324
|
+
var _publicAPI$findCloses3 = publicAPI.findClosestPointInLeafNode(leafContainer, x),
|
|
325
|
+
_publicAPI$findCloses4 = _slicedToArray(_publicAPI$findCloses3, 2),
|
|
326
|
+
pointIdx = _publicAPI$findCloses4[0],
|
|
327
|
+
minDist2 = _publicAPI$findCloses4[1];
|
|
328
|
+
|
|
329
|
+
if (minDist2 === 0.0) {
|
|
330
|
+
return {
|
|
331
|
+
pointIdx: pointIdx,
|
|
332
|
+
leafContainer: leafContainer
|
|
333
|
+
};
|
|
334
|
+
} // As no any 'duplicate' point exists in this leaf node, we need to expand
|
|
335
|
+
// the search scope to capture possible closer points in other nodes.
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
var elseDst2 = leafContainer.getDistance2ToInnerBoundary(x, model.octreeRootNode);
|
|
339
|
+
|
|
340
|
+
if (elseDst2 < model.insertTolerance2) {
|
|
341
|
+
// one or multiple closer points might exist in the neighboring nodes
|
|
342
|
+
// TODO: dist2Ext
|
|
343
|
+
pntIdExt = publicAPI.findClosestPointInSphereWithTolerance(x, model.insertTolerance2, leafContainer, dist2Ext);
|
|
344
|
+
|
|
345
|
+
if (dist2Ext < minDist2) {
|
|
346
|
+
minDist2 = dist2Ext;
|
|
347
|
+
pointIdx = pntIdExt;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
pointIdx = minDist2 <= model.insertTolerance2 ? pointIdx : -1;
|
|
352
|
+
return {
|
|
353
|
+
pointIdx: pointIdx,
|
|
354
|
+
leafContainer: leafContainer
|
|
355
|
+
};
|
|
356
|
+
}; //------------------------------------------------------------------------------
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
publicAPI.isInsertedPoint = function (x, leafContainer) {
|
|
360
|
+
return model.insertTolerance2 === 0.0 ? publicAPI.isInsertedPointForZeroTolerance(x, leafContainer) : publicAPI.isInsertedPointForNonZeroTolerance(x, leafContainer);
|
|
361
|
+
};
|
|
362
|
+
} // ----------------------------------------------------------------------------
|
|
363
|
+
// Object factory
|
|
364
|
+
// ----------------------------------------------------------------------------
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
function defaultValues(initialValues) {
|
|
368
|
+
return _objectSpread({
|
|
369
|
+
fudgeFactor: 0,
|
|
370
|
+
octreeMaxDimSize: 0,
|
|
371
|
+
buildCubicOctree: false,
|
|
372
|
+
maxPointsPerLeaf: 128,
|
|
373
|
+
insertTolerance2: 0.000001,
|
|
374
|
+
locatorPoints: null,
|
|
375
|
+
octreeRootNode: null,
|
|
376
|
+
numberOfNodes: 0
|
|
377
|
+
}, initialValues);
|
|
378
|
+
} // ----------------------------------------------------------------------------
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
function extend(publicAPI, model) {
|
|
382
|
+
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
383
|
+
vtkAbstractPointLocator.extend(publicAPI, model, defaultValues(initialValues)); // Make this a VTK object
|
|
384
|
+
|
|
385
|
+
macro.obj(publicAPI, model);
|
|
386
|
+
macro.setGet(publicAPI, model, ['fudgeFactor', 'octreeMaxDimSize', 'buildCubicOctree', 'maxPointsPerLeaf', 'insertTolerance2', 'locatorPoints', 'octreeRootNode', 'numberOfNodes']); // Object specific methods
|
|
387
|
+
|
|
388
|
+
vtkIncrementalOctreePointLocator(publicAPI, model);
|
|
389
|
+
} // ----------------------------------------------------------------------------
|
|
390
|
+
|
|
391
|
+
var newInstance = macro.newInstance(extend, 'vtkIncrementalOctreePointLocator'); // ----------------------------------------------------------------------------
|
|
392
|
+
|
|
393
|
+
var vtkIncrementalOctreePointLocator$1 = {
|
|
394
|
+
newInstance: newInstance,
|
|
395
|
+
extend: extend
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
export { vtkIncrementalOctreePointLocator$1 as default, extend, newInstance };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { vtkObject } from './../../interfaces';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export interface ILocatorInitialValues {
|
|
7
|
+
dataSet?: number[];
|
|
8
|
+
maxLevel?: number;
|
|
9
|
+
level?: number;
|
|
10
|
+
automatic?: boolean;
|
|
11
|
+
tolerance?: number;
|
|
12
|
+
useExistingSearchStructure?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface vtkLocator extends vtkObject {}
|
|
16
|
+
|
|
17
|
+
// ----------------------------------------------------------------------------
|
|
18
|
+
// Static API
|
|
19
|
+
// ----------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Method use to decorate a given object (publicAPI+model) with vtkLocator characteristics.
|
|
23
|
+
*
|
|
24
|
+
* @param publicAPI object on which methods will be bounds (public)
|
|
25
|
+
* @param model object on which data structure will be bounds (protected)
|
|
26
|
+
* @param {ILocatorInitialValues} [initialValues] (default: {})
|
|
27
|
+
*/
|
|
28
|
+
export function extend(
|
|
29
|
+
publicAPI: object,
|
|
30
|
+
model: object,
|
|
31
|
+
initialValues?: ILocatorInitialValues
|
|
32
|
+
): void;
|
|
33
|
+
|
|
34
|
+
// ----------------------------------------------------------------------------
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* vtkLocator
|
|
38
|
+
*/
|
|
39
|
+
export declare const vtkLocator: {
|
|
40
|
+
extend: typeof extend;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default vtkLocator;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import macro from '../../macros.js';
|
|
2
|
+
|
|
3
|
+
function vtkLocator(publicAPI, model) {
|
|
4
|
+
// Set our className
|
|
5
|
+
model.classHierarchy.push('vtkLocator');
|
|
6
|
+
} // ----------------------------------------------------------------------------
|
|
7
|
+
// Object factory
|
|
8
|
+
// ----------------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var DEFAULT_VALUES = {
|
|
12
|
+
dataSet: null,
|
|
13
|
+
maxLevel: 8,
|
|
14
|
+
// TODO: clamp 0, Number.MAX_VALUE
|
|
15
|
+
level: 8,
|
|
16
|
+
automatic: false,
|
|
17
|
+
tolerance: 0.0,
|
|
18
|
+
// TODO: clamp 0.0, Number.MAX_VALUE
|
|
19
|
+
useExistingSearchStructure: false
|
|
20
|
+
}; // ----------------------------------------------------------------------------
|
|
21
|
+
|
|
22
|
+
function extend(publicAPI, model) {
|
|
23
|
+
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
24
|
+
Object.assign(model, DEFAULT_VALUES, initialValues); // Make this a VTK object
|
|
25
|
+
|
|
26
|
+
macro.obj(publicAPI, model);
|
|
27
|
+
macro.get(publicAPI, model, ['level']);
|
|
28
|
+
macro.setGet(publicAPI, model, ['dataSet', 'maxLevel', 'automatic', 'tolerance', 'useExistingSearchStructure']); // Object specific methods
|
|
29
|
+
|
|
30
|
+
vtkLocator(publicAPI, model);
|
|
31
|
+
} // ----------------------------------------------------------------------------
|
|
32
|
+
|
|
33
|
+
var vtkLocator$1 = {
|
|
34
|
+
extend: extend
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { vtkLocator$1 as default, extend };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
-
import {
|
|
2
|
+
import { j as subtract, d as dot, k as cross, l as add } from '../Core/Math/index.js';
|
|
3
3
|
import macro from '../../macros.js';
|
|
4
4
|
|
|
5
5
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Vector2, Vector3 } from './../../types';
|
|
2
|
+
import vtkCell, { ICellInitialValues } from './Cell';
|
|
3
|
+
import { IIntersectWithLine } from './Line';
|
|
4
|
+
|
|
5
|
+
export interface IPolyLineInitialValues extends ICellInitialValues { }
|
|
6
|
+
|
|
7
|
+
export interface vtkPolyLine extends vtkCell {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Get the topological dimensional of the cell (0, 1, 2 or 3).
|
|
11
|
+
*/
|
|
12
|
+
getCellDimension(): number;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {number} t1
|
|
16
|
+
* @param {number} t2
|
|
17
|
+
* @param {Vector3} p1 The first point coordinate.
|
|
18
|
+
* @param {Vector3} p2 The second point coordinate.
|
|
19
|
+
* @param {Number} tol The tolerance to use.
|
|
20
|
+
* @param {Vector3} x The point which intersect the line.
|
|
21
|
+
* @param {Vector3} pcoords The parametric coordinates.
|
|
22
|
+
*/
|
|
23
|
+
intersectWithLine(t1: number, t2: number, p1: Vector3, p2: Vector3, tol: number, x: Vector3, pcoords: Vector3): IIntersectWithLine;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Determine global coordinate (x[3]) from subId and parametric coordinates.
|
|
27
|
+
* Also returns interpolation weights. (The number of weights is equal to
|
|
28
|
+
* the number of points in the cell.)
|
|
29
|
+
*
|
|
30
|
+
* @param {number} subId
|
|
31
|
+
* @param {Vector3} pcoords The parametric coordinates
|
|
32
|
+
* @param {Vector3} x The global coordinate
|
|
33
|
+
* @param {Vector2} weights The interpolation weights
|
|
34
|
+
*/
|
|
35
|
+
evaluateLocation(subId: number, pcoords: Vector3, x: Vector3, weights: Vector2): void
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Method used to decorate a given object (publicAPI+model) with vtkPolyLine characteristics.
|
|
40
|
+
*
|
|
41
|
+
* @param publicAPI object on which methods will be bounds (public)
|
|
42
|
+
* @param model object on which data structure will be bounds (protected)
|
|
43
|
+
* @param {IPolyLineInitialValues} [initialValues] (default: {})
|
|
44
|
+
*/
|
|
45
|
+
export function extend(publicAPI: object, model: object, initialValues?: IPolyLineInitialValues): void;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Method used to create a new instance of vtkPolyLine.
|
|
49
|
+
* @param {IPolyLineInitialValues} [initialValues] for pre-setting some of its content
|
|
50
|
+
*/
|
|
51
|
+
export function newInstance(initialValues?: IPolyLineInitialValues): vtkPolyLine;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* vtkPolyLine is a cell which representant a poly line.
|
|
55
|
+
*
|
|
56
|
+
* @see vtkCell
|
|
57
|
+
*/
|
|
58
|
+
export declare const vtkPolyLine: {
|
|
59
|
+
newInstance: typeof newInstance,
|
|
60
|
+
extend: typeof extend;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export default vtkPolyLine;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import macro from '../../macros.js';
|
|
3
|
+
import vtkCell from './Cell.js';
|
|
4
|
+
import vtkLine from './Line.js';
|
|
5
|
+
|
|
6
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
+
|
|
8
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9
|
+
|
|
10
|
+
function vtkPolyLine(publicAPI, model) {
|
|
11
|
+
model.classHierarchy.push('vtkPolyLine');
|
|
12
|
+
|
|
13
|
+
var superClass = _objectSpread({}, publicAPI);
|
|
14
|
+
|
|
15
|
+
var line = vtkLine.newInstance();
|
|
16
|
+
line.getPoints().setNumberOfPoints(2);
|
|
17
|
+
|
|
18
|
+
publicAPI.getCellDimension = function () {
|
|
19
|
+
return 1;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
publicAPI.intersectWithLine = function (t1, t2, p1, p2, tol, x, pcoords) {
|
|
23
|
+
var outObj = {
|
|
24
|
+
intersect: 0,
|
|
25
|
+
t: Number.MAX_VALUE,
|
|
26
|
+
subId: 0,
|
|
27
|
+
betweenPoints: null
|
|
28
|
+
};
|
|
29
|
+
var numLines = superClass.getPoints().getNumberOfPoints() - 1;
|
|
30
|
+
var pDistMin = Number.MAX_VALUE;
|
|
31
|
+
|
|
32
|
+
for (var subId = 0; subId < numLines; subId++) {
|
|
33
|
+
var pCoords = [0, 0, 0];
|
|
34
|
+
line.getPoints().getData().set(model.points.getData().subarray(3 * subId, 3 * (subId + 2)));
|
|
35
|
+
var lineIntersected = line.intersectWithLine(p1, p2, tol, x, pcoords);
|
|
36
|
+
|
|
37
|
+
if (lineIntersected.intersect === 1 && lineIntersected.t <= outObj.t + tol && lineIntersected.t >= t1 && lineIntersected.t <= t2) {
|
|
38
|
+
outObj.intersect = 1;
|
|
39
|
+
var pDist = line.getParametricDistance(pCoords);
|
|
40
|
+
|
|
41
|
+
if (pDist < pDistMin || pDist === pDistMin && lineIntersected.t < outObj.t) {
|
|
42
|
+
outObj.subId = subId;
|
|
43
|
+
outObj.t = lineIntersected.t;
|
|
44
|
+
pDistMin = pDist;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return outObj;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
publicAPI.evaluateLocation = function (subId, pcoords, x, weights) {
|
|
53
|
+
line.getPoints().getData().set(model.points.getData().subarray(3 * subId, 3 * (subId + 2)));
|
|
54
|
+
return line.evaluateLocation(pcoords, x, weights);
|
|
55
|
+
};
|
|
56
|
+
} // ----------------------------------------------------------------------------
|
|
57
|
+
// Object factory
|
|
58
|
+
// ----------------------------------------------------------------------------
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
var DEFAULT_VALUES = {}; // ----------------------------------------------------------------------------
|
|
62
|
+
|
|
63
|
+
function extend(publicAPI, model) {
|
|
64
|
+
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
65
|
+
Object.assign(model, DEFAULT_VALUES, initialValues);
|
|
66
|
+
vtkCell.extend(publicAPI, model, initialValues);
|
|
67
|
+
vtkPolyLine(publicAPI, model);
|
|
68
|
+
} // ----------------------------------------------------------------------------
|
|
69
|
+
|
|
70
|
+
var newInstance = macro.newInstance(extend, 'vtkPolyLine'); // ----------------------------------------------------------------------------
|
|
71
|
+
|
|
72
|
+
var vtkPolyLine$1 = {
|
|
73
|
+
newInstance: newInstance,
|
|
74
|
+
extend: extend
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export { vtkPolyLine$1 as default, extend, newInstance };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var EPSILON = 1e-6;
|
|
2
|
+
var FLOAT_EPSILON = 1.1920929e-7;
|
|
3
|
+
var TOLERANCE = 1e-8;
|
|
4
|
+
var PolygonWithPointIntersectionState = {
|
|
5
|
+
FAILURE: -1,
|
|
6
|
+
OUTSIDE: 0,
|
|
7
|
+
INSIDE: 1,
|
|
8
|
+
INTERSECTION: 2,
|
|
9
|
+
ON_LINE: 3
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { EPSILON, FLOAT_EPSILON, PolygonWithPointIntersectionState, TOLERANCE };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
2
|
import macro from '../../macros.js';
|
|
3
|
-
import {
|
|
3
|
+
import { g as normalize, j as subtract, k as cross, l as add, d as dot, n as norm } from '../Core/Math/index.js';
|
|
4
4
|
import vtkLine from './Line.js';
|
|
5
5
|
import vtkPlane from './Plane.js';
|
|
6
6
|
import vtkPriorityQueue from '../Core/PriorityQueue.js';
|