import * as THREE from 'three'; import { ScgClassType } from '@buerli.io/classcad'; import { DrawingID, ScgObject, ObjectID, ScgArrayMem } from '@buerli.io/core'; /** * Checks if the currently active plugin is CC_Sketch. * * @param drawingId The drawing id. * @returns True if CC_Sketch is active, false otherwise. */ export declare const isSketchActive: (drawingId: DrawingID) => boolean; /** * Calculates the tangent vector of a CC_Line / CC_Arc / CC_Circle at the specified point. * * @param drawingId The drawing id. * @param curveId Id of a CC_Line / CC_Arc / CC_Circle. * @param point Point at which the tangent touches a curve. * @returns Tangent vector value. */ export declare const calculateTangent: (drawingId: DrawingID, curveId: ObjectID, point: THREE.Vector3) => THREE.Vector3 | undefined; /** * Checks if the object represents a sketch geometry. * * @param arg A structure object or CCClass of a structure object. * @returns True if the object represents a sketch geometry, false otherwise. */ export declare const isSketchGeometry: (arg: ScgObject | ScgClassType) => boolean; /** * Checks if the object represents a 2d constraint. * * @param arg A structure object or CCClass of a structure object. * @returns True if the object represents a 2d constraint, false otherwise. */ export declare const is2DConstraint: (arg: ScgObject | ScgClassType) => boolean; /** * Checks if the object represents a sketch geometry or 2d constraint or a sketch itself. * * @param arg A structure object or CCClass of a structure object. * @returns True if the object represents a sketch or a sketch geometry or a 2d constraint, false otherwise. */ export declare const isSketchObj: (arg: ScgObject | ScgClassType) => boolean; /** * Checks if the object represents a sketch region. * * @param arg A structure object or CCClass of a structure object. * @returns True if the object represents a sketch region, false otherwise. */ export declare const isSketchRegion: (arg: ScgObject | ScgClassType) => boolean; /** * Searches for the sketch which nests the specified object. * * @param drawingId The drawing id. * @param objId Id of an object which (supposedly) is nested within some sketch. * @returns Id of the sketch which nests the specified object, or -1 if it wasn't found. */ export declare const getSketchId: (drawingId: DrawingID, objId: ObjectID | undefined) => number; /** * Takes ids of 2 CC_Points and if they belong to the same line, returns the id of that line; otherwise, returns ids of these points. * * @param drawingId The drawing id. * @param id1 Id of the first CC_Point. * @param id2 Id of the seconds CC_Point. * @returns An array with a single id of the CC_Line if both points belong to the same one, or an array [id1, id2] otherwise. */ export declare const rollUpPoints: (drawingId: DrawingID, id1: ObjectID, id2: ObjectID) => number[]; /** * Looks up for entities of a 2d constraint / sketch region. * * @param drawingId The drawing id. * @param objectId Id of a 2d constraint / sketch region. * @returns Ids of geometry entities linked to the specified 2d constraint / sketch region. */ export declare const getEntities: (drawingId: DrawingID, objectId: ObjectID) => number[]; /** * Defines a numeric priority of sketch objects and regions, which may be used for sorting them or as a polygon offset for rendering. * * @param arg A structure object or CCClass of a structure object. * @returns A number value (1-5) which represents the sketch object's priority, or -1 if arg is not a sketch object. */ export declare const getSketchPriority: (arg: ScgObject | ScgClassType) => 1 | 2 | 4 | 3 | -1 | 5; /** * Projects a point onto the specified sketch geometry. * * @param drawingId The drawing id. * @param geometryId Id of a sketch geometry. * @param point A point to be projected. * @returns A projected point. */ export declare const projectPointOnGeometry: (drawingId: DrawingID, geometryId: ObjectID, point: THREE.Vector3) => THREE.Vector3; /** * Calculates an object's center point. * * @param drawingId The drawing id. * @param geometryId Id of a sketch geometry. * @returns A center point of specified sketch geometry. */ export declare const getObjCenterPoint: (drawingId: DrawingID, geometryId: ObjectID) => THREE.Vector3; /** * Calculates arc midpoint, radius, startAngle, endAngle and bulge values. * * @param start Start point of an arc. * @param end End point of an arc. * @param center Center point of an arc. * @param clockwise True if the direction from start to end is clockwise, false otherwise. * @returns An object with center, mid, radius, startAngle, endAngle and bulge values. */ export declare const getArcInfo: (start: THREE.Vector3, end: THREE.Vector3, center: THREE.Vector3, clockwise: boolean) => { center: THREE.Vector3; mid: THREE.Vector3; radius: number; startAngle: number; endAngle: number; bulge: number; }; /** * Finds the sector (indexed 0-3) to which the dimPos belongs to. Sectors are divided by dir0 and dir1 vectors and their negations. * * @param dimPos A point * @param dir0 The first direction. * @param dir1 The second direction. * @param center A center point of the arc. * @returns A sector index (0-3) to which the dimPos belongs to. */ export declare const getArcSector: (dimPos: THREE.Vector3, dir0: THREE.Vector3, dir1: THREE.Vector3, center: THREE.Vector3) => 0 | 1 | 2 | 3; /** * Calculates the angle between dir0 and dir1 or their negations depending on sector and reflex values. * * @param dir0 The first direction. * @param dir1 The second direction. * @param sector The sector index (0-3). * @param reflex A flag for changing angle coverage from the current sector to the opposite 3. * @returns The resulting angle between dir0 and dir1. */ export declare const getArcPreviewValue: (dir0: THREE.Vector3, dir1: THREE.Vector3, sector: number, reflex: number) => number; /** * Looks up for sketch's bounds values. * * @param boundsMember The sketch.boundingBox member. * @returns An object containing the center, radius and box values. */ export declare const getSketchBounds: (boundsMember: ScgArrayMem) => { center: THREE.Vector3; radius: number; box: THREE.Box3; }; /** * Calculates the global bounding box, camera position, camera target and camera up vector to fit the camera for the given sketch. * * @param drawingId The drawing id. * @param sketchId Id of the sketch. * @param radiusMultiplier A multiplier for the distance between camera and sketch. * @returns An object with globBox, position, target and up values. */ export declare const getSketchFitInfo: (drawingId: DrawingID, sketchId: ObjectID, radiusMultiplier?: number) => { globBox: THREE.Box3; position: THREE.Vector3; target: THREE.Vector3; up: THREE.Vector3; } | undefined; /** * Calculates the global bounding box, camera position, camera target and camera up vector for the given sketch to target some point with camera oriented orthogonally to it. * * @param drawingId The drawing id. * @param sketchId Id of the sketch. * @param targetPos A point near the sketch plane to use as the camera target. * @param distance The distance value to set between camera and sketch. * @returns An object with globBox, position, target and up values. */ export declare const getSketchNormalViewInfo: (drawingId: DrawingID, sketchId: ObjectID, targetPos: THREE.Vector3, distance: number) => { globBox: THREE.Box3; position: THREE.Vector3; target: THREE.Vector3; up: THREE.Vector3; } | undefined;