import { ConwayGeometry, GeometryObject, ParamsAxis2Placement3D, Vector3, CurveObject, ParamsGetIfcTrimmedCurve, SurfaceObject, StdVector, ParamsAxis1Placement3D, BSplineSurface, TrimmingArguments, NativeTransform3x3, NativeTransform4x4, FlattenedPointsResult } from "../../dependencies/conway-geom/index.js"; import { ColorRGBA } from "../core/canonical_material.js"; import { CanonicalProfile } from "../core/canonical_profile.js"; import { CsgMemoization } from "../core/csg_operations.js"; import { NativeULongVector, NativeUintVector, NativeVectorBound3D, NativeVectorGeometryCollection, NativeVectorGlmVec2, NativeVectorGlmVec3, NativeVectorIndexedPolygonalFace, NativeVectorProfile, NativeVectorSegment, WasmModule } from "../core/native_types.js"; import { ExtractResult } from "../core/shared_constants.js"; import { advanced_face, axis1_placement, axis2_placement_2d, axis2_placement_3d, b_spline_curve, b_spline_curve_with_knots, b_spline_surface, boolean_result, cartesian_point, cartesian_transformation_operator_2d, cartesian_transformation_operator_3d, circle, colour_rgb, composite_curve, conical_surface, connected_face_set, curve, cylindrical_surface, direction, ellipse, extruded_area_solid, face, face_based_surface_model, faceted_brep, half_space_solid, length_unit, line, manifold_solid_brep, mapped_item, pcurve, placement, plane, polyline, ratio_measure, rational_b_spline_curve, representation_item, shell_based_surface_model, si_prefix, spherical_surface, styled_item, surface, surface_of_linear_extrusion, surface_of_revolution, surface_style_usage, toroidal_surface, trimmed_curve } from "./AP214E3_2010_gen/index.js"; import { AP214MaterialCache } from "./ap214_material_cache.js"; import AP214ModelCurves from "./ap214_model_curves.js"; import { AP214ProductShapeMap } from "./ap214_product_shape_map.js"; import { AP214SceneBuilder, AP214SceneTransform } from "./ap214_scene_builder.js"; import AP214StepModel from "./ap214_step_model.js"; /** * Extract an AP214 Colour into our RGBA color, using premultiplied alpha. * * Transparency is usually handled via pre-multiplied alpha, and this is what * gltf (for example) expects. * * @param from The color to extract. * @param alpha The alpha value to be associated with the colour. * @return {ColorRGBA} The created colour. */ export declare function extractColorRGBPremultiplied(from: colour_rgb, alpha?: number): ColorRGBA; /** * Extract an AP214 Colour into our RGBA color. * * @param from The color to extract. * @param alpha The alpha value to be associated with the colour. * @return {ColorRGBA} The created colour. */ export declare function extractColorRGB(from: colour_rgb, alpha?: number): ColorRGBA; /** * Use to extract a color or a factor from a color/factor select. * * @param from The color or factor to extract this from. * @param surfaceColor The surface color (if this is a factor), which will be used to * create the factor. * @param alpha The alpha to use for this. * @return {ColorRGBA} */ export declare function extractColorOrFactor(from: colour_rgb | ratio_measure, surfaceColor: ColorRGBA, alpha?: number): ColorRGBA; /** * Handles Geometry data extraction from a populated AP214StepModel * Can export to OBJ, GLTF (Draco), GLB (Draco) */ export declare class AP214GeometryExtraction { private readonly conwayModel; readonly model: AP214StepModel; private readonly limitCSGDepth; private readonly csgDepthLimit; private readonly lowMemoryMode; private readonly TWO_DIMENSIONS; private readonly THREE_DIMENSIONS; private wasmModule; readonly scene: AP214SceneBuilder; readonly materials: AP214MaterialCache; readonly productShapeMap: AP214ProductShapeMap; private linearScalingFactor; private circleSegments; private paramsGetBooleanResultPool; private paramsTransformProfilePool; private paramsGetTriangulatedFaceSetPool; private paramsGetPolyCurvePool; pointBuffer: FlattenedPointsResult | null; private identity2DNativeMatrix; private identity3DNativeMatrix; private csgMemoization; private csgDepth; readonly curves: AP214ModelCurves; readonly csgOperations: CsgMemoization; /** * Construct a geometry extraction from an AP214 step model and conway model * * @param conwayModel * @param model * @param limitCSGDepth Whether to limit the depth of CSG operations. * @param csgDepthLimit The maximum depth for CSG operations when limit CSG depth is used, * or the maximum level for CSG memoization if it is not. * @param lowMemoryMode Whether to enable low memory mode for geometry extraction. */ constructor(conwayModel: ConwayGeometry, model: AP214StepModel, limitCSGDepth?: boolean, csgDepthLimit?: number, lowMemoryMode?: boolean); /** * Get the product name for this. * * @return {string} The product name or an empty struct if none can be found. */ getAP214ProductName(): string; /** * Initializes memory pools for various parameter objects. */ initializeMemoryPools(): void; /** * Creates a memory pool for `ParamsGetPolyCurve` objects if it does not exist. */ createParamsGetPolyCurvePool(): void; /** * Creates a memory pool for `ParamsGetTriangulatedFaceSet` objects if it does not exist. */ createParamsGetTriangulatedFaceSetPool(): void; /** * Creates a memory pool for `ParamsTransformProfile` objects if it does not exist. */ createParamsTransformProfilePool(): void; /** * Creates a memory pool for `ParamsGetBooleanResult` objects if it does not exist. */ createParamsGetBooleanResultPool(): void; /** * * @return {number} linear matrix scaling factor for geometry */ getLinearScalingFactor(): number; /** * * @return {WasmModule} - A handle to the loaded wasm module */ getWasmModule(): WasmModule; /** * * @param initialSize number - initial size of the vector (optional) * @return {StdVector} - a native std::vector from the wasm module */ nativeVectorGeometry(initialSize?: number): StdVector; /** * Create a native vector of geometry collections. * * @return {NativeVectorGeometryCollection} A newly initialised native * vector of geometry collections */ nativeVectorGeometryCollection(): NativeVectorGeometryCollection; /** * * @param initialSize number - initial size of the vector (optional) * @return {NativeVectorGlmVec2} - a native std::vector from the wasm module */ nativeVectorGlmVec2(initialSize?: number): NativeVectorGlmVec2; /** * Create a native vector profile to pass across the boundary. * * @param initialSize number - initial size of the vector (optional) * @return {NativeVectorProfile} - a native std::vector from the wasm module */ nativeVectorProfile(initialSize?: number): NativeVectorProfile; nativeCurve(): CurveObject; /** * Create a native version of a vector curve to parse across the boundary. * * @param initialSize number - initial size of the vector (optional) * @return {NativeVectorCurve} - a native std::vector from the wasm module */ nativeVectorCurve(initialSize?: number): StdVector; /** * * @param initialSize number - initial size of the vector (optional) * @return {NativeVectorGlmVec3} - a native std::vector from the wasm module */ nativeVectorGlmVec3(initialSize?: number): NativeVectorGlmVec3; /** * * @return {NativeVectorGlmVec3} - a native std::vector from the wasm module */ nativeVectorVectorGlmdVec3(): StdVector; /** * * @param initialSize number - initial size of the vector (optional) * @return {NativeVectorGlmVec3} - a native std::vector from the wasm module */ nativeVectorGlmdVec3(initialSize?: number): NativeVectorGlmVec3; /** * * @param initialSize number - initial size of the vector (optional) * @return {NativeVectorGlmVec3} - a native std::vector from the wasm module */ nativeVectorGlmdVec2(initialSize?: number): NativeVectorGlmVec2; /** * Create a native 32bit uint vector. * * @param initialSize number - initial size of the vector (optional) * @return {NativeUintVector} - a native std::vector from the wasm module */ nativeUintVector(initialSize?: number): NativeUintVector; /** * Create a native 32bit size_t vector. * * @param initialSize number - initial size of the vector (optional) * @return {NativeULongVector} - a native std::vector from the wasm module */ nativeULongVector(initialSize?: number): NativeULongVector; private readonly freeVectorPolygonalFaces_; /** * Drop and delete all the indexed polygonal face vectors. */ dropAllNativeIndexedPolygonalFaceVector(): void; /** * Free the native indexed polygon face. * * @param nativeVectorIndexedPolygonalFace The native item to free. */ freeNativeIndexedPolygonalFaceVector(nativeVectorIndexedPolygonalFace: NativeVectorIndexedPolygonalFace): void; /** * Create a native vector of indexed polygonal faces uint vector. * * @param initialSize number - initial size of the vector (optional) * @return {NativeVectorIndexedPolygonalFace} - a native object from the wasm module */ nativeIndexedPolygonalFaceVector(initialSize?: number): NativeVectorIndexedPolygonalFace; /** * Create a native vector of segments. * * @param initialize number - initial size of the vector (optional) * @return {NativeVectorSegment} - a native object from the wasm module */ nativeSegmentVector(initialize?: number): NativeVectorSegment; /** * * @param initialize * @return {NativeVectorBound3D} */ nativeBound3DVector(initialize?: number): NativeVectorBound3D; /** * Has the wasm module been initialised? * * @return {boolean} indicating if the wasm module has been initialized */ isInitialized(): boolean; /** * Destroy geometry processor and deinitialize * * @param modelId */ destroy(modelId?: number): void; /** * * @param arr - a 2D number array * @return {number} - total length of all 2D array elements */ private getTotalLength; /** * * @param indices * @return {NativeUintVector} */ private createAndPopulateNativeIndices; /** * Create and populate a list of native profiles from an array of canonical profiles. * * @param profiles The profiles to convert to native profiles. * @return {NativeVectorProfile} The populated native profiles. */ private createAndPopulateNativeProfiles; /** * @param array * @return {number} Pointer/memory address */ arrayToWasmHeap(array: Float32Array | Uint32Array): any; /** * @param array * @return {Uint8Array} */ arrayToSharedHeap(array: Float32Array | Uint32Array): Uint8Array; /** * Extract a 3D direction vector from an AP214 direction. * * @param from The AP214 direction to extract the vector from. * @return {Vector3 | undefined} The vector, or undefined if it can't be extracted. */ static extractDirection(from: direction | null): Vector3 | undefined; /** * Extract an AP214 3D cartesian transform operator as a transform matrix. * * @param from The AP214 cartesian transform to extract from. * @return {any} The internal matrix type extract. */ extractCartesianTransformOperator3D(from: cartesian_transformation_operator_3d): any; /** * Drop geometry that isn't in the scene. * * @param localID The id of the mesh to drop. */ dropNonSceneGeometry(localID: number): void; /** * Accepts AP214BooleanResult and AP214BooleanClippingResult * * @param from */ extractBooleanResult(from: boolean_result): void; /** * Extract a boolean operand from a boolean result. * * @param from The operand to extract. * @return {void} */ extractBooleanOperand(from: extruded_area_solid | boolean_result | half_space_solid | faceted_brep): void; /** * Extract a canonical material from a surface style. * * @param from The surface style to extract a material from. */ extractSurfaceStyle(from: surface_style_usage): void; /** * @param from The styled item to extract from * @param representationItem * @return surafceStyleId or undefined if could not be determined */ extractStyledItem(from: styled_item, representationItem?: representation_item): number | undefined; extractStyledItemWithProcessing(from: styled_item, owningElementLocalID?: number): void; /** * @param from Geometry source * @param temporary Is the extracted mesh temporary */ extractHalfspaceSolid(from: half_space_solid, temporary?: boolean): void; /** * * @param from Geometry source * @param temporary Is this temporary */ /** * @param from Geometry source * @param temporary Is this extracted mesh temporary */ extractExtrudedAreaSolid(from: extruded_area_solid, temporary?: boolean): void; /** * Extract a canonical profile from a profile definition. * * @param from The profile definition to extract from. * @return {CanonicalProfile | undefined} The extracted profile, * or undefined if one cannot be extracted. */ extractProfile(from: curve): CanonicalProfile | undefined; /** * * @param from * @param parentSense * @param isEdge * @param trimmingArguments * @return {CurveObject | undefined} */ extractCurve(from: curve | trimmed_curve | polyline | circle | b_spline_curve | b_spline_curve_with_knots | rational_b_spline_curve | line, parentSense?: boolean, isEdge?: boolean, trimmingArguments?: TrimmingArguments | undefined): CurveObject | undefined; /** * * @param from * @param parentSense * @param close * @return {CurveObject | undefined} */ extractCompositeCurve(from: composite_curve, parentSense?: boolean, close?: boolean): CurveObject | undefined; /** * * @param from * @return {CurveObject | undefined} */ extractPScurve1(from: pcurve): CurveObject | undefined; /** * Extract a line * * @param from The line to extract. * @param trimmingArguments * @param parentSense * @param isEdge * @param parametersTrimmedCurve * @return {CurveObject | undefined} The curve object for the line. */ extractLine(from: line, parentSense?: boolean, isEdge?: boolean, parametersTrimmedCurve?: ParamsGetIfcTrimmedCurve): CurveObject | undefined; /** * Exctact a BSpline Curve * * @param from The bspline curve, potentially with knots/rational. * @param parentSense * @param isEdge * @param parametersTrimmedCurve * @return {CurveObject} The constructed curve object. */ extractBSplineCurve(from: b_spline_curve, parentSense?: boolean, isEdge?: boolean, parametersTrimmedCurve?: ParamsGetIfcTrimmedCurve): CurveObject; /** * * @param from * @param isEdge * @param parentSense * @param parametersTrimmedCurve * @return {CurveObject | undefined} */ extractAP214Circle(from: circle, isEdge?: boolean, parentSense?: boolean, parametersTrimmedCurve?: ParamsGetIfcTrimmedCurve): CurveObject | undefined; /** * * @param from * @param isEdge * @param parentSense * @param parametersTrimmedCurve * @return {CurveObject | undefined} */ extractAP214Ellipse(from: ellipse, isEdge?: boolean, parentSense?: boolean, parametersTrimmedCurve?: ParamsGetIfcTrimmedCurve): CurveObject | undefined; /** * * @param from * @param parentSense * @param isEdge * @return {CurveObject | undefined} */ extractAP214TrimmedCurve(from: trimmed_curve, parentSense?: boolean, isEdge?: boolean): CurveObject | undefined; /** * Efficiently flatten the points into a Float32Array * * @param points - Array of AP214CartesianPoint * @param dimensions - dimensions of points * @return {Float32Array} */ flattenPointsToFloat32Array(points: cartesian_point[], dimensions: number): Float32Array; /** * * @param from * @param parentSense * @param isEdge * @return {CurveObject | undefined } */ extractPolyline(from: polyline, parentSense?: boolean, isEdge?: boolean): CurveObject | undefined; /** * Extracts the curve for an ellipse from an AP214 ellipse profile definition. * * @param from The AP214 ellipse profile definition to extract the curve from. * @return {CurveObject} A CurveObject representing the ellipse curve, * or undefined if not extractable. */ extractEllipseProfileCurve(from: ellipse): CurveObject | undefined; /** * Extract a mapped item to add its transform to instance an item. * * @param from The mapped item to extract. * @param owningElementLocalID * @param parents The parent mapped items, if any. */ extractMappedItem(from: mapped_item, owningElementLocalID?: number, parents?: mapped_item[] | undefined): void; /** * Extract a representation item, including its geometry if necessary, * adding it to the current scene walk. * * Note - memoized result for instancing. * * @param from The representation to extract from. * @param owningElementLocalID * @param isMappedItem Whether this is a mapped item. */ extractRepresentationItem(from: representation_item, owningElementLocalID?: number, isMappedItem?: boolean): void; /** * Extract geometry from a manifold solid brep. * * @param from The brep to extract from. */ extractManifoldSolidBrep(from: manifold_solid_brep): void; /** * * @param from array of AP214ConnectedFaceSet * @param parentLocalID parent element local ID */ extractConnectedFaceSets(from: connected_face_set[], parentLocalID: number): void; /** * * @param from */ extractAP214FaceBasedSurfaceModel(from: face_based_surface_model): void; /** * * @param from * @param temporary */ extractAP214FacetedBrep(from: faceted_brep, temporary?: boolean): void; /** * * @param from * @param owningElementLocalID */ extractAP214ShellBasedSurfaceModel(from: shell_based_surface_model): void; /** * * @param from * @param parentLocalID * @param geometry_ * @param temporary * @return {GeometryObject} */ extractFaces(from: face[], parentLocalID: number, geometry_?: GeometryObject | undefined, temporary?: boolean): GeometryObject; /** * Extract an AP214 plane. * * @param from The plane to extract from * @return {NativeTransform4x4} The transform matching the plane. */ extractPlane(from: plane): NativeTransform4x4; /** * Extract a pointlist to a native vector. * * @param from * @return {StdVector< Vector3 >} The native vector of 3D vectors. */ extractPointList3D(from: Array): StdVector; /** * Extract a list of a list of points to a native object. * * @param from the list of lists of cartesian points * @param to {out} the native vector of vector of points. * @return {void} */ extractPointListList3D(from: Array>, to: StdVector>): void; /** * Extract a bspline surface * * @param from The bspline surface to extract * @param to The surface to extract to * @param start * @param end */ extractToDoubleVector(from: Array, to: StdVector, start?: number, end?: number): void; /** * Extract a bspline surface * * @param from The bspline surface to extract * @param to The surface to extract to */ extractToDoubleVectorVector(from: Array>, to: StdVector>): void; /** * Extract a bspline surface * * @param from The bspline surface to extract * @return {BSplineSurface} The extracted surface */ extractBSplineSurface(from: b_spline_surface): BSplineSurface; /** * Checks if a given point is not present in a collection of points. * * @param pt The point to check for presence. * @param points A collection of points to compare against. * @return {boolean} A boolean indicating whether the point * is not present in the collection. */ notPresent(pt: Vector3, points: NativeVectorGlmVec3): boolean; /** * Extract an advanced (NURBS) b-rep face. * * @param from * @param geometry * @param parentLocalID */ extractAdvancedFace(from: advanced_face, geometry: GeometryObject, parentLocalID?: number): void; /** * Extract a surface * * @param from * @param nativeSurface */ extractSurface(from: surface, nativeSurface: SurfaceObject): void; /** * Extract a linear extrusion/sweep surface * * @param from * @param nativeSurface */ extractSurfaceOfLinearExtrusion(from: surface_of_linear_extrusion, nativeSurface: SurfaceObject): void; /** * Extract a surface of revolution/rotational sweep surface * * @param from * @param nativeSurface */ extractSurfaceOfRevolution(from: surface_of_revolution, nativeSurface: SurfaceObject): void; /** * Extract a cylindrical surface. * * @param from The AP214 object to extract from. * @param nativeSurface The native surface representation. */ extractCylindricalSurface(from: cylindrical_surface, nativeSurface: SurfaceObject): void; /** * Extract a cylindrical surface. * * @param from The AP214 object to extract from. * @param nativeSurface The native surface representation. */ extractSphericalSurface(from: spherical_surface, nativeSurface: SurfaceObject): void; /** * Extract a cylindrical surface. * * @param from The AP214 object to extract from. * @param nativeSurface The native surface representation. */ extractConicalSurface(from: conical_surface, nativeSurface: SurfaceObject): void; /** * Extract a cylindrical surface. * * @param from The AP214 object to extract from. * @param nativeSurface The native surface representation. */ extractToroidalSurface(from: toroidal_surface, nativeSurface: SurfaceObject): void; /** * Flatten the points into WASM memory (skipping consecutive duplicates). * Reuses an existing WASM buffer if provided and large enough. * * @param points - Array of IfcCartesianPoint * @param dimensions - Number of coordinates per point (e.g. 3 for x,y,z) * @param existingPtr - (Optional) Pointer to an existing WASM buffer * @param existingCapacity - (Optional) Capacity of that buffer in Float64 elements * @return {FlattenedPointsResult} pointer, length used, total capacity */ flattenCartesianPointsToWasmFiltered(points: cartesian_point[], dimensions: number, existingPtr?: number, existingCapacity?: number): FlattenedPointsResult; /** * * @param from * @param geometry */ extractFace(from: face, geometry: GeometryObject): void; /** * Extract an axis placement 2D native object. * * @param from The axis 2 placement to extract. * @return {any} The native placement transform. */ extractAxis2Placement2D(from: axis2_placement_2d): NativeTransform3x3; /** * Extracts a 2D Cartesian transformation operator from an AP214 Cartesian * transformation operator definition. The transformation can be uniform or non-uniform. * * @param from The AP214 Cartesian transformation operator definition, * which can be either uniform or non-uniform. * @return {any} The resulting transformation operator parameters. */ extractCartesianTransformOperator2D(from: cartesian_transformation_operator_2d): NativeTransform3x3; /** * Extract a placement, adding it to the scene. * * @param from The transform to extract. * @param parentLocalId The parent's local ID. * @return {void} */ extractAxis1Placement3D(from: axis1_placement, parentLocalId: number): void; /** * Extract a placement (no memoization/scene creation) * * @param from The transform to extract. * @param parentLocalId The parent's local ID. * @param extractOnly {true} Only extract, don't memoize and add to the scene * @return {ParamsAxis1Placement3D} The extracted placement. */ extractAxis1Placement3D(from: axis1_placement, parentLocalId: number, extractOnly: true): ParamsAxis1Placement3D; /** * Extract a placement, adding it to the scene. * * @param from The transform to extract. * @param parentLocalId The parent's local ID. * @return {void} */ extractAxis2Placement3D(from: axis2_placement_3d, parentLocalId: number, extractOnly: false, mappedItem?: boolean): AP214SceneTransform; /** * Extract a placement (no memoization/scene creation) * * @param from The transform to extract. * @param parentLocalId The parent's local ID. * @param extractOnly {true} Only extract, don't memoize and add to the scene * @return {ParamsAxis2Placement3D} The extracted placement. */ extractAxis2Placement3D(from: axis2_placement_3d, parentLocalId: number, extractOnly: true, mappedItem?: boolean): ParamsAxis2Placement3D; /** * * @param from * @param mappedItem */ extractPlacement(from: placement, mappedItem?: boolean): AP214SceneTransform | undefined; extractRawPlacement(from: placement): NativeTransform4x4 | undefined; /** * */ populateStyledItemsMap(): void; /** * * @param prefix * @return {number | null} */ convertPrefix(prefix?: si_prefix | null): number; convertToMetres(fromUnit: length_unit): number | undefined; lengthUnitConversionRatio(fromUnit: length_unit, toUnit: length_unit): number | undefined; /** * Extract the geometry data from the AP214 * * @param logTime boolean - print execution time (default no) * @return {[ExtractResult, AP214SceneBuilder]} - Enum indicating extraction result * + Geometry array */ extractAP214GeometryData(logTime?: boolean): [ ExtractResult, AP214SceneBuilder, AP214ProductShapeMap ]; } //# sourceMappingURL=ap214_geometry_extraction.d.ts.map