webcad-api/types/GraphicsSystem/OffsetPolyline.d.ts

91 lines
3.4 KiB
TypeScript

import { Box3, Matrix4, Vector3 } from "three";
import { Contour } from "../DatabaseServices/Contour";
import { Arc } from "../DatabaseServices/Entity/Arc";
import { Circle } from "../DatabaseServices/Entity/Circle";
import { Curve } from "../DatabaseServices/Entity/Curve";
import { Line } from "../DatabaseServices/Entity/Line";
import { Polyline } from "../DatabaseServices/Entity/Polyline";
interface IOffsetResult {
index: number;
curve: Curve;
/**偏移距离(仅在局部偏移时提供) */
dist?: number;
sp?: Vector3;
ep?: Vector3;
preCurve?: Curve;
nextCurve?: Curve;
paddingCurve?: Curve[];
}
export declare class CurveTreeNode {
curve: Curve;
children: this[];
box: Box3;
used: boolean;
Create(curve: Curve, box?: Box3): this;
constructor(curve: Curve, box?: Box3);
TrimBy(contour: Contour, box: Box3): void;
get Nodes(): this[];
}
export declare enum PolylineJoinType {
Square = 0,
Round = 1
}
export declare class OffsetPolyline {
_Polyline: Polyline;
_OffsetDist: number;
_ToolPath: boolean;
private _OffsetDistSq;
private _JoinType;
_CacheOCS: Matrix4;
_Vertexs: Vector3[];
_SubCurves: Curve[];
_Circles: Circle[];
_SubOffsetedCurves: IOffsetResult[];
_CurveTreeNodes: CurveTreeNode[];
_CurveTrimedTreeNodes: CurveTreeNode[];
_TrimPolylineContours: Contour[];
_TrimCircleContours: Circle[];
_TrimArcContours: Contour[];
_RetCurves: Polyline[];
_IsClose: boolean;
_OffsetDistSign: number;
_IsTopoOffset: boolean;
/**
*
* @param _Polyline
* @param _OffsetDist
* @param [_ToolPath=false] 走刀模式(在这个模式下,我们会进行圆弧过渡(或者直线过渡)避免尖角过大)
* @param [_OffsetDistSq=(_OffsetDist ** 2) * 2.1] 允许的最大尖角长度 默认值差不多是矩形的尖角大一点
* @param [_JoinType=PolylineJoinType.Round] 尖角的处理方式,默认是圆弧过渡,可以切换成直线过渡
*/
constructor(_Polyline: Polyline, _OffsetDist: number, _ToolPath?: boolean, _OffsetDistSq?: number, //对直角走刀不进行圆弧过度
_JoinType?: PolylineJoinType);
Do(): Polyline[];
InitSubCurves(): this;
protected GeneralCirclesAndVertexs(): void;
protected OffsetSubCurves(): void;
LinkSubCurves(): void;
/**
* 判断两曲线是否尖角化
* 在
* 1.直线和圆弧,圆弧和圆弧
* 2.有交点,无真交点时
* 必须在正确的方向做出延伸动作,所以必须在尖角的情况下延伸,偏移的结果就像一个谷字去掉一个口的结果,上面的人就是偏移后的结果.
* 如果是谷,则允许连接 #I7WKKG
*/
private IsSharpCorner;
protected GeneralTrimContours(): void;
protected TrimByContours(): void;
private FilterInvalidCurve;
private JoinCollinear;
private LinkResultPolyline;
private RepairResultPolylineClosemark;
CheckPointDir(pt: Vector3): boolean;
GetPointAtCurveDir(pt: Vector3): number;
protected CreateArc(center: Vector3, startP: Vector3, endP?: Vector3): Arc;
protected CreateSquare(center: Vector3, curveNow: IOffsetResult, curveNext: IOffsetResult, entTypeCode: number): Line;
}
export declare function EntityEncode2(c1: Curve, c2: Curve): number;
export declare function CurveIsFine(curve: Curve): boolean;
export {};
//# sourceMappingURL=OffsetPolyline.d.ts.map