@itwin/core-geometry 4.3.0-dev.10 → 4.3.0-dev.12

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.
@@ -62,7 +62,7 @@ export declare class PolyfaceData {
62
62
  * *
63
63
  */
64
64
  constructor(needNormals?: boolean, needParams?: boolean, needColors?: boolean, twoSided?: boolean);
65
- /** Return a depp clone. */
65
+ /** Return a deep clone. */
66
66
  clone(): PolyfaceData;
67
67
  /** Test for equal indices and nearly equal coordinates */
68
68
  isAlmostEqual(other: PolyfaceData): boolean;
@@ -62,7 +62,7 @@ class PolyfaceData {
62
62
  this._twoSided = twoSided;
63
63
  this._expectedClosure = 0;
64
64
  }
65
- /** Return a depp clone. */
65
+ /** Return a deep clone. */
66
66
  clone() {
67
67
  const result = new PolyfaceData();
68
68
  result.point = this.point.clone();
@@ -1 +1 @@
1
- {"version":3,"file":"PolyfaceData.js","sourceRoot":"","sources":["../../../src/polyface/PolyfaceData.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAAuC;AACvC,mEAAgE;AAChE,qEAAkE;AAClE,mEAAwD;AACxD,mEAAkE;AAClE,6DAAyD;AACzD,+CAA8C;AAE9C,mEAAgE;AAChE,uCAA4C;AAE5C,2DAAwD;AAExD;;;;;;;GAOG;AACH,MAAa,YAAY;IAyCvB,sEAAsE;IACtE,IAAW,QAAQ,KAAc,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACzD,IAAW,QAAQ,CAAC,KAAc,IAAI,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC;IAE/D,yCAAyC;IAClC,oBAAoB,CAAC,IAAmC;QAC7D,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAChC,CAAC;IAED,sEAAsE;IACtE,IAAW,eAAe,KAAa,OAAO,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACtE,IAAW,eAAe,CAAC,KAAa,I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AAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;wBAClC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;wBACpB,MAAM,EAAE,CAAC;qBACV;iBACF;gBACD,OAAO,IAAI,CAAC;aACb;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;;AAneD,MAAM;AACN,iFAAiF;AACjF,8CAA8C;AAC9C,oFAAoF;AACpF,qDAAqD;AACrD,2CAA2C;AAC3C,sDAAsD;AACtD,0DAA0D;AAC1D,QAAQ;AACR;;GAEG;AACoB,iCAAoB,GAAG,OAAO,CAAC;AAb3C,oCAAY","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Polyface\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GrowableXYArray } from \"../geometry3d/GrowableXYArray\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { NumberArray } from \"../geometry3d/PointHelpers\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { ClusterableArray } from \"../numerics/ClusterableArray\";\r\nimport { PolyfaceAuxData } from \"./AuxData\";\r\nimport { FacetFaceData } from \"./FacetFaceData\";\r\nimport { TaggedNumericData } from \"./TaggedNumericData\";\r\n\r\n/**\r\n * PolyfaceData carries data arrays for point, normal, param, color and their indices.\r\n *\r\n * * IndexedPolyface carries a PolyfaceData as a member. (NOT as a base class -- it already has GeometryQuery as base)\r\n * * IndexedPolyfaceVisitor uses PolyfaceData as a base class. In this use there is only a single facet in the polyfaceData.\r\n * * PolyfaceData does not know (!!!) what indices range constitute a facet. That is managed by derived class or carrier class.\r\n * @public\r\n */\r\nexport class PolyfaceData {\r\n // <ul\r\n // <li>optional arrays (normal, uv, color) must be indicated at constructor time.\r\n // <li>all arrays are (independently) indexed.\r\n // <li>with regret, the point, param, normal, and color arrays are exposed publicly.\r\n // <li>getX methods are \"trusting\" -- no bounds check\r\n // <li>getX methods return references to X.\r\n // <li> EXCEPT -- for optional arrays, the return 000.\r\n // <li>copyX methods move data to caller-supplied result..\r\n // </ul>\r\n /** Relative tolerance used in tests for planar facets\r\n * @internal\r\n */\r\n public static readonly planarityLocalRelTol = 1.0e-13;\r\n /** Coordinate data for points in the facets, packed as numbers in a contiguous array. */\r\n public point: GrowableXYZArray;\r\n /** Indices of points at facet vertices. */\r\n public pointIndex: number[];\r\n /** booleans indicating visibility of corresponding edges */\r\n public edgeVisible: boolean[];\r\n /** Coordinates of normal vectors, packed as numbers in a contiguous array */\r\n public normal: GrowableXYZArray | undefined;\r\n /** indices of normals at facet vertices. */\r\n public normalIndex: number[] | undefined;\r\n /** Coordinates of uv parameters, packed as numbers in a contiguous array. */\r\n public param?: GrowableXYArray;\r\n /** Indices of params at facet vertices. */\r\n public paramIndex: number[] | undefined;\r\n /** Color values. These are carried around as simple numbers, but are probably\r\n * required (by display systems) map exactly to 32 bit integers.\r\n */\r\n public color: number[] | undefined;\r\n /** Indices of colors at facet vertices. */\r\n public colorIndex: number[] | undefined;\r\n /** Face data will remain empty until a face is specified. */\r\n public face: FacetFaceData[];\r\n /** Auxiliary data */\r\n public auxData: PolyfaceAuxData | undefined;\r\n /** Tagged geometry data */\r\n public taggedNumericData: TaggedNumericData | undefined;\r\n private _twoSided: boolean;\r\n /** boolean tag indicating if the facets are viewable from the back */\r\n public get twoSided(): boolean { return this._twoSided; }\r\n public set twoSided(value: boolean) { this._twoSided = value; }\r\n\r\n /** set the `taggedNumericData` member */\r\n public setTaggedNumericData(data: TaggedNumericData | undefined) {\r\n this.taggedNumericData = data;\r\n }\r\n private _expectedClosure: number;\r\n /** boolean tag indicating if the facets are viewable from the back */\r\n public get expectedClosure(): number { return this._expectedClosure; }\r\n public set expectedClosure(value: number) { this._expectedClosure = value; }\r\n /** Constructor for facets.\r\n * * The various params control whether respective arrays are to be allocated.\r\n * * If arrayData is provided, all other params are IGNORED.\r\n * *\r\n */\r\n public constructor(needNormals: boolean = false, needParams: boolean = false, needColors: boolean = false, twoSided: boolean = false) {\r\n this.face = [];\r\n this.point = new GrowableXYZArray();\r\n this.pointIndex = []; this.edgeVisible = [];\r\n if (needNormals) { this.normal = new GrowableXYZArray(); this.normalIndex = []; }\r\n if (needParams) { this.param = new GrowableXYArray(); this.paramIndex = []; }\r\n if (needColors) { this.color = []; this.colorIndex = []; }\r\n this._twoSided = twoSided;\r\n this._expectedClosure = 0;\r\n }\r\n /** Return a depp clone. */\r\n public clone(): PolyfaceData {\r\n const result = new PolyfaceData();\r\n result.point = this.point.clone();\r\n result.pointIndex = this.pointIndex.slice();\r\n result.edgeVisible = this.edgeVisible.slice();\r\n result.face = this.face.slice();\r\n result.twoSided = this.twoSided;\r\n result.expectedClosure = this.expectedClosure;\r\n if (this.normal)\r\n result.normal = this.normal.clone();\r\n if (this.param)\r\n result.param = this.param.clone();\r\n if (this.color)\r\n result.color = this.color.slice();\r\n\r\n if (this.normalIndex)\r\n result.normalIndex = this.normalIndex.slice();\r\n if (this.paramIndex)\r\n result.paramIndex = this.paramIndex.slice();\r\n if (this.colorIndex)\r\n result.colorIndex = this.colorIndex.slice();\r\n if (this.auxData)\r\n result.auxData = this.auxData.clone();\r\n if (this.taggedNumericData){\r\n result.taggedNumericData = this.taggedNumericData.clone();\r\n }\r\n return result;\r\n }\r\n /** Test for equal indices and nearly equal coordinates */\r\n public isAlmostEqual(other: PolyfaceData): boolean {\r\n if (!GrowableXYZArray.isAlmostEqual(this.point, other.point))\r\n return false;\r\n if (!NumberArray.isExactEqual(this.pointIndex, other.pointIndex))\r\n return false;\r\n\r\n if (!GrowableXYZArray.isAlmostEqual(this.normal, other.normal)) return false;\r\n if (!NumberArray.isExactEqual(this.normalIndex, other.normalIndex)) return false;\r\n\r\n if (!GrowableXYArray.isAlmostEqual(this.param, other.param)) return false;\r\n if (!NumberArray.isExactEqual(this.paramIndex, other.paramIndex)) return false;\r\n\r\n if (!NumberArray.isExactEqual(this.color, other.color)) return false;\r\n if (!NumberArray.isExactEqual(this.colorIndex, other.colorIndex)) return false;\r\n\r\n if (!NumberArray.isExactEqual(this.edgeVisible, other.edgeVisible)) return false;\r\n if (!PolyfaceAuxData.isAlmostEqual(this.auxData, other.auxData)) return false;\r\n\r\n if (this.twoSided !== other.twoSided)\r\n return false;\r\n\r\n if (this.expectedClosure !== other.expectedClosure)\r\n return false;\r\n if (!TaggedNumericData.areAlmostEqual(this.taggedNumericData, other.taggedNumericData))\r\n return false;\r\n return true;\r\n }\r\n /** Ask if normals are required in this mesh. */\r\n public get requireNormals(): boolean { return undefined !== this.normal; }\r\n /** Get the point count */\r\n public get pointCount() { return this.point.length; }\r\n /** Get the normal count */\r\n public get normalCount() { return this.normal ? this.normal.length : 0; }\r\n /** Get the param count */\r\n public get paramCount() { return this.param ? this.param.length : 0; }\r\n /** Get the color count */\r\n public get colorCount() { return this.color ? this.color.length : 0; }\r\n /** Get the index count. Note that there is one count, and all index arrays (point, normal, param, color) must match */\r\n public get indexCount() { return this.pointIndex.length; } // ALWAYS INDEXED ... all index vectors must have same length.\r\n /** Get the number of faces.\r\n * * Note that a \"face\" is not a facet.\r\n * * A \"face\" is a subset of facets grouped for application purposes.\r\n */\r\n public get faceCount() { return this.face.length; }\r\n\r\n /** return indexed point. This is a copy of the coordinates, not a reference. */\r\n public getPoint(i: number, out?: Point3d): Point3d | undefined {\r\n return this.point.getPoint3dAtCheckedPointIndex(i, out);\r\n }\r\n /** return indexed normal. This is the COPY to the normal, not a reference. */\r\n public getNormal(i: number): Vector3d | undefined { return this.normal ? this.normal.getVector3dAtCheckedVectorIndex(i) : undefined; }\r\n /** return indexed param. This is the COPY of the coordinates, not a reference. */\r\n public getParam(i: number): Point2d | undefined { return this.param ? this.param.getPoint2dAtCheckedPointIndex(i) : undefined; }\r\n /** return indexed color */\r\n public getColor(i: number): number { return this.color ? this.color[i] : 0; }\r\n /** return indexed visibility */\r\n public getEdgeVisible(i: number): boolean { return this.edgeVisible[i]; }\r\n /** Copy the contents (not pointer) of point[i] into dest. */\r\n public copyPointTo(i: number, dest: Point3d): void { this.point.getPoint3dAtUncheckedPointIndex(i, dest); }\r\n /** Copy the contents (not pointer) of normal[i] into dest. */\r\n public copyNormalTo(i: number, dest: Vector3d): void { if (this.normal) this.normal.getVector3dAtCheckedVectorIndex(i, dest); }\r\n /** Copy the contents (not pointer) of param[i] into dest. */\r\n public copyParamTo(i: number, dest: Point2d): void { if (this.param) this.param.getPoint2dAtCheckedPointIndex(i, dest); }\r\n /** test if normal at a specified index matches uv */\r\n public isAlmostEqualParamIndexUV(index: number, u: number, v: number): boolean {\r\n if (this.param !== undefined && index >= 0 && index < this.param.length)\r\n return Geometry.isSameCoordinate(u, this.param.getXAtUncheckedPointIndex(index))\r\n && Geometry.isSameCoordinate(v, this.param.getYAtUncheckedPointIndex(index));\r\n return false;\r\n }\r\n /**\r\n * * Copy data from other to this.\r\n * * This is the essence of transferring coordinates spread throughout a large polyface into a visitor's single facet.\r\n * * \"other\" is the large polyface\r\n * * \"this\" is the visitor\r\n * * does NOT copy face data - visitors reference the FacetFaceData array for the whole polyface!!\r\n * @param other polyface data being mined.\r\n * @param index0 start index in other's index arrays\r\n * @param index1 end index (one beyond last data accessed0 in other's index arrays\r\n * @param numWrap number of points to replicate as wraparound.\r\n */\r\n public gatherIndexedData(other: PolyfaceData, index0: number, index1: number, numWrap: number) {\r\n const numEdge = index1 - index0;\r\n const numTotal = numEdge + numWrap;\r\n this.resizeAllDataArrays(numTotal);\r\n // copy wrapped points\r\n for (let i = 0; i < numEdge; i++)\r\n this.point.transferFromGrowableXYZArray(i, other.point, other.pointIndex[index0 + i]);\r\n for (let i = 0; i < numWrap; i++)\r\n this.point.transferFromGrowableXYZArray(numEdge + i, this.point, i);\r\n\r\n // copy wrapped pointIndex\r\n for (let i = 0; i < numEdge; i++)\r\n this.pointIndex[i] = other.pointIndex[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.pointIndex[numEdge + i] = this.pointIndex[i];\r\n // copy wrapped edge visibility\r\n for (let i = 0; i < numEdge; i++)\r\n this.edgeVisible[i] = other.edgeVisible[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.edgeVisible[numEdge + i] = this.edgeVisible[i];\r\n\r\n if (this.normal && this.normalIndex && other.normal && other.normalIndex) {\r\n for (let i = 0; i < numEdge; i++)\r\n this.normal.transferFromGrowableXYZArray(i, other.normal, other.normalIndex[index0 + i]);\r\n for (let i = 0; i < numWrap; i++)\r\n this.normal.transferFromGrowableXYZArray(numEdge + i, this.normal, i);\r\n\r\n for (let i = 0; i < numEdge; i++)\r\n this.normalIndex[i] = other.normalIndex[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.normalIndex[numEdge + i] = this.normalIndex[i];\r\n }\r\n\r\n if (this.param && this.paramIndex && other.param && other.paramIndex) {\r\n for (let i = 0; i < numEdge; i++)\r\n this.param.transferFromGrowableXYArray(i, other.param, other.paramIndex[index0 + i]);\r\n for (let i = 0; i < numWrap; i++)\r\n this.param.transferFromGrowableXYArray(numEdge + i, this.param, i);\r\n\r\n for (let i = 0; i < numEdge; i++)\r\n this.paramIndex[i] = other.paramIndex[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.paramIndex[numEdge + i] = this.paramIndex[i];\r\n }\r\n\r\n if (this.color && this.colorIndex && other.color && other.colorIndex) {\r\n for (let i = 0; i < numEdge; i++)\r\n this.color[i] = other.color[other.colorIndex[index0 + i]];\r\n for (let i = 0; i < numWrap; i++)\r\n this.color[numEdge + i] = this.color[i];\r\n\r\n for (let i = 0; i < numEdge; i++)\r\n this.colorIndex[i] = other.colorIndex[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.colorIndex[numEdge + i] = this.colorIndex[i];\r\n }\r\n if (this.auxData && other.auxData && this.auxData.channels.length === other.auxData.channels.length) {\r\n for (let iChannel = 0; iChannel < this.auxData.channels.length; iChannel++) {\r\n const thisChannel = this.auxData.channels[iChannel];\r\n const otherChannel = other.auxData.channels[iChannel];\r\n const blockSize = thisChannel.entriesPerValue;\r\n if (thisChannel.data.length === otherChannel.data.length) {\r\n for (let iData = 0; iData < thisChannel.data.length; iData++) {\r\n const thisData = thisChannel.data[iData];\r\n const otherData = otherChannel.data[iData];\r\n for (let i = 0; i < numEdge; i++)\r\n thisData.copyValues(otherData, i, other.auxData.indices[index0 + i], blockSize);\r\n for (let i = 0; i < numWrap; i++)\r\n thisData.copyValues(thisData, other.auxData.indices[numEdge + i], i, blockSize);\r\n }\r\n }\r\n }\r\n for (let i = 0; i < numEdge; i++)\r\n this.auxData.indices[i] = other.auxData.indices[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.auxData.indices[numEdge + i] = this.auxData.indices[i];\r\n }\r\n }\r\n private static trimArray(data: any[] | undefined, length: number) { if (data && length < data.length) data.length = length; }\r\n /** Trim all index arrays to stated length.\r\n * * This is called by PolyfaceBuilder to clean up after an aborted construction sequence.\r\n */\r\n public trimAllIndexArrays(length: number): void {\r\n PolyfaceData.trimArray(this.pointIndex, length);\r\n PolyfaceData.trimArray(this.paramIndex, length);\r\n PolyfaceData.trimArray(this.normalIndex, length);\r\n PolyfaceData.trimArray(this.colorIndex, length);\r\n PolyfaceData.trimArray(this.edgeVisible, length);\r\n if (this.auxData) {\r\n PolyfaceData.trimArray(this.auxData.indices, length);\r\n for (const channel of this.auxData.channels) {\r\n for (const data of channel.data)\r\n PolyfaceData.trimArray(data.values, channel.entriesPerValue * length);\r\n }\r\n }\r\n }\r\n /** Resize all data arrays to specified length */\r\n public resizeAllDataArrays(length: number): void {\r\n if (length > this.point.length) {\r\n while (this.point.length < length) this.point.push(Point3d.create());\r\n while (this.pointIndex.length < length) this.pointIndex.push(-1);\r\n while (this.edgeVisible.length < length) this.edgeVisible.push(false);\r\n if (this.normal)\r\n while (this.normal.length < length) this.normal.push(Vector3d.create());\r\n if (this.param)\r\n while (this.param.length < length) this.param.push(Point2d.create());\r\n if (this.color)\r\n while (this.color.length < length) this.color.push(0);\r\n if (this.auxData) {\r\n for (const channel of this.auxData.channels) {\r\n for (const channelData of channel.data) {\r\n while (channelData.values.length < length * channel.entriesPerValue) channelData.values.push(0);\r\n }\r\n }\r\n }\r\n } else if (length < this.point.length) {\r\n this.point.resize(length);\r\n this.edgeVisible.length = length;\r\n this.pointIndex.length = length;\r\n if (this.normal) this.normal.resize(length);\r\n if (this.param) this.param.resize(length);\r\n if (this.color) this.color.length = length;\r\n if (this.auxData) {\r\n for (const channel of this.auxData.channels) {\r\n for (const channelData of channel.data) {\r\n channelData.values.length = length * channel.entriesPerValue;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /** Return the range of the point array (optionally transformed) */\r\n public range(result?: Range3d, transform?: Transform): Range3d {\r\n result = result ? result : Range3d.createNull();\r\n result.extendArray(this.point, transform);\r\n return result;\r\n }\r\n /** reverse indices facet-by-facet, with the given facetStartIndex array delimiting faces.\r\n *\r\n * * facetStartIndex[0] == 0 always -- start of facet zero.\r\n * * facet k has indices from facetStartIndex[k] <= i < facetStartIndex[k+1]\r\n * * hence for \"internal\" k, facetStartIndex[k] is both the upper limit of facet k-1 and the start of facet k.\r\n * *\r\n */\r\n public reverseIndices(facetStartIndex?: number[]) {\r\n if (facetStartIndex && PolyfaceData.isValidFacetStartIndexArray(facetStartIndex)) {\r\n PolyfaceData.reverseIndices(facetStartIndex, this.pointIndex, true);\r\n if (this.normalIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndices(facetStartIndex, this.normalIndex, true);\r\n if (this.paramIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndices(facetStartIndex, this.paramIndex, true);\r\n if (this.colorIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndices(facetStartIndex, this.colorIndex, true);\r\n PolyfaceData.reverseIndices(facetStartIndex, this.edgeVisible, false);\r\n }\r\n }\r\n /** reverse indices facet-by-facet, with the given facetStartIndex array delimiting faces.\r\n *\r\n * * facetStartIndex[0] == 0 always -- start of facet zero.\r\n * * facet k has indices from facetStartIndex[k] <= i < facetStartIndex[k+1]\r\n * * hence for \"internal\" k, facetStartIndex[k] is both the upper limit of facet k-1 and the start of facet k.\r\n * *\r\n */\r\n public reverseIndicesSingleFacet(facetId: number, facetStartIndex: number[]) {\r\n PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.pointIndex, true);\r\n if (this.normalIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.normalIndex, true);\r\n if (this.paramIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.paramIndex, true);\r\n if (this.colorIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.colorIndex, true);\r\n PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.edgeVisible, false);\r\n }\r\n\r\n /** Scale all the normals by -1 */\r\n public reverseNormals() {\r\n if (this.normal)\r\n this.normal.scaleInPlace(-1.0);\r\n }\r\n /** Apply `transform` to point and normal arrays and to auxData.\r\n * * IMPORTANT This base class is just a data carrier. It does not know if the index order and normal directions have special meaning.\r\n * * i.e. caller must separately reverse index order and normal direction if needed.\r\n */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n this.point.multiplyTransformInPlace(transform);\r\n\r\n if (this.normal && !transform.matrix.isIdentity)\r\n this.normal.multiplyAndRenormalizeMatrix3dInverseTransposeInPlace(transform.matrix);\r\n\r\n return undefined === this.auxData || this.auxData.tryTransformInPlace(transform);\r\n }\r\n /**\r\n * Compress the instance by equating duplicate data.\r\n * * Search for duplicates within points, normals, params, and colors.\r\n * * Compress each data array.\r\n * * Revise all indexing for the relocated data.\r\n * @param tolerance optional tolerance for clustering mesh vertices. Default is [[Geometry.smallMetricDistance]].\r\n */\r\n public compress(tolerance: number = Geometry.smallMetricDistance): void {\r\n const packedPoints = ClusterableArray.clusterGrowablePoint3dArray(this.point, tolerance);\r\n this.point = packedPoints.growablePackedPoints!;\r\n packedPoints.updateIndices(this.pointIndex);\r\n\r\n // for now, normals, params, and colors use the default tolerance for clustering...\r\n if (this.normalIndex && this.normal) {\r\n const packedNormals = ClusterableArray.clusterGrowablePoint3dArray(this.normal);\r\n this.normal = packedNormals.growablePackedPoints!;\r\n packedNormals.updateIndices(this.normalIndex);\r\n }\r\n if (this.paramIndex && this.param) {\r\n const packedParams = ClusterableArray.clusterGrowablePoint2dArray(this.param);\r\n this.param = packedParams.growablePackedPoints;\r\n packedParams.updateIndices(this.paramIndex);\r\n }\r\n if (this.colorIndex && this.color) {\r\n const packedColors = ClusterableArray.clusterNumberArray(this.color);\r\n this.color = packedColors.packedNumbers;\r\n packedColors.updateIndices(this.colorIndex);\r\n }\r\n }\r\n\r\n /**\r\n * Test if facetStartIndex is (minimally!) valid:\r\n * * length must be nonzero (recall that for \"no facets\" the facetStartIndexArray still must contain a 0)\r\n * * Each entry must be strictly smaller than the one that follows.\r\n * @param facetStartIndex array of facetStart data. facet `i` has indices at `facetsStartIndex[i]` to (one before) `facetStartIndex[i+1]`\r\n */\r\n public static isValidFacetStartIndexArray(facetStartIndex: number[]): boolean {\r\n // facetStartIndex for empty facets has a single entry \"0\" -- empty array is not allowed\r\n if (facetStartIndex.length === 0)\r\n return false;\r\n for (let i = 0; i + 1 < facetStartIndex.length; i++)\r\n if (facetStartIndex[i] >= facetStartIndex[i + 1])\r\n return false;\r\n return true;\r\n }\r\n /** Reverse data in entire facet indexing arrays.\r\n * * parameterized over type T so non-number data -- e.g. boolean visibility flags -- can be reversed.\r\n */\r\n public static reverseIndices<T>(facetStartIndex: number[], indices: T[] | undefined, preserveStart: boolean): boolean {\r\n if (!indices || indices.length === 0)\r\n return true; // empty case\r\n if (indices.length > 0) {\r\n if (facetStartIndex[facetStartIndex.length - 1] === indices.length) {\r\n for (let i = 0; i + 1 < facetStartIndex.length; i++) {\r\n let index0 = facetStartIndex[i];\r\n let index1 = facetStartIndex[i + 1];\r\n if (preserveStart) {\r\n // leave [index0] as is so reversed facet starts at same vertex\r\n while (index1 > index0 + 2) {\r\n index1--; index0++;\r\n const a = indices[index0];\r\n indices[index0] = indices[index1];\r\n indices[index1] = a;\r\n }\r\n } else {\r\n // reverse all\r\n while (index1 > index0 + 1) {\r\n index1--;\r\n const a = indices[index0];\r\n indices[index0] = indices[index1];\r\n indices[index1] = a;\r\n index0++;\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /** Reverse data in entire facet indexing arrays.\r\n * * parameterized over type T so non-number data -- e.g. boolean visibility flags -- can be reversed.\r\n */\r\n public static reverseIndicesSingleFacet<T>(facetId: number, facetStartIndex: number[], indices: T[] | undefined, preserveStart: boolean): boolean {\r\n if (!indices || indices.length === 0)\r\n return true; // empty case\r\n if (indices.length > 0) {\r\n if (facetStartIndex[facetStartIndex.length - 1] === indices.length\r\n && facetId >= 0 && facetId + 1 < facetStartIndex.length) {\r\n let index0 = facetStartIndex[facetId];\r\n let index1 = facetStartIndex[facetId + 1];\r\n if (preserveStart) {\r\n // leave [index0] as is so reversed facet starts at same vertex\r\n while (index1 > index0 + 2) {\r\n index1--; index0++;\r\n const a = indices[index0];\r\n indices[index0] = indices[index1];\r\n indices[index1] = a;\r\n }\r\n } else {\r\n // reverse all\r\n while (index1 > index0 + 1) {\r\n index1--;\r\n const a = indices[index0];\r\n indices[index0] = indices[index1];\r\n indices[index1] = a;\r\n index0++;\r\n }\r\n }\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"PolyfaceData.js","sourceRoot":"","sources":["../../../src/polyface/PolyfaceData.ts"],"names":[],"mappings":";AAAA;;;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,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;gBACtC,IAAI,MAAM,GAAG,eAAe,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;gBAC1C,IAAI,aAAa,EAAE;oBACjB,+DAA+D;oBAC/D,OAAO,MAAM,GAAG,MAAM,GAAG,CAAC,EAAE;wBAC1B,MAAM,EAAE,CAAC;wBAAC,MAAM,EAAE,CAAC;wBACnB,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;wBAC1B,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;wBAClC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;qBACrB;iBACF;qBAAM;oBACL,cAAc;oBACd,OAAO,MAAM,GAAG,MAAM,GAAG,CAAC,EAAE;wBAC1B,MAAM,EAAE,CAAC;wBACT,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;wBAC1B,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;wBAClC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;wBACpB,MAAM,EAAE,CAAC;qBACV;iBACF;gBACD,OAAO,IAAI,CAAC;aACb;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;;AAneD,MAAM;AACN,iFAAiF;AACjF,8CAA8C;AAC9C,oFAAoF;AACpF,qDAAqD;AACrD,2CAA2C;AAC3C,sDAAsD;AACtD,0DAA0D;AAC1D,QAAQ;AACR;;GAEG;AACoB,iCAAoB,GAAG,OAAO,CAAC;AAb3C,oCAAY","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Polyface\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GrowableXYArray } from \"../geometry3d/GrowableXYArray\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { NumberArray } from \"../geometry3d/PointHelpers\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { ClusterableArray } from \"../numerics/ClusterableArray\";\r\nimport { PolyfaceAuxData } from \"./AuxData\";\r\nimport { FacetFaceData } from \"./FacetFaceData\";\r\nimport { TaggedNumericData } from \"./TaggedNumericData\";\r\n\r\n/**\r\n * PolyfaceData carries data arrays for point, normal, param, color and their indices.\r\n *\r\n * * IndexedPolyface carries a PolyfaceData as a member. (NOT as a base class -- it already has GeometryQuery as base)\r\n * * IndexedPolyfaceVisitor uses PolyfaceData as a base class. In this use there is only a single facet in the polyfaceData.\r\n * * PolyfaceData does not know (!!!) what indices range constitute a facet. That is managed by derived class or carrier class.\r\n * @public\r\n */\r\nexport class PolyfaceData {\r\n // <ul\r\n // <li>optional arrays (normal, uv, color) must be indicated at constructor time.\r\n // <li>all arrays are (independently) indexed.\r\n // <li>with regret, the point, param, normal, and color arrays are exposed publicly.\r\n // <li>getX methods are \"trusting\" -- no bounds check\r\n // <li>getX methods return references to X.\r\n // <li> EXCEPT -- for optional arrays, the return 000.\r\n // <li>copyX methods move data to caller-supplied result..\r\n // </ul>\r\n /** Relative tolerance used in tests for planar facets\r\n * @internal\r\n */\r\n public static readonly planarityLocalRelTol = 1.0e-13;\r\n /** Coordinate data for points in the facets, packed as numbers in a contiguous array. */\r\n public point: GrowableXYZArray;\r\n /** Indices of points at facet vertices. */\r\n public pointIndex: number[];\r\n /** booleans indicating visibility of corresponding edges */\r\n public edgeVisible: boolean[];\r\n /** Coordinates of normal vectors, packed as numbers in a contiguous array */\r\n public normal: GrowableXYZArray | undefined;\r\n /** indices of normals at facet vertices. */\r\n public normalIndex: number[] | undefined;\r\n /** Coordinates of uv parameters, packed as numbers in a contiguous array. */\r\n public param?: GrowableXYArray;\r\n /** Indices of params at facet vertices. */\r\n public paramIndex: number[] | undefined;\r\n /** Color values. These are carried around as simple numbers, but are probably\r\n * required (by display systems) map exactly to 32 bit integers.\r\n */\r\n public color: number[] | undefined;\r\n /** Indices of colors at facet vertices. */\r\n public colorIndex: number[] | undefined;\r\n /** Face data will remain empty until a face is specified. */\r\n public face: FacetFaceData[];\r\n /** Auxiliary data */\r\n public auxData: PolyfaceAuxData | undefined;\r\n /** Tagged geometry data */\r\n public taggedNumericData: TaggedNumericData | undefined;\r\n private _twoSided: boolean;\r\n /** boolean tag indicating if the facets are viewable from the back */\r\n public get twoSided(): boolean { return this._twoSided; }\r\n public set twoSided(value: boolean) { this._twoSided = value; }\r\n\r\n /** set the `taggedNumericData` member */\r\n public setTaggedNumericData(data: TaggedNumericData | undefined) {\r\n this.taggedNumericData = data;\r\n }\r\n private _expectedClosure: number;\r\n /** boolean tag indicating if the facets are viewable from the back */\r\n public get expectedClosure(): number { return this._expectedClosure; }\r\n public set expectedClosure(value: number) { this._expectedClosure = value; }\r\n /** Constructor for facets.\r\n * * The various params control whether respective arrays are to be allocated.\r\n * * If arrayData is provided, all other params are IGNORED.\r\n * *\r\n */\r\n public constructor(needNormals: boolean = false, needParams: boolean = false, needColors: boolean = false, twoSided: boolean = false) {\r\n this.face = [];\r\n this.point = new GrowableXYZArray();\r\n this.pointIndex = []; this.edgeVisible = [];\r\n if (needNormals) { this.normal = new GrowableXYZArray(); this.normalIndex = []; }\r\n if (needParams) { this.param = new GrowableXYArray(); this.paramIndex = []; }\r\n if (needColors) { this.color = []; this.colorIndex = []; }\r\n this._twoSided = twoSided;\r\n this._expectedClosure = 0;\r\n }\r\n /** Return a deep clone. */\r\n public clone(): PolyfaceData {\r\n const result = new PolyfaceData();\r\n result.point = this.point.clone();\r\n result.pointIndex = this.pointIndex.slice();\r\n result.edgeVisible = this.edgeVisible.slice();\r\n result.face = this.face.slice();\r\n result.twoSided = this.twoSided;\r\n result.expectedClosure = this.expectedClosure;\r\n if (this.normal)\r\n result.normal = this.normal.clone();\r\n if (this.param)\r\n result.param = this.param.clone();\r\n if (this.color)\r\n result.color = this.color.slice();\r\n\r\n if (this.normalIndex)\r\n result.normalIndex = this.normalIndex.slice();\r\n if (this.paramIndex)\r\n result.paramIndex = this.paramIndex.slice();\r\n if (this.colorIndex)\r\n result.colorIndex = this.colorIndex.slice();\r\n if (this.auxData)\r\n result.auxData = this.auxData.clone();\r\n if (this.taggedNumericData) {\r\n result.taggedNumericData = this.taggedNumericData.clone();\r\n }\r\n return result;\r\n }\r\n /** Test for equal indices and nearly equal coordinates */\r\n public isAlmostEqual(other: PolyfaceData): boolean {\r\n if (!GrowableXYZArray.isAlmostEqual(this.point, other.point))\r\n return false;\r\n if (!NumberArray.isExactEqual(this.pointIndex, other.pointIndex))\r\n return false;\r\n\r\n if (!GrowableXYZArray.isAlmostEqual(this.normal, other.normal)) return false;\r\n if (!NumberArray.isExactEqual(this.normalIndex, other.normalIndex)) return false;\r\n\r\n if (!GrowableXYArray.isAlmostEqual(this.param, other.param)) return false;\r\n if (!NumberArray.isExactEqual(this.paramIndex, other.paramIndex)) return false;\r\n\r\n if (!NumberArray.isExactEqual(this.color, other.color)) return false;\r\n if (!NumberArray.isExactEqual(this.colorIndex, other.colorIndex)) return false;\r\n\r\n if (!NumberArray.isExactEqual(this.edgeVisible, other.edgeVisible)) return false;\r\n if (!PolyfaceAuxData.isAlmostEqual(this.auxData, other.auxData)) return false;\r\n\r\n if (this.twoSided !== other.twoSided)\r\n return false;\r\n\r\n if (this.expectedClosure !== other.expectedClosure)\r\n return false;\r\n if (!TaggedNumericData.areAlmostEqual(this.taggedNumericData, other.taggedNumericData))\r\n return false;\r\n return true;\r\n }\r\n /** Ask if normals are required in this mesh. */\r\n public get requireNormals(): boolean { return undefined !== this.normal; }\r\n /** Get the point count */\r\n public get pointCount() { return this.point.length; }\r\n /** Get the normal count */\r\n public get normalCount() { return this.normal ? this.normal.length : 0; }\r\n /** Get the param count */\r\n public get paramCount() { return this.param ? this.param.length : 0; }\r\n /** Get the color count */\r\n public get colorCount() { return this.color ? this.color.length : 0; }\r\n /** Get the index count. Note that there is one count, and all index arrays (point, normal, param, color) must match */\r\n public get indexCount() { return this.pointIndex.length; } // ALWAYS INDEXED ... all index vectors must have same length.\r\n /** Get the number of faces.\r\n * * Note that a \"face\" is not a facet.\r\n * * A \"face\" is a subset of facets grouped for application purposes.\r\n */\r\n public get faceCount() { return this.face.length; }\r\n\r\n /** return indexed point. This is a copy of the coordinates, not a reference. */\r\n public getPoint(i: number, out?: Point3d): Point3d | undefined {\r\n return this.point.getPoint3dAtCheckedPointIndex(i, out);\r\n }\r\n /** return indexed normal. This is the COPY to the normal, not a reference. */\r\n public getNormal(i: number): Vector3d | undefined { return this.normal ? this.normal.getVector3dAtCheckedVectorIndex(i) : undefined; }\r\n /** return indexed param. This is the COPY of the coordinates, not a reference. */\r\n public getParam(i: number): Point2d | undefined { return this.param ? this.param.getPoint2dAtCheckedPointIndex(i) : undefined; }\r\n /** return indexed color */\r\n public getColor(i: number): number { return this.color ? this.color[i] : 0; }\r\n /** return indexed visibility */\r\n public getEdgeVisible(i: number): boolean { return this.edgeVisible[i]; }\r\n /** Copy the contents (not pointer) of point[i] into dest. */\r\n public copyPointTo(i: number, dest: Point3d): void { this.point.getPoint3dAtUncheckedPointIndex(i, dest); }\r\n /** Copy the contents (not pointer) of normal[i] into dest. */\r\n public copyNormalTo(i: number, dest: Vector3d): void { if (this.normal) this.normal.getVector3dAtCheckedVectorIndex(i, dest); }\r\n /** Copy the contents (not pointer) of param[i] into dest. */\r\n public copyParamTo(i: number, dest: Point2d): void { if (this.param) this.param.getPoint2dAtCheckedPointIndex(i, dest); }\r\n /** test if normal at a specified index matches uv */\r\n public isAlmostEqualParamIndexUV(index: number, u: number, v: number): boolean {\r\n if (this.param !== undefined && index >= 0 && index < this.param.length)\r\n return Geometry.isSameCoordinate(u, this.param.getXAtUncheckedPointIndex(index))\r\n && Geometry.isSameCoordinate(v, this.param.getYAtUncheckedPointIndex(index));\r\n return false;\r\n }\r\n /**\r\n * * Copy data from other to this.\r\n * * This is the essence of transferring coordinates spread throughout a large polyface into a visitor's single facet.\r\n * * \"other\" is the large polyface\r\n * * \"this\" is the visitor\r\n * * does NOT copy face data - visitors reference the FacetFaceData array for the whole polyface!!\r\n * @param other polyface data being mined.\r\n * @param index0 start index in other's index arrays\r\n * @param index1 end index (one beyond last data accessed0 in other's index arrays\r\n * @param numWrap number of points to replicate as wraparound.\r\n */\r\n public gatherIndexedData(other: PolyfaceData, index0: number, index1: number, numWrap: number) {\r\n const numEdge = index1 - index0;\r\n const numTotal = numEdge + numWrap;\r\n this.resizeAllDataArrays(numTotal);\r\n // copy wrapped points\r\n for (let i = 0; i < numEdge; i++)\r\n this.point.transferFromGrowableXYZArray(i, other.point, other.pointIndex[index0 + i]);\r\n for (let i = 0; i < numWrap; i++)\r\n this.point.transferFromGrowableXYZArray(numEdge + i, this.point, i);\r\n\r\n // copy wrapped pointIndex\r\n for (let i = 0; i < numEdge; i++)\r\n this.pointIndex[i] = other.pointIndex[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.pointIndex[numEdge + i] = this.pointIndex[i];\r\n // copy wrapped edge visibility\r\n for (let i = 0; i < numEdge; i++)\r\n this.edgeVisible[i] = other.edgeVisible[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.edgeVisible[numEdge + i] = this.edgeVisible[i];\r\n\r\n if (this.normal && this.normalIndex && other.normal && other.normalIndex) {\r\n for (let i = 0; i < numEdge; i++)\r\n this.normal.transferFromGrowableXYZArray(i, other.normal, other.normalIndex[index0 + i]);\r\n for (let i = 0; i < numWrap; i++)\r\n this.normal.transferFromGrowableXYZArray(numEdge + i, this.normal, i);\r\n\r\n for (let i = 0; i < numEdge; i++)\r\n this.normalIndex[i] = other.normalIndex[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.normalIndex[numEdge + i] = this.normalIndex[i];\r\n }\r\n\r\n if (this.param && this.paramIndex && other.param && other.paramIndex) {\r\n for (let i = 0; i < numEdge; i++)\r\n this.param.transferFromGrowableXYArray(i, other.param, other.paramIndex[index0 + i]);\r\n for (let i = 0; i < numWrap; i++)\r\n this.param.transferFromGrowableXYArray(numEdge + i, this.param, i);\r\n\r\n for (let i = 0; i < numEdge; i++)\r\n this.paramIndex[i] = other.paramIndex[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.paramIndex[numEdge + i] = this.paramIndex[i];\r\n }\r\n\r\n if (this.color && this.colorIndex && other.color && other.colorIndex) {\r\n for (let i = 0; i < numEdge; i++)\r\n this.color[i] = other.color[other.colorIndex[index0 + i]];\r\n for (let i = 0; i < numWrap; i++)\r\n this.color[numEdge + i] = this.color[i];\r\n\r\n for (let i = 0; i < numEdge; i++)\r\n this.colorIndex[i] = other.colorIndex[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.colorIndex[numEdge + i] = this.colorIndex[i];\r\n }\r\n if (this.auxData && other.auxData && this.auxData.channels.length === other.auxData.channels.length) {\r\n for (let iChannel = 0; iChannel < this.auxData.channels.length; iChannel++) {\r\n const thisChannel = this.auxData.channels[iChannel];\r\n const otherChannel = other.auxData.channels[iChannel];\r\n const blockSize = thisChannel.entriesPerValue;\r\n if (thisChannel.data.length === otherChannel.data.length) {\r\n for (let iData = 0; iData < thisChannel.data.length; iData++) {\r\n const thisData = thisChannel.data[iData];\r\n const otherData = otherChannel.data[iData];\r\n for (let i = 0; i < numEdge; i++)\r\n thisData.copyValues(otherData, i, other.auxData.indices[index0 + i], blockSize);\r\n for (let i = 0; i < numWrap; i++)\r\n thisData.copyValues(thisData, other.auxData.indices[numEdge + i], i, blockSize);\r\n }\r\n }\r\n }\r\n for (let i = 0; i < numEdge; i++)\r\n this.auxData.indices[i] = other.auxData.indices[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.auxData.indices[numEdge + i] = this.auxData.indices[i];\r\n }\r\n }\r\n private static trimArray(data: any[] | undefined, length: number) { if (data && length < data.length) data.length = length; }\r\n /** Trim all index arrays to stated length.\r\n * * This is called by PolyfaceBuilder to clean up after an aborted construction sequence.\r\n */\r\n public trimAllIndexArrays(length: number): void {\r\n PolyfaceData.trimArray(this.pointIndex, length);\r\n PolyfaceData.trimArray(this.paramIndex, length);\r\n PolyfaceData.trimArray(this.normalIndex, length);\r\n PolyfaceData.trimArray(this.colorIndex, length);\r\n PolyfaceData.trimArray(this.edgeVisible, length);\r\n if (this.auxData) {\r\n PolyfaceData.trimArray(this.auxData.indices, length);\r\n for (const channel of this.auxData.channels) {\r\n for (const data of channel.data)\r\n PolyfaceData.trimArray(data.values, channel.entriesPerValue * length);\r\n }\r\n }\r\n }\r\n /** Resize all data arrays to specified length */\r\n public resizeAllDataArrays(length: number): void {\r\n if (length > this.point.length) {\r\n while (this.point.length < length) this.point.push(Point3d.create());\r\n while (this.pointIndex.length < length) this.pointIndex.push(-1);\r\n while (this.edgeVisible.length < length) this.edgeVisible.push(false);\r\n if (this.normal)\r\n while (this.normal.length < length) this.normal.push(Vector3d.create());\r\n if (this.param)\r\n while (this.param.length < length) this.param.push(Point2d.create());\r\n if (this.color)\r\n while (this.color.length < length) this.color.push(0);\r\n if (this.auxData) {\r\n for (const channel of this.auxData.channels) {\r\n for (const channelData of channel.data) {\r\n while (channelData.values.length < length * channel.entriesPerValue) channelData.values.push(0);\r\n }\r\n }\r\n }\r\n } else if (length < this.point.length) {\r\n this.point.resize(length);\r\n this.edgeVisible.length = length;\r\n this.pointIndex.length = length;\r\n if (this.normal) this.normal.resize(length);\r\n if (this.param) this.param.resize(length);\r\n if (this.color) this.color.length = length;\r\n if (this.auxData) {\r\n for (const channel of this.auxData.channels) {\r\n for (const channelData of channel.data) {\r\n channelData.values.length = length * channel.entriesPerValue;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /** Return the range of the point array (optionally transformed) */\r\n public range(result?: Range3d, transform?: Transform): Range3d {\r\n result = result ? result : Range3d.createNull();\r\n result.extendArray(this.point, transform);\r\n return result;\r\n }\r\n /** reverse indices facet-by-facet, with the given facetStartIndex array delimiting faces.\r\n *\r\n * * facetStartIndex[0] == 0 always -- start of facet zero.\r\n * * facet k has indices from facetStartIndex[k] <= i < facetStartIndex[k+1]\r\n * * hence for \"internal\" k, facetStartIndex[k] is both the upper limit of facet k-1 and the start of facet k.\r\n * *\r\n */\r\n public reverseIndices(facetStartIndex?: number[]) {\r\n if (facetStartIndex && PolyfaceData.isValidFacetStartIndexArray(facetStartIndex)) {\r\n PolyfaceData.reverseIndices(facetStartIndex, this.pointIndex, true);\r\n if (this.normalIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndices(facetStartIndex, this.normalIndex, true);\r\n if (this.paramIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndices(facetStartIndex, this.paramIndex, true);\r\n if (this.colorIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndices(facetStartIndex, this.colorIndex, true);\r\n PolyfaceData.reverseIndices(facetStartIndex, this.edgeVisible, false);\r\n }\r\n }\r\n /** reverse indices facet-by-facet, with the given facetStartIndex array delimiting faces.\r\n *\r\n * * facetStartIndex[0] == 0 always -- start of facet zero.\r\n * * facet k has indices from facetStartIndex[k] <= i < facetStartIndex[k+1]\r\n * * hence for \"internal\" k, facetStartIndex[k] is both the upper limit of facet k-1 and the start of facet k.\r\n * *\r\n */\r\n public reverseIndicesSingleFacet(facetId: number, facetStartIndex: number[]) {\r\n PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.pointIndex, true);\r\n if (this.normalIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.normalIndex, true);\r\n if (this.paramIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.paramIndex, true);\r\n if (this.colorIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.colorIndex, true);\r\n PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.edgeVisible, false);\r\n }\r\n\r\n /** Scale all the normals by -1 */\r\n public reverseNormals() {\r\n if (this.normal)\r\n this.normal.scaleInPlace(-1.0);\r\n }\r\n /** Apply `transform` to point and normal arrays and to auxData.\r\n * * IMPORTANT This base class is just a data carrier. It does not know if the index order and normal directions have special meaning.\r\n * * i.e. caller must separately reverse index order and normal direction if needed.\r\n */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n this.point.multiplyTransformInPlace(transform);\r\n\r\n if (this.normal && !transform.matrix.isIdentity)\r\n this.normal.multiplyAndRenormalizeMatrix3dInverseTransposeInPlace(transform.matrix);\r\n\r\n return undefined === this.auxData || this.auxData.tryTransformInPlace(transform);\r\n }\r\n /**\r\n * Compress the instance by equating duplicate data.\r\n * * Search for duplicates within points, normals, params, and colors.\r\n * * Compress each data array.\r\n * * Revise all indexing for the relocated data.\r\n * @param tolerance optional tolerance for clustering mesh vertices. Default is [[Geometry.smallMetricDistance]].\r\n */\r\n public compress(tolerance: number = Geometry.smallMetricDistance): void {\r\n const packedPoints = ClusterableArray.clusterGrowablePoint3dArray(this.point, tolerance);\r\n this.point = packedPoints.growablePackedPoints!;\r\n packedPoints.updateIndices(this.pointIndex);\r\n\r\n // for now, normals, params, and colors use the default tolerance for clustering...\r\n if (this.normalIndex && this.normal) {\r\n const packedNormals = ClusterableArray.clusterGrowablePoint3dArray(this.normal);\r\n this.normal = packedNormals.growablePackedPoints!;\r\n packedNormals.updateIndices(this.normalIndex);\r\n }\r\n if (this.paramIndex && this.param) {\r\n const packedParams = ClusterableArray.clusterGrowablePoint2dArray(this.param);\r\n this.param = packedParams.growablePackedPoints;\r\n packedParams.updateIndices(this.paramIndex);\r\n }\r\n if (this.colorIndex && this.color) {\r\n const packedColors = ClusterableArray.clusterNumberArray(this.color);\r\n this.color = packedColors.packedNumbers;\r\n packedColors.updateIndices(this.colorIndex);\r\n }\r\n }\r\n\r\n /**\r\n * Test if facetStartIndex is (minimally!) valid:\r\n * * length must be nonzero (recall that for \"no facets\" the facetStartIndexArray still must contain a 0)\r\n * * Each entry must be strictly smaller than the one that follows.\r\n * @param facetStartIndex array of facetStart data. facet `i` has indices at `facetsStartIndex[i]` to (one before) `facetStartIndex[i+1]`\r\n */\r\n public static isValidFacetStartIndexArray(facetStartIndex: number[]): boolean {\r\n // facetStartIndex for empty facets has a single entry \"0\" -- empty array is not allowed\r\n if (facetStartIndex.length === 0)\r\n return false;\r\n for (let i = 0; i + 1 < facetStartIndex.length; i++)\r\n if (facetStartIndex[i] >= facetStartIndex[i + 1])\r\n return false;\r\n return true;\r\n }\r\n /** Reverse data in entire facet indexing arrays.\r\n * * parameterized over type T so non-number data -- e.g. boolean visibility flags -- can be reversed.\r\n */\r\n public static reverseIndices<T>(facetStartIndex: number[], indices: T[] | undefined, preserveStart: boolean): boolean {\r\n if (!indices || indices.length === 0)\r\n return true; // empty case\r\n if (indices.length > 0) {\r\n if (facetStartIndex[facetStartIndex.length - 1] === indices.length) {\r\n for (let i = 0; i + 1 < facetStartIndex.length; i++) {\r\n let index0 = facetStartIndex[i];\r\n let index1 = facetStartIndex[i + 1];\r\n if (preserveStart) {\r\n // leave [index0] as is so reversed facet starts at same vertex\r\n while (index1 > index0 + 2) {\r\n index1--; index0++;\r\n const a = indices[index0];\r\n indices[index0] = indices[index1];\r\n indices[index1] = a;\r\n }\r\n } else {\r\n // reverse all\r\n while (index1 > index0 + 1) {\r\n index1--;\r\n const a = indices[index0];\r\n indices[index0] = indices[index1];\r\n indices[index1] = a;\r\n index0++;\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /** Reverse data in entire facet indexing arrays.\r\n * * parameterized over type T so non-number data -- e.g. boolean visibility flags -- can be reversed.\r\n */\r\n public static reverseIndicesSingleFacet<T>(facetId: number, facetStartIndex: number[], indices: T[] | undefined, preserveStart: boolean): boolean {\r\n if (!indices || indices.length === 0)\r\n return true; // empty case\r\n if (indices.length > 0) {\r\n if (facetStartIndex[facetStartIndex.length - 1] === indices.length\r\n && facetId >= 0 && facetId + 1 < facetStartIndex.length) {\r\n let index0 = facetStartIndex[facetId];\r\n let index1 = facetStartIndex[facetId + 1];\r\n if (preserveStart) {\r\n // leave [index0] as is so reversed facet starts at same vertex\r\n while (index1 > index0 + 2) {\r\n index1--; index0++;\r\n const a = indices[index0];\r\n indices[index0] = indices[index1];\r\n indices[index1] = a;\r\n }\r\n } else {\r\n // reverse all\r\n while (index1 > index0 + 1) {\r\n index1--;\r\n const a = indices[index0];\r\n indices[index0] = indices[index1];\r\n indices[index1] = a;\r\n index0++;\r\n }\r\n }\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\n"]}
@@ -1,186 +1,241 @@
1
1
  import { Plane3dByOriginAndVectors } from "../geometry3d/Plane3dByOriginAndVectors";
2
- /** base class for Newton iterations in various dimensions.
3
- * Dimension-specific classes carry all dimension-related data and answer generalized queries
4
- * from this base class.
2
+ /**
3
+ * Base class for Newton iterations in various dimensions.
4
+ * Dimension-specific classes carry all dimension-related data and answer generalized queries from this base class.
5
5
  * @internal
6
6
  */
7
7
  export declare abstract class AbstractNewtonIterator {
8
- /** Compute a step. The current x and function values must be retained for use in later method calls */
8
+ /** Compute a step. The current x and function values must be retained for use in later method calls. */
9
9
  abstract computeStep(): boolean;
10
- /** return the current step size, scaled for use in tolerance tests.
11
- * * This is a single number, typically the max of various per-dimension `dx / (1+x)` for the x and dx of that dimension.
10
+ /**
11
+ * Return the current step size, scaled for use in tolerance tests.
12
+ * * This is a single number, typically the max of various per-dimension `dx/(1+x)` for the x and dx of that dimension.
12
13
  */
13
14
  abstract currentStepSize(): number;
14
15
  /**
15
- * Apply the current step (in all dimensions)
16
+ * Apply the current step (in all dimensions).
16
17
  * @param isFinalStep true if this is a final step.
17
18
  */
18
19
  abstract applyCurrentStep(isFinalStep: boolean): boolean;
19
20
  /**
21
+ * The constructor.
20
22
  * @param stepSizeTarget tolerance to consider a single step converged.
21
- * This number should be "moderately" strict. Because 2 successive convergences are required,
23
+ * This number should be "moderately" strict. Because 2 successive convergences are required,
22
24
  * it is expected that a first "accept" for (say) 10 to 14 digit step will be followed by another
23
- * iteration. A well behaved newton would then hypothetically double the number of digits to
24
- * 20 to 28. Since the IEEE double only carries 16 digits, this second-convergence step will
25
+ * iteration. A well behaved newton would then hypothetically double the number of digits to
26
+ * 20 to 28. Since the IEEE double only carries 16 digits, this second-convergence step will
25
27
  * typically achieve full precision.
26
28
  * @param successiveConvergenceTarget number of successive convergences required for acceptance.
27
- * @param maxIterations max number of iterations. A typical newton step converges in 3 to 6 iterations.
28
- * Allow 15 to 20 to catch difficult cases.
29
+ * @param maxIterations max number of iterations. A typical newton step converges in 3 to 6 iterations.
30
+ * Allow 15 to 20 to catch difficult cases.
29
31
  */
30
32
  protected constructor(stepSizeTolerance?: number, successiveConvergenceTarget?: number, maxIterations?: number);
31
- /** Number of consecutive steps which passed convergence condition */
33
+ /** Number of consecutive steps which passed convergence condition. */
32
34
  protected _numAccepted: number;
33
- /** Target number of successive convergences */
35
+ /** Target number of successive convergences. */
34
36
  protected _successiveConvergenceTarget: number;
35
- /** convergence target (the implementation-specific currentStepSize is compared to this) */
37
+ /** Convergence target (the implementation-specific currentStepSize is compared to this). */
36
38
  protected _stepSizeTolerance: number;
37
- /** Max iterations allowed */
39
+ /** Max iterations allowed. */
38
40
  protected _maxIterations: number;
39
- /** number of iterations (incremented at each step) */
41
+ /** Number of iterations (incremented at each step). */
40
42
  numIterations: number;
41
43
  /**
42
44
  * Test if a step is converged.
43
- * * Convergence is accepted with enough (_successiveConvergenceTarget) small steps (according to _stepSizeTolerance) occur in succession.
44
- * @param delta step size as reported by currentStepSize
45
+ * * Convergence is accepted with enough (_successiveConvergenceTarget) small steps (according to _stepSizeTolerance)
46
+ * occur in succession.
47
+ * @param delta step size as reported by currentStepSize.
45
48
  */
46
49
  testConvergence(delta: number): boolean;
47
50
  /**
48
51
  * Run iterations, calling various methods from base and derived classes:
49
52
  * * computeStep -- typically evaluate derivatives and solve linear system.
50
- * * currentStepSize -- return numeric measure of the step just computed by computeStep
53
+ * * currentStepSize -- return numeric measure of the step just computed by computeStep.
51
54
  * * testConvergence -- test if the step from currentStepSize (along with recent steps) is converged.
52
- * * applyCurrentStep -- apply the step to the independent variables
55
+ * * applyCurrentStep -- apply the step to the independent variables.
53
56
  */
54
57
  runIterations(): boolean;
55
58
  }
56
- /** object to evaluate a newton function. The object must retain most-recent function and derivative
59
+ /**
60
+ * Object to evaluate a newton function. The object must retain most-recent function and derivative
57
61
  * values for immediate query.
58
62
  * @internal
59
63
  */
60
64
  export declare abstract class NewtonEvaluatorRtoRD {
61
- /** evaluate the function and its derivative at x. */
65
+ /** Evaluate the function and its derivative at x. */
62
66
  abstract evaluate(x: number): boolean;
63
- /** most recent function value */
67
+ /** Most recent function value, i.e., f(x_n). */
64
68
  currentF: number;
65
- /** most recent evaluated derivative */
69
+ /** Most recent evaluated derivative, i.e., f'(x_n). */
66
70
  currentdFdX: number;
67
71
  }
68
72
  /**
69
73
  * Newton iterator for use when both function and derivative can be evaluated.
74
+ * To solve `f(x) = 0`, the Newton iteration is `x_{n+1} = x_n - dx = x_n - f(x_n)/f'(x_n)`.
75
+ * To solve `f(x) = target` which is equivalent to solving `g(x) = f(x) - target = 0`, the Newton iteration is
76
+ * `x_{n+1} = x_n - dx = x_n - g(x_n)/g'(x_n) = x_n - (f(x_n)-target)/f'(x_n)`.
70
77
  * @internal
71
78
  */
72
79
  export declare class Newton1dUnbounded extends AbstractNewtonIterator {
73
80
  private _func;
81
+ /** Current step is dx. */
74
82
  private _currentStep;
83
+ /** Current X is x_n. */
75
84
  private _currentX;
85
+ /** The target */
76
86
  private _target;
77
87
  /**
78
- * Constructor for 1D newton iteration with approximate derivatives.
79
- * @param func function that returns both function and derivative.
88
+ * Constructor for 1D newton iteration with derivatives.
89
+ * @param func function that returns both function value and derivative.
80
90
  */
81
91
  constructor(func: NewtonEvaluatorRtoRD);
82
- /** Set the independent variable */
92
+ /** Set the independent variable, i.e., x_n. */
83
93
  setX(x: number): boolean;
84
- /** Get the independent variable */
94
+ /** Get the independent variable, i.e., x_n. */
85
95
  getX(): number;
86
- /** Set the target function value */
96
+ /** Set the target function value. */
87
97
  setTarget(y: number): void;
88
- /** move the current X by the just-computed step */
98
+ /** Move the current X by the just-computed step, i.e., `x_n - dx`. */
89
99
  applyCurrentStep(): boolean;
90
100
  /** Compute the univariate newton step. */
91
101
  computeStep(): boolean;
92
- /** Return the current step size as a relative number. */
102
+ /** Return the current step size as a relative number, i.e., `|dx / (1 + |x_n|)|`. */
93
103
  currentStepSize(): number;
94
104
  }
95
- /** object to evaluate a newton function (without derivative). The object must retain most-recent function value.
105
+ /**
106
+ * Object to evaluate a newton function (without derivative). The object must retain most-recent function value.
96
107
  * @internal
97
108
  */
98
109
  export declare abstract class NewtonEvaluatorRtoR {
99
110
  /** Evaluate function value into member currentF */
100
111
  abstract evaluate(x: number): boolean;
101
- /** Most recent function evaluation. */
112
+ /** Most recent function evaluation, i.e., f(x_n). */
102
113
  currentF: number;
103
114
  }
104
- /** Newton iteration for a univariate function, using approximate derivatives.
115
+ /**
116
+ * Newton iteration for a univariate function, using approximate derivatives.
117
+ * To approximate the derivatives we use a small step `h`, i.e., `f'(x_n) = (f(x_n + h) - f(x_n)) / h`.
118
+ * Therefore, to solve `f(x) = 0`, the iteration is
119
+ * `x_{n+1} = x_n - dx = x_n - f(x_n)/f'(x_n) = x_n - f(x_n) * h / (f(x_n + h) - f(x_n))`.
105
120
  * @internal
106
121
  */
107
122
  export declare class Newton1dUnboundedApproximateDerivative extends AbstractNewtonIterator {
108
123
  private _func;
124
+ /** Current step is dx. */
109
125
  private _currentStep;
126
+ /** Current X is x_n. */
110
127
  private _currentX;
111
- /** Step size for iteration.
128
+ /**
129
+ * Step size for approximate derivative for the iteration.
112
130
  * * Initialized to 1e-8, which is appropriate for iteration in fraction space.
113
131
  * * Should be larger for iteration with real distance as x.
114
132
  */
115
133
  derivativeH: number;
116
134
  /**
117
135
  * Constructor for 1D newton iteration with approximate derivatives.
118
- * @param func function that returns both function and derivative.
136
+ * @param func function that only returns function value (and not derivative).
119
137
  */
120
138
  constructor(func: NewtonEvaluatorRtoR);
121
- /** Set the x (independent, iterated) value */
139
+ /** Set the independent variable, i.e., x_n. */
122
140
  setX(x: number): boolean;
123
- /** Get the independent variable */
141
+ /** Get the independent variable, i.e., x_n. */
124
142
  getX(): number;
125
- /** move the current X by the just-computed step */
143
+ /** Move the current X by the just-computed step, i.e., `x_n - dx`. */
126
144
  applyCurrentStep(): boolean;
127
- /** Univariate newton step computed with APPROXIMATE derivative. */
145
+ /** Univariate newton step computed with approximate derivative. */
128
146
  computeStep(): boolean;
129
- /** Return the current step size as a relative number. */
147
+ /** Return the current step size as a relative number, i.e., `|dx / (1 + |x_n|)|`. */
130
148
  currentStepSize(): number;
131
149
  }
132
- /** object to evaluate a 2-parameter newton function (with derivatives!!).
150
+ /**
151
+ * Object to evaluate a 2-parameter newton function with derivatives.
133
152
  * @internal
134
153
  */
135
154
  export declare abstract class NewtonEvaluatorRRtoRRD {
136
- /** Iteration controller calls this to ask for evaluation of the function and its two partial derivatives.
155
+ /**
156
+ * Iteration controller calls this to ask for evaluation of the function and its two partial derivatives.
137
157
  * * The implementation returns true, it must set the currentF object.
138
158
  */
139
159
  abstract evaluate(x: number, y: number): boolean;
140
- /** most recent function evaluation as xy parts of the plane */
160
+ /**
161
+ * Most recent function evaluation as parts of the plane.
162
+ * * See doc of [[Newton2dUnboundedWithDerivative]] class for info on 2d newton method.
163
+ * * For current value (u,v) of the independent variable, and `F(u,v) := (x(u,v), y(u,v)), the returned plane has:
164
+ * * `origin.x` = x(u,v)
165
+ * * `origin.y` = y(u,v)
166
+ * * `vectorU.x` = dx/du
167
+ * * `vectorU.y` = dy/du
168
+ * * `vectorV.x` = dx/dv
169
+ * * `vectorV.y` = dy/dv
170
+ * * In other words, the plane stores the columns of the Jacobian matrix J of F: `vectorU` stores the partials
171
+ * of F with respect to u (the first column of J), and `vectorV` stores the partials of F with respect to v
172
+ * (the second column of J):
173
+ *
174
+ * `[vectorU.x vectorV.x]`
175
+ *
176
+ * `[vectorU.y vectorV.y]`
177
+ */
141
178
  currentF: Plane3dByOriginAndVectors;
142
179
  /**
143
- * constructor.
180
+ * Constructor.
144
181
  * * This creates a currentF object to (repeatedly) receive function and derivatives.
145
182
  */
146
183
  constructor();
147
184
  }
148
185
  /**
149
186
  * Implement evaluation steps for newton iteration in 2 dimensions, using caller supplied NewtonEvaluatorRRtoRRD object.
187
+ * * Suppose we want to find the roots of `F(u,v) := (x(u,v), y(u,v))`. Writing `X := (u,v)` and `F(X)` as column vectors,
188
+ * the 2D Newton's iteration to find a root of `F` is given by:
189
+ * `X_{n+1} = X_n - dX = X_n - JInv(X_n)F(X_n)`, where `JInv` is the inverse of the Jacobian matrix `J`, and `J` is
190
+ * defined as:
191
+ *
192
+ * `[dx/du dx/dv]`
193
+ *
194
+ * `[dy/du dy/dv]`
150
195
  * @internal
151
196
  */
152
197
  export declare class Newton2dUnboundedWithDerivative extends AbstractNewtonIterator {
153
198
  private _func;
199
+ /** Current step, or dX = (du, dv). */
154
200
  private _currentStep;
201
+ /** Current uv parameters, or X_n = (u_n, v_n). */
155
202
  private _currentUV;
203
+ /**
204
+ * Constructor for 2D newton iteration with derivatives.
205
+ * @param func function that returns both function value and derivative.
206
+ */
156
207
  constructor(func: NewtonEvaluatorRRtoRRD);
157
- /** Set the current uv coordinates for current iteration */
158
- setUV(x: number, y: number): boolean;
159
- /** Get the current u coordinate */
208
+ /** Set the current uv parameters, i.e., `X_n = (u_n, v_n)`. */
209
+ setUV(u: number, v: number): boolean;
210
+ /** Get the current u parameter of X_n, i.e., u_n. */
160
211
  getU(): number;
161
- /** Get the current v coordinate */
212
+ /** Get the current v parameter of X_n, i.e., v_n. */
162
213
  getV(): number;
163
- /** Move the currentUV coordinate by currentStep. */
214
+ /** Update the current uv parameter by currentStep, i.e., compute `X_{n+1} := X_n - dX = (u_n - du, v_n - dv)`. */
164
215
  applyCurrentStep(): boolean;
165
- /** Evaluate the functions and derivatives at this._currentUV
166
- * Invert the jacobian and compute the this._currentStep.
216
+ /**
217
+ * Evaluate the functions and derivatives at `X_n = (u_n, v_n)`, and solve the Jacobian matrix equation to
218
+ * compute `dX = (du, dv)`.
167
219
  */
168
220
  computeStep(): boolean;
169
221
  /**
170
- * Return the largest relative step of the x,y, components of the current step.
222
+ * Return the current relative step size, i.e., the larger absolute component of `dX / (1 + |X_n|)`
171
223
  */
172
224
  currentStepSize(): number;
173
225
  }
174
226
  /**
175
- * SimpleNewton has static methods for newton methods with evaluated functions presented as immediate arguments (not function object)
227
+ * SimpleNewton has static methods for newton methods with evaluated functions presented as immediate arguments
228
+ * (not function object).
176
229
  * @internal
177
230
  */
178
231
  export declare class SimpleNewton {
179
- /** Run a one-dimensional newton iteration with separate functions for function and derivative.
180
- * * completion is at 2 (TWO) successive passes at (absoluteTolerance + relTol * abs (x)), where relTol is chosen internally.
181
- * * absoluteTolerance is usually aggressively tight -- should come into play only for x near zero.
182
- * * The relTol is fluffy (for instance around 1e-11) but in properly converging cases the extra pass after first success
183
- * normally moves to full machine precision.
232
+ /**
233
+ * Run a one-dimensional newton iteration with separate functions for function and derivative.
234
+ * * Completion is at 2 (TWO) successive passes at `absoluteTolerance + relTol * abs(x)`, where relTol is
235
+ * chosen internally.
236
+ * * `absoluteTolerance` is usually aggressively tight -- should come into play only for x near zero.
237
+ * * The `relTol` is fluffy (for instance around 1e-11) but in properly converging cases the extra pass after
238
+ * first success normally moves to full machine precision.
184
239
  * * This is an open-loop newton -- it just runs, and returns undefined if anything bad happens.
185
240
  */
186
241
  static runNewton1D(x: number, func: (x: number) => number | undefined, derivative: (x: number) => number | undefined, absoluteTolerance?: number): number | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"Newton.d.ts","sourceRoot":"","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