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eG,GACvB/G,KAAK8G,aAAalF,EAAKvK,SAAUwO,EACrC,CACA,OAAOA,EAAQyB,aACnB,CACA,YAAAR,CAAazP,EAAUwO,GACnB,MAAM7D,EAAM3K,EAAS4K,WAAWC,SAASC,MACnCoF,EAAQ7P,KAAK+G,IAA+B,EAA3BpH,EAASmQ,UAAUnP,MAAW2J,EAAIzD,QACzD,IAAK,IAAI5F,EAAI,EAAGA,EAAI4O,EAAO5O,GAAK,EAAG,CAC/B,MAAM8O,EAAKzF,EAAIrJ,GACT+O,EAAK1F,EAAIrJ,EAAI,GACbgP,EAAK3F,EAAIrJ,EAAI,GACbiP,EAAK5F,EAAIrJ,EAAI,GACLjB,KAAK2F,IAAIsK,EAAKF,GACd/P,KAAK2F,IAAIuK,EAAKF,GAEP1H,KAAKuF,YACtBM,EAAQgC,SAASJ,EAAIC,EAAIC,EAAIC,EAErC,CACJ,EAEJzC,EAAYQ,KAAO,uCACnB,KAAcmC,aAAapC,IAAIP,EAAYQ,K","sources":["webpack://client-app/./node_modules/openbim-components/src/import-export/dxf-exporter/src/edge-utils.js","webpack://client-app/./node_modules/openbim-components/src/import-export/dxf-exporter/src/edge-projector.js","webpack://client-app/./node_modules/openbim-components/src/import-export/dxf-exporter/index.js"],"sourcesContent":["/* eslint-disable */\r\nimport { Vector3, Triangle, Line3, MathUtils, Plane, BufferGeometry, BufferAttribute } from 'three';\r\nimport { ExtendedTriangle } from 'three-mesh-bvh';\r\nconst _upVector = new Vector3(0, 1, 0);\r\nconst EPSILON = 1e-16;\r\n// Modified version of js EdgesGeometry logic to handle silhouette edges\r\nexport const generateEdges = (function () {\r\n const _v0 = new Vector3();\r\n const _v1 = new Vector3();\r\n const _normal = new Vector3();\r\n const _triangle = new Triangle();\r\n return function generateEdges(geometry, projectionDir, thresholdAngle = 1) {\r\n const edges = [];\r\n const precisionPoints = 4;\r\n const precision = Math.pow(10, precisionPoints);\r\n const thresholdDot = Math.cos(MathUtils.DEG2RAD * thresholdAngle);\r\n const indexAttr = geometry.getIndex();\r\n const positionAttr = geometry.getAttribute('position');\r\n const indexCount = indexAttr ? indexAttr.count : positionAttr.count;\r\n const indexArr = [0, 0, 0];\r\n const vertKeys = ['a', 'b', 'c'];\r\n const hashes = new Array(3);\r\n const edgeData = {};\r\n for (let i = 0; i < indexCount; i += 3) {\r\n if (indexAttr) {\r\n indexArr[0] = indexAttr.getX(i);\r\n indexArr[1] = indexAttr.getX(i + 1);\r\n indexArr[2] = indexAttr.getX(i + 2);\r\n }\r\n else {\r\n indexArr[0] = i;\r\n indexArr[1] = i + 1;\r\n indexArr[2] = i + 2;\r\n }\r\n const { a, b, c } = _triangle;\r\n a.fromBufferAttribute(positionAttr, indexArr[0]);\r\n b.fromBufferAttribute(positionAttr, indexArr[1]);\r\n c.fromBufferAttribute(positionAttr, indexArr[2]);\r\n _triangle.getNormal(_normal);\r\n // create hashes for the edge from the vertices\r\n hashes[0] = `${Math.round(a.x * precision)},${Math.round(a.y * precision)},${Math.round(a.z * precision)}`;\r\n hashes[1] = `${Math.round(b.x * precision)},${Math.round(b.y * precision)},${Math.round(b.z * precision)}`;\r\n hashes[2] = `${Math.round(c.x * precision)},${Math.round(c.y * precision)},${Math.round(c.z * precision)}`;\r\n // skip degenerate triangles\r\n if (hashes[0] === hashes[1] || hashes[1] === hashes[2] || hashes[2] === hashes[0]) {\r\n continue;\r\n }\r\n // iterate over every edge\r\n for (let j = 0; j < 3; j++) {\r\n // get the first and next vertex making up the edge\r\n const jNext = (j + 1) % 3;\r\n const vecHash0 = hashes[j];\r\n const vecHash1 = hashes[jNext];\r\n const v0 = _triangle[vertKeys[j]];\r\n const v1 = _triangle[vertKeys[jNext]];\r\n const hash = `${vecHash0}_${vecHash1}`;\r\n const reverseHash = `${vecHash1}_${vecHash0}`;\r\n if (reverseHash in edgeData && edgeData[reverseHash]) {\r\n // if we found a sibling edge add it into the vertex array if\r\n // it meets the angle threshold and delete the edge from the map.\r\n const otherNormal = edgeData[reverseHash].normal;\r\n const meetsThreshold = _normal.dot(otherNormal) <= thresholdDot;\r\n const projectionThreshold = Math.sign(projectionDir.dot(_normal)) !== Math.sign(projectionDir.dot(otherNormal));\r\n if (meetsThreshold || projectionThreshold) {\r\n const line = new Line3();\r\n line.start.copy(v0);\r\n line.end.copy(v1);\r\n edges.push(line);\r\n }\r\n edgeData[reverseHash] = null;\r\n }\r\n else if (!(hash in edgeData)) {\r\n // if we've already got an edge here then skip adding a new one\r\n edgeData[hash] = {\r\n index0: indexArr[j],\r\n index1: indexArr[jNext],\r\n normal: _normal.clone()\r\n };\r\n }\r\n }\r\n }\r\n // iterate over all remaining, unmatched edges and add them to the vertex array\r\n for (const key in edgeData) {\r\n if (edgeData[key]) {\r\n const { index0, index1 } = edgeData[key];\r\n _v0.fromBufferAttribute(positionAttr, index0);\r\n _v1.fromBufferAttribute(positionAttr, index1);\r\n const line = new Line3();\r\n line.start.copy(_v0);\r\n line.end.copy(_v1);\r\n edges.push(line);\r\n }\r\n }\r\n return edges;\r\n };\r\n})();\r\n// outputs the overlapping segment of a coplanar line and triangle\r\nexport const getOverlappingLine = (function () {\r\n const _dir0 = new Vector3();\r\n const _dir1 = new Vector3();\r\n const _tempDir = new Vector3();\r\n const _orthoPlane = new Plane();\r\n const _line0 = new Line3();\r\n const _line1 = new Line3();\r\n const _tempLine = new Line3();\r\n return function getOverlappingLine(line, triangle, lineTarget = new Line3()) {\r\n if (triangle.needsUpdate) {\r\n triangle.needsUpdate();\r\n }\r\n // if the triangle is degenerate then return no overlap\r\n if (triangle.getArea() <= EPSILON) {\r\n return null;\r\n }\r\n const { points, plane } = triangle;\r\n _line0.copy(line);\r\n _line0.delta(_dir0);\r\n // if the line and triangle are not coplanar then return no overlap\r\n const areCoplanar = plane.normal.dot(_dir0) === 0.0;\r\n if (!areCoplanar) {\r\n return null;\r\n }\r\n // a plane that's orthogonal to the triangle that the line lies on\r\n _dir0.cross(plane.normal).normalize();\r\n _orthoPlane.setFromNormalAndCoplanarPoint(_dir0, _line0.start);\r\n // find the line of intersection of the triangle along the plane if it exists\r\n let intersectCount = 0;\r\n for (let i = 0; i < 3; i++) {\r\n const p1 = points[i];\r\n const p2 = points[(i + 1) % 3];\r\n _tempLine.start.copy(p1);\r\n _tempLine.end.copy(p2);\r\n if (_orthoPlane.distanceToPoint(_tempLine.end) === 0 &&\r\n _orthoPlane.distanceToPoint(_tempLine.start) === 0) {\r\n // if the edge lies on the plane then take the line\r\n _line1.copy(_tempLine);\r\n intersectCount = 2;\r\n break;\r\n }\r\n else if (_orthoPlane.intersectLine(_tempLine, intersectCount === 0 ? _line1.start : _line1.end)) {\r\n let p;\r\n if (intersectCount === 0) {\r\n p = _line1.start;\r\n }\r\n else {\r\n p = _line1.end;\r\n }\r\n if (p.distanceTo(p2) === 0.0) {\r\n continue;\r\n }\r\n intersectCount++;\r\n if (intersectCount === 2) {\r\n break;\r\n }\r\n }\r\n }\r\n if (intersectCount === 2) {\r\n // find the intersect line if any\r\n _line0.delta(_dir0).normalize();\r\n _line1.delta(_dir1).normalize();\r\n // swap edges so they're facing in the same direction\r\n if (_dir0.dot(_dir1) < 0) {\r\n const tmp = _line1.start;\r\n _line1.start = _line1.end;\r\n _line1.end = tmp;\r\n }\r\n // check if the edges are overlapping\r\n const s1 = _line0.start.dot(_dir0);\r\n const e1 = _line0.end.dot(_dir0);\r\n const s2 = _line1.start.dot(_dir0);\r\n const e2 = _line1.end.dot(_dir0);\r\n const separated1 = e1 < s2;\r\n const separated2 = s1 < e2;\r\n if (s1 !== e2 && s2 !== e1 && separated1 === separated2) {\r\n return null;\r\n }\r\n // assign the target output\r\n _tempDir.subVectors(_line0.start, _line1.start);\r\n if (_tempDir.dot(_dir0) > 0) {\r\n lineTarget.start.copy(_line0.start);\r\n }\r\n else {\r\n lineTarget.start.copy(_line1.start);\r\n }\r\n _tempDir.subVectors(_line0.end, _line1.end);\r\n if (_tempDir.dot(_dir0) < 0) {\r\n lineTarget.end.copy(_line0.end);\r\n }\r\n else {\r\n lineTarget.end.copy(_line1.end);\r\n }\r\n return lineTarget;\r\n }\r\n return null;\r\n };\r\n})();\r\n// returns the the y value on the plane at the given point x, z\r\nexport const getPlaneYAtPoint = (function () {\r\n const testLine = new Line3();\r\n return function getPlaneYAtPoint(plane, point, target = null) {\r\n testLine.start.copy(point);\r\n testLine.end.copy(point);\r\n testLine.start.y += 1e5;\r\n testLine.end.y -= 1e5;\r\n plane.intersectLine(testLine, target);\r\n };\r\n})();\r\n// returns whether the given line is above the given triangle plane\r\nexport const isLineAbovePlane = (function () {\r\n const _v0 = new Vector3();\r\n const _v1 = new Vector3();\r\n return function isLineAbovePlane(plane, line) {\r\n _v0.lerpVectors(line.start, line.end, 0.5);\r\n getPlaneYAtPoint(plane, _v0, _v1);\r\n return _v1.y < _v0.y;\r\n };\r\n})();\r\nexport const isYProjectedLineDegenerate = (function () {\r\n const _tempDir = new Vector3();\r\n const _upVector = new Vector3(0, 1, 0);\r\n return function isYProjectedLineDegenerate(line) {\r\n line.delta(_tempDir).normalize();\r\n return Math.abs(_tempDir.dot(_upVector)) >= 1.0 - EPSILON;\r\n };\r\n})();\r\n// checks whether the y-projected triangle will be degerate\r\nexport function isYProjectedTriangleDegenerate(tri) {\r\n if (tri.needsUpdate) {\r\n tri.update();\r\n }\r\n return Math.abs(tri.plane.normal.dot(_upVector)) <= EPSILON;\r\n}\r\n// Is the provided line exactly an edge on the triangle\r\nexport function isLineTriangleEdge(tri, line) {\r\n // if this is the same line as on the triangle\r\n const triPoints = tri.points;\r\n let matches = 0;\r\n for (let i = 0; i < 3; i++) {\r\n const { start, end } = line;\r\n const tp = triPoints[i];\r\n if (start.distanceToSquared(tp) <= EPSILON) {\r\n matches++;\r\n }\r\n if (end.distanceToSquared(tp) <= EPSILON) {\r\n matches++;\r\n }\r\n }\r\n return matches >= 2;\r\n}\r\n// Extracts the normalized [0, 1] distances along the given line that overlaps with the provided triangle when\r\n// projected along the y axis\r\nexport const getProjectedOverlaps = (function () {\r\n const _target = new Line3();\r\n const _tempDir = new Vector3();\r\n const _tempVec0 = new Vector3();\r\n const _tempVec1 = new Vector3();\r\n const _line = new Line3();\r\n const _tri = new ExtendedTriangle();\r\n return function getProjectedOverlaps(tri, line, overlapsTarget) {\r\n _line.copy(line);\r\n _tri.copy(tri);\r\n // flatten them to a common plane\r\n _line.start.y = 0;\r\n _line.end.y = 0;\r\n _tri.a.y = 0;\r\n _tri.b.y = 0;\r\n _tri.c.y = 0;\r\n _tri.needsUpdate = true;\r\n _tri.update();\r\n // if the line is meaningfully long and the we have an overlapping line then extract the\r\n // distances along the original line to return\r\n if (getOverlappingLine(_line, _tri, _target)) {\r\n _line.delta(_tempDir);\r\n _tempVec0.subVectors(_target.start, _line.start);\r\n _tempVec1.subVectors(_target.end, _line.start);\r\n let d0 = _tempVec0.length() / _tempDir.length();\r\n let d1 = _tempVec1.length() / _tempDir.length();\r\n d0 = Math.min(Math.max(d0, 0), 1);\r\n d1 = Math.min(Math.max(d1, 0), 1);\r\n if (!(Math.abs(d0 - d1) <= EPSILON)) {\r\n overlapsTarget.push(new Float32Array([d0, d1]));\r\n }\r\n return true;\r\n }\r\n return false;\r\n };\r\n})();\r\n// Trim the provided line to just the section below the given triangle plane\r\nexport const trimToBeneathTriPlane = (function () {\r\n const _lineDirection = new Vector3();\r\n const _planeHit = new Vector3();\r\n const _centerPoint = new Vector3();\r\n const _planePoint = new Vector3();\r\n return function trimToBeneathTriPlane(tri, line, lineTarget) {\r\n if (tri.needsUpdate) {\r\n tri.update();\r\n }\r\n lineTarget.copy(line);\r\n // handle vertical triangles\r\n const { plane } = tri;\r\n if (isYProjectedTriangleDegenerate(tri)) {\r\n return false;\r\n }\r\n // if the line and plane are coplanar then return that we can't trim\r\n line.delta(_lineDirection);\r\n const areCoplanar = plane.normal.dot(_lineDirection) === 0.0;\r\n if (areCoplanar) {\r\n return false;\r\n }\r\n // if the line does intersect the plane then trim\r\n const doesLineIntersect = plane.intersectLine(line, _planeHit);\r\n if (doesLineIntersect) {\r\n const { start, end } = lineTarget;\r\n // test the line side with the largest segment extending beyond the plane\r\n let testPoint;\r\n let flipped = false;\r\n if (start.distanceTo(_planeHit) > end.distanceTo(_planeHit)) {\r\n testPoint = start;\r\n }\r\n else {\r\n testPoint = end;\r\n flipped = true;\r\n }\r\n // get the center point of the line segment and the plane hit\r\n _centerPoint.lerpVectors(testPoint, _planeHit, 0.5);\r\n getPlaneYAtPoint(tri.plane, _centerPoint, _planePoint);\r\n // adjust the appropriate line point align with the plane hit point\r\n if (_planePoint.y < _centerPoint.y) {\r\n if (flipped)\r\n end.copy(_planeHit);\r\n else\r\n start.copy(_planeHit);\r\n }\r\n else if (flipped)\r\n start.copy(_planeHit);\r\n else\r\n end.copy(_planeHit);\r\n return true;\r\n }\r\n return false;\r\n };\r\n})();\r\n// Converts the given array of overlaps into line segments\r\nexport const overlapsToLines = (function () {\r\n const newLine = new Line3();\r\n return function overlapsToLines(line, overlaps, target = []) {\r\n compressEdgeOverlaps(overlaps);\r\n const invOverlaps = [[0, 1]];\r\n for (let i = 0, l = overlaps.length; i < l; i++) {\r\n const invOverlap = invOverlaps[i];\r\n const overlap = overlaps[i];\r\n invOverlap[1] = overlap[0];\r\n invOverlaps.push(new Float32Array([overlap[1], 1]));\r\n }\r\n for (let i = 0, l = invOverlaps.length; i < l; i++) {\r\n const { start, end } = line;\r\n newLine.start.lerpVectors(start, end, invOverlaps[i][0]);\r\n newLine.end.lerpVectors(start, end, invOverlaps[i][1]);\r\n target.push(\r\n // @ts-ignore\r\n new Float32Array([\r\n newLine.start.x,\r\n newLine.start.y,\r\n newLine.start.z,\r\n newLine.end.x,\r\n newLine.end.y,\r\n newLine.end.z\r\n ]));\r\n }\r\n return target;\r\n };\r\n})();\r\n// converts the given list of edges to a line segments geometry\r\nexport function edgesToGeometry(edges, y = null) {\r\n const edgeArray = new Float32Array(edges.length * 6);\r\n let c = 0;\r\n for (let i = 0, l = edges.length; i < l; i++) {\r\n const line = edges[i];\r\n edgeArray[c++] = line[0];\r\n edgeArray[c++] = y === null ? line[1] : y;\r\n edgeArray[c++] = line[2];\r\n edgeArray[c++] = line[3];\r\n edgeArray[c++] = y === null ? line[4] : y;\r\n edgeArray[c++] = line[5];\r\n }\r\n const edgeGeom = new BufferGeometry();\r\n const edgeBuffer = new BufferAttribute(edgeArray, 3, true);\r\n edgeGeom.setAttribute('position', edgeBuffer);\r\n return edgeGeom;\r\n}\r\n// compresses the given edge overlaps into a minimal set of representative objects\r\nexport function compressEdgeOverlaps(overlaps) {\r\n overlaps.sort((a, b) => {\r\n return a[0] - b[0];\r\n });\r\n for (let i = 1; i < overlaps.length; i++) {\r\n const overlap = overlaps[i];\r\n const prevOverlap = overlaps[i - 1];\r\n if (overlap[0] <= prevOverlap[1]) {\r\n prevOverlap[1] = Math.max(prevOverlap[1], overlap[1]);\r\n overlaps.splice(i, 1);\r\n i--;\r\n }\r\n }\r\n}\r\n//# sourceMappingURL=edge-utils.js.map","import * as THREE from \"three\";\r\nimport { MeshBVH } from \"three-mesh-bvh\";\r\nimport { compressEdgeOverlaps, edgesToGeometry, generateEdges, getProjectedOverlaps, isLineAbovePlane, isLineTriangleEdge, isYProjectedLineDegenerate, isYProjectedTriangleDegenerate, overlapsToLines, trimToBeneathTriPlane, } from \"./edge-utils\";\r\n// Source: https://github.com/gkjohnson/three-mesh-bvh/blob/master/example/edgeProjection.js\r\nexport class EdgeProjector {\r\n constructor() {\r\n this.params = {\r\n displayModel: \"color\",\r\n displayEdges: false,\r\n displayProjection: true,\r\n useBVH: true,\r\n sortEdges: true,\r\n amount: 50,\r\n color: 0x666666,\r\n };\r\n this._defaultMaterial = new THREE.LineBasicMaterial({\r\n color: this.params.color,\r\n });\r\n this.projectedEdges = [];\r\n }\r\n dispose() {\r\n this.disposeGeometry();\r\n this._defaultMaterial.dispose();\r\n }\r\n disposeGeometry() {\r\n this.projectedEdges.forEach((edge) => {\r\n edge.geometry.dispose();\r\n if (Array.isArray(edge.material))\r\n edge.material.forEach((mat) => mat.dispose());\r\n else\r\n edge.material.dispose();\r\n });\r\n this.projectedEdges = [];\r\n }\r\n async project(meshes, height) {\r\n // create projection display mesh\r\n const projection = new THREE.LineSegments(new THREE.BufferGeometry(), this._defaultMaterial);\r\n const tempMatrix = new THREE.Matrix4();\r\n const v1 = new THREE.Vector3();\r\n const v2 = new THREE.Vector3();\r\n const v3 = new THREE.Vector3();\r\n const vertices = [];\r\n const indices = [];\r\n let nextIndex = 0;\r\n for (const mesh of meshes) {\r\n mesh.updateWorldMatrix(false, false);\r\n const transform = mesh.matrixWorld.clone();\r\n const pos = mesh.geometry.attributes.position.array;\r\n const index = mesh.geometry.index.array;\r\n for (let i = 0; i < mesh.count; i++) {\r\n const pastIndices = new Map();\r\n mesh.getMatrixAt(i, tempMatrix);\r\n tempMatrix.multiply(transform);\r\n for (let j = 0; j < index.length; j += 3) {\r\n const index1 = index[j] * 3;\r\n const index2 = index[j + 1] * 3;\r\n const index3 = index[j + 2] * 3;\r\n v1.set(pos[index1], pos[index1 + 1], pos[index1 + 2]);\r\n v2.set(pos[index2], pos[index2 + 1], pos[index2 + 2]);\r\n v3.set(pos[index3], pos[index3 + 1], pos[index3 + 2]);\r\n v1.applyMatrix4(tempMatrix);\r\n v2.applyMatrix4(tempMatrix);\r\n v3.applyMatrix4(tempMatrix);\r\n if (v1.y > height && v2.y > height && v3.y > height) {\r\n continue;\r\n }\r\n if (!pastIndices.has(index1)) {\r\n pastIndices.set(index1, nextIndex++);\r\n vertices.push(v1.x, v1.y, v1.z);\r\n }\r\n if (!pastIndices.has(index2)) {\r\n pastIndices.set(index2, nextIndex++);\r\n vertices.push(v2.x, v2.y, v2.z);\r\n }\r\n if (!pastIndices.has(index3)) {\r\n pastIndices.set(index3, nextIndex++);\r\n vertices.push(v3.x, v3.y, v3.z);\r\n }\r\n const i1 = pastIndices.get(index1);\r\n const i2 = pastIndices.get(index2);\r\n const i3 = pastIndices.get(index3);\r\n if (i1 !== undefined && i2 !== undefined && i3 !== undefined) {\r\n indices.push(i1, i2, i3);\r\n }\r\n }\r\n }\r\n }\r\n const buffer = new Float32Array(vertices);\r\n const mergedGeometry = new THREE.BufferGeometry();\r\n mergedGeometry.setIndex(indices);\r\n const attribute = new THREE.BufferAttribute(buffer, 3);\r\n mergedGeometry.setAttribute(\"position\", attribute);\r\n let task = this.updateEdges(this.params, mergedGeometry, projection);\r\n while (task) {\r\n const res = task.next();\r\n if (res.done) {\r\n task = null;\r\n }\r\n }\r\n this.projectedEdges.push(projection);\r\n mergedGeometry.dispose();\r\n return projection;\r\n }\r\n *updateEdges(params, mergedGeometry, projection) {\r\n yield;\r\n // generate the bvh for acceleration\r\n const bvh = new MeshBVH(mergedGeometry);\r\n yield;\r\n // generate the candidate edges\r\n const edges = generateEdges(mergedGeometry, new THREE.Vector3(0, 1, 0), 50);\r\n if (params.sortEdges) {\r\n edges.sort((a, b) => {\r\n return Math.min(a.start.y, a.end.y) - Math.min(b.start.y, b.end.y);\r\n });\r\n }\r\n yield;\r\n // trim the candidate edges\r\n const finalEdges = [];\r\n const tempLine = new THREE.Line3();\r\n const tempRay = new THREE.Ray();\r\n const tempVec = new THREE.Vector3();\r\n for (let i = 0, l = edges.length; i < l; i++) {\r\n const line = edges[i];\r\n if (isYProjectedLineDegenerate(line)) {\r\n continue;\r\n }\r\n const lowestLineY = Math.min(line.start.y, line.end.y);\r\n const overlaps = [];\r\n bvh.shapecast({\r\n intersectsBounds: (box) => {\r\n if (!params.useBVH) {\r\n return true;\r\n }\r\n // check if the box bounds are above the lowest line point\r\n box.min.y = Math.min(lowestLineY, box.min.y);\r\n tempRay.origin.copy(line.start);\r\n line.delta(tempRay.direction).normalize();\r\n if (box.containsPoint(tempRay.origin)) {\r\n return true;\r\n }\r\n if (tempRay.intersectBox(box, tempVec)) {\r\n return (tempRay.origin.distanceToSquared(tempVec) < line.distanceSq());\r\n }\r\n return false;\r\n },\r\n intersectsTriangle: (tri) => {\r\n // skip the triangle if it is completely below the line\r\n const highestTriangleY = Math.max(tri.a.y, tri.b.y, tri.c.y);\r\n if (highestTriangleY < lowestLineY) {\r\n return false;\r\n }\r\n // if the projected triangle is just a line then don't check it\r\n if (isYProjectedTriangleDegenerate(tri)) {\r\n return false;\r\n }\r\n // if this line lies on a triangle edge then don't check it\r\n if (isLineTriangleEdge(tri, line)) {\r\n return false;\r\n }\r\n trimToBeneathTriPlane(tri, line, tempLine);\r\n if (isLineAbovePlane(tri.plane, tempLine)) {\r\n return false;\r\n }\r\n if (tempLine.distance() < 1e-10) {\r\n return false;\r\n }\r\n // compress the edge overlaps so we can easily tell if the whole edge is hidden already\r\n // and exit early\r\n if (getProjectedOverlaps(tri, line, overlaps)) {\r\n compressEdgeOverlaps(overlaps);\r\n }\r\n // if we're hiding the edge entirely now then skip further checks\r\n if (overlaps.length !== 0) {\r\n const [d0, d1] = overlaps[overlaps.length - 1];\r\n return d0 === 0.0 && d1 === 1.0;\r\n }\r\n return false;\r\n },\r\n });\r\n overlapsToLines(line, overlaps, finalEdges);\r\n }\r\n projection.geometry.dispose();\r\n projection.geometry = edgesToGeometry(finalEdges, 0);\r\n }\r\n}\r\n//# sourceMappingURL=edge-projector.js.map","import Drawing from \"dxf-writer\";\r\nimport { FragmentManager, FragmentPlans } from \"../../fragments\";\r\nimport { EdgeProjector } from \"./src/edge-projector\";\r\nimport { Component } from \"../../base-types\";\r\nimport { ToolComponent } from \"../../core\";\r\nexport class DXFExporter extends Component {\r\n constructor(components) {\r\n super(components);\r\n this.enabled = true;\r\n this.precission = 0.001;\r\n this._projector = new EdgeProjector();\r\n this.components.tools.add(DXFExporter.uuid, this);\r\n }\r\n get() {\r\n return this._projector;\r\n }\r\n dispose() {\r\n this._projector.dispose();\r\n }\r\n async export(name) {\r\n const drawing = new Drawing();\r\n drawing.setUnits(\"Meters\");\r\n // Draw projected lines\r\n const fragPlans = this.components.tools.get(FragmentPlans);\r\n const fragments = this.components.tools.get(FragmentManager);\r\n const plans = fragPlans.get();\r\n const plan = plans.find((plan) => plan.name === name);\r\n if (!plan || !plan.plane) {\r\n throw new Error(\"Plan doesn't exist!\");\r\n }\r\n const meshes = Object.values(fragments.list).map((frag) => frag.mesh);\r\n let height = plan.point.y;\r\n if (plan.offset) {\r\n height += plan.offset;\r\n }\r\n drawing.addLayer(\"projection\", Drawing.ACI.BLUE, \"CONTINUOUS\");\r\n drawing.setActiveLayer(\"projection\");\r\n const projectedLines = await this._projector.project(meshes, height);\r\n this.drawGeometry(projectedLines.geometry, drawing);\r\n projectedLines.geometry.dispose();\r\n projectedLines.material.dispose();\r\n // Draw section lines\r\n const edges = plan.plane.edges.get();\r\n for (const layerName in edges) {\r\n const mesh = edges[layerName].mesh;\r\n const material = mesh.material;\r\n const { r, g, b } = material.color;\r\n let layerColor;\r\n if (r > g && r > b) {\r\n layerColor = Drawing.ACI.RED;\r\n }\r\n else if (g > r && g > b) {\r\n layerColor = Drawing.ACI.GREEN;\r\n }\r\n else if (b > r && b > g) {\r\n layerColor = Drawing.ACI.BLUE;\r\n }\r\n else {\r\n layerColor = Drawing.ACI.WHITE;\r\n }\r\n drawing.addLayer(layerName, layerColor, \"CONTINUOUS\");\r\n drawing.setActiveLayer(layerName);\r\n this.drawGeometry(mesh.geometry, drawing);\r\n }\r\n return drawing.toDxfString();\r\n }\r\n drawGeometry(geometry, drawing) {\r\n const pos = geometry.attributes.position.array;\r\n const range = Math.min(geometry.drawRange.count * 3, pos.length);\r\n for (let i = 0; i < range; i += 6) {\r\n const x1 = pos[i];\r\n const y1 = pos[i + 2];\r\n const x2 = pos[i + 3];\r\n const y2 = pos[i + 5];\r\n const diffX = Math.abs(x2 - x1);\r\n const diffY = Math.abs(y2 - y1);\r\n const approxDistance = diffX + diffY;\r\n if (approxDistance > this.precission) {\r\n drawing.drawLine(x1, y1, x2, y2);\r\n }\r\n }\r\n }\r\n}\r\nDXFExporter.uuid = \"568f2167-24a3-4519-b552-3b04cc74a6a6\";\r\nToolComponent.libraryUUIDs.add(DXFExporter.uuid);\r\n//# sourceMappingURL=index.js.map"],"names":["_upVector","Vector3","EPSILON","generateEdges","_v0","_v1","_normal","_triangle","Triangle","geometry","projectionDir","thresholdAngle","edges","precision","Math","pow","thresholdDot","cos","MathUtils","DEG2RAD","indexAttr","getIndex","positionAttr","getAttribute","indexCount","count","indexArr","vertKeys","hashes","Array","edgeData","i","getX","a","b","c","fromBufferAttribute","getNormal","round","x","y","z","j","jNext","vecHash0","vecHash1","v0","v1","hash","reverseHash","otherNormal","normal","meetsThreshold","dot","projectionThreshold","sign","line","Line3","start","copy","end","push","index0","index1","clone","key","getOverlappingLine","_dir0","_dir1","_tempDir","_orthoPlane","Plane","_line0","_line1","_tempLine","triangle","lineTarget","needsUpdate","getArea","points","plane","delta","cross","normalize","setFromNormalAndCoplanarPoint","intersectCount","p1","p2","distanceToPoint","intersectLine","p","distanceTo","tmp","s1","e1","s2","e2","subVectors","getPlaneYAtPoint","testLine","point","target","isLineAbovePlane","lerpVectors","isYProjectedLineDegenerate","abs","isYProjectedTriangleDegenerate","tri","update","isLineTriangleEdge","triPoints","matches","tp","distanceToSquared","getProjectedOverlaps","_target","_tempVec0","_tempVec1","_line","_tri","ExtendedTriangle","overlapsTarget","d0","length","d1","min","max","Float32Array","trimToBeneathTriPlane","_lineDirection","_planeHit","_centerPoint","_planePoint","testPoint","flipped","overlapsToLines","newLine","overlaps","compressEdgeOverlaps","invOverlaps","l","invOverlap","overlap","sort","prevOverlap","splice","EdgeProjector","constructor","this","params","displayModel","displayEdges","displayProjection","useBVH","sortEdges","amount","color","_defaultMaterial","projectedEdges","dispose","disposeGeometry","forEach","edge","isArray","material","mat","project","meshes","height","projection","tempMatrix","v2","v3","vertices","indices","nextIndex","mesh","updateWorldMatrix","transform","matrixWorld","pos","attributes","position","array","index","pastIndices","Map","getMatrixAt","multiply","index2","index3","set","applyMatrix4","has","i1","get","i2","i3","undefined","buffer","mergedGeometry","setIndex","attribute","setAttribute","task","updateEdges","next","done","bvh","MeshBVH","finalEdges","tempLine","tempRay","tempVec","lowestLineY","shapecast","intersectsBounds","box","origin","direction","containsPoint","intersectBox","distanceSq","intersectsTriangle","distance","edgeArray","edgeGeom","BufferGeometry","edgeBuffer","BufferAttribute","edgesToGeometry","DXFExporter","components","super","enabled","precission","_projector","tools","add","uuid","name","drawing","setUnits","fragPlans","fragments","plan","find","Error","Object","values","list","map","frag","offset","addLayer","BLUE","setActiveLayer","projectedLines","drawGeometry","layerName","r","g","layerColor","RED","GREEN","WHITE","toDxfString","range","drawRange","x1","y1","x2","y2","drawLine","libraryUUIDs"],"sourceRoot":""}