@xort/cga 0.0.92 → 0.0.93
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.
- package/build/@xort_cga.js +1281 -3480
- package/build/cga.d.ts +33 -8
- package/dist/struct/3d/Circle.js +1 -1
- package/package.json +1 -1
- package/rollup.config.js +24 -21
- package/src/struct/3d/Circle.ts +1 -1
package/build/cga.d.ts
CHANGED
|
@@ -608,12 +608,7 @@ declare class Ray {
|
|
|
608
608
|
distancePloyline(): DistanceResult;
|
|
609
609
|
}
|
|
610
610
|
|
|
611
|
-
|
|
612
|
-
XY = "xy",
|
|
613
|
-
XZ = "xz",
|
|
614
|
-
YZ = "yz",
|
|
615
|
-
XYZ = "xyz"
|
|
616
|
-
}
|
|
611
|
+
type AxisPlane = 'xy' | 'xz' | 'yz' | 'xyz';
|
|
617
612
|
interface ITriangulationOption {
|
|
618
613
|
feature?: AxisPlane;
|
|
619
614
|
dim?: number;
|
|
@@ -873,6 +868,12 @@ declare class Polygon<T> extends Polyline<T> {
|
|
|
873
868
|
containPoint(point: Vec3): void;
|
|
874
869
|
}
|
|
875
870
|
|
|
871
|
+
declare enum ClipType {
|
|
872
|
+
Intersection = 0,
|
|
873
|
+
Union = 1,
|
|
874
|
+
Difference = 2,
|
|
875
|
+
Xor = 3
|
|
876
|
+
}
|
|
876
877
|
/**
|
|
877
878
|
* 线段正反原则:右手坐标系中,所在平面为XZ平面,把指向方向看着负Z轴,x正为正方向,x负为负方向
|
|
878
879
|
*/
|
|
@@ -881,6 +882,9 @@ declare class Polyline<T> extends ArrayList<T> {
|
|
|
881
882
|
isPolyline: boolean;
|
|
882
883
|
normal: Vec3;
|
|
883
884
|
constructor(vs?: Array<T> | Polyline<T> | Polygon<T>, normal?: Vec3);
|
|
885
|
+
static CleanPolygon(polys: any, delta: number, jointype: JoinType | undefined, endtype: EndType | undefined, limit: number): void;
|
|
886
|
+
static OffsetPaths(polys: any, delta: number, jointype: JoinType | undefined, endtype: EndType | undefined, limit: number): void;
|
|
887
|
+
static SimplifyPolygon(polys: any, delta: number, jointype: JoinType | undefined, endtype: EndType | undefined, limit: number): void;
|
|
884
888
|
/**
|
|
885
889
|
* 偏移
|
|
886
890
|
* @param {Number} distance 偏移距离
|
|
@@ -986,7 +990,16 @@ declare class Circle {
|
|
|
986
990
|
* @param lengthAngle 弧度长度 单位弧度
|
|
987
991
|
* @param segment 分段
|
|
988
992
|
*/
|
|
989
|
-
static
|
|
993
|
+
static toVecs(center: Vec3, radius: number, startAngle?: number, lengthAngle?: number, up?: Vec3, segment?: number): Vec3[];
|
|
994
|
+
/**
|
|
995
|
+
* 在p点延伸a,b两个方向,生成半径为r的圆弧,圆弧所在位置在a,b向量的内夹角
|
|
996
|
+
* @param p 位置
|
|
997
|
+
* @param a a方向
|
|
998
|
+
* @param b b方向
|
|
999
|
+
* @param r 圆弧半径
|
|
1000
|
+
*/
|
|
1001
|
+
static PAdBdtoVecs(p: Vec3, a: Vec3, b: Vec3, r: number, segment?: number): Vec3[];
|
|
1002
|
+
static PApBptoVecs(p: Vec3, a: Vec3, b: Vec3, r: number, segment?: number): Vec3[];
|
|
990
1003
|
}
|
|
991
1004
|
declare function circle(center?: Vec3, radius?: number): Circle;
|
|
992
1005
|
|
|
@@ -1117,7 +1130,19 @@ declare class Vec3 implements IVec3 {
|
|
|
1117
1130
|
*/
|
|
1118
1131
|
projectDirectionOnPlane(plane: Plane, dir: Vec3): this;
|
|
1119
1132
|
reflect(normal: any): this;
|
|
1133
|
+
/**
|
|
1134
|
+
* 两个向量的夹角
|
|
1135
|
+
* @param v
|
|
1136
|
+
* @param normal
|
|
1137
|
+
* @returns
|
|
1138
|
+
*/
|
|
1120
1139
|
angleTo(v: Vec3, normal?: Vec3 | any): number;
|
|
1140
|
+
/**
|
|
1141
|
+
* 一个向量到另一个向量的角度
|
|
1142
|
+
* @param v
|
|
1143
|
+
* @param normal
|
|
1144
|
+
* @returns
|
|
1145
|
+
*/
|
|
1121
1146
|
angleToEx(v: Vec3, normal: Vec3): number;
|
|
1122
1147
|
distanceTo(v: any): number;
|
|
1123
1148
|
distanceToSquared(v: Vec3): number;
|
|
@@ -2029,4 +2054,4 @@ declare function linkToGeometry(shape: Array<Vec3>, shape1: Array<Vec3>, axisPla
|
|
|
2029
2054
|
*/
|
|
2030
2055
|
declare function linksToGeometry(shapes: Array<Vec3>[], pathClosed?: boolean, shapeClosed?: boolean): BufferGeometry;
|
|
2031
2056
|
|
|
2032
|
-
export { AxisPlane, Box, BufferAttribute, BufferGeometry, Capsule, Circle, Color, DEGREES_PER_RADIAN, Delaunator, Disk, DistanceResult, EndType, Euler, Float32BufferAttribute, Float64BufferAttribute, Frustum, IBufferGeometry, IDistanceResut, IExtrudeOptions, IExtrudeOptionsEx, IExtrudeOptionsNext, IGeometry, ILinkSideOption, ILinkSideOptions, ITriangulationOption, IVec2, IVec3, IVec4, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntersectResult, JoinType, Line, Mat3, Mat4, MeshTool, ONE_OVER_PI, ONE_OVER_TWO_PI, PI, PI_OVER_FOUR, PI_OVER_SIX, PI_OVER_THREE, PI_OVER_TWO, PI_TWO, Path, Plane, Point, Polygon, Polyline, Quat, RADIANS_PER_ARCSECOND, RADIANS_PER_DEGREE, Ray, Segment, Sphere, THREE_PI_OVER_TWO, ToDegrees, Triangle, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Vec2, Vec3, Vec4, Voronoi, angle, applyMatrix4, applyQuat, approximateEqual, boundingBox, calcCircleFromThreePoint, ceilPowerOfTwo, circle, clamp, classify, clone, delta4, delta5, delta6, delta7, delta8, delta9, disk, euler, extrude, extrudeNext, extrudeToGeometryBuffer, extrude_obsolete, flat, floorPowerOfTwo, forall, isInOnePlane, isPowerOfTwo, lerp, line, linkSide, linkSides, linkToGeometry, linksToGeometry, m3, m4, pointsCollinear, projectOnPlane, quat, randFloat, randInt, recognitionPlane, reverseOnPlane, rotate, rotateByUnitVectors, scale, segment, sign, simplifyPointList, smootherstep, smoothstep, toFixed, toFixedAry, toGeometryBuffer, toRadians, translate, triangulation, unique, v2, v3, v4, vecs, vectorCompare };
|
|
2057
|
+
export { AxisPlane, Box, BufferAttribute, BufferGeometry, Capsule, Circle, ClipType, Color, DEGREES_PER_RADIAN, Delaunator, Disk, DistanceResult, EndType, Euler, Float32BufferAttribute, Float64BufferAttribute, Frustum, IBufferGeometry, IDistanceResut, IExtrudeOptions, IExtrudeOptionsEx, IExtrudeOptionsNext, IGeometry, ILinkSideOption, ILinkSideOptions, ITriangulationOption, IVec2, IVec3, IVec4, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntersectResult, JoinType, Line, Mat3, Mat4, MeshTool, ONE_OVER_PI, ONE_OVER_TWO_PI, PI, PI_OVER_FOUR, PI_OVER_SIX, PI_OVER_THREE, PI_OVER_TWO, PI_TWO, Path, Plane, Point, Polygon, Polyline, Quat, RADIANS_PER_ARCSECOND, RADIANS_PER_DEGREE, Ray, Segment, Sphere, THREE_PI_OVER_TWO, ToDegrees, Triangle, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Vec2, Vec3, Vec4, Voronoi, angle, applyMatrix4, applyQuat, approximateEqual, boundingBox, calcCircleFromThreePoint, ceilPowerOfTwo, circle, clamp, classify, clone, delta4, delta5, delta6, delta7, delta8, delta9, disk, euler, extrude, extrudeNext, extrudeToGeometryBuffer, extrude_obsolete, flat, floorPowerOfTwo, forall, isInOnePlane, isPowerOfTwo, lerp, line, linkSide, linkSides, linkToGeometry, linksToGeometry, m3, m4, pointsCollinear, projectOnPlane, quat, randFloat, randInt, recognitionPlane, reverseOnPlane, rotate, rotateByUnitVectors, scale, segment, sign, simplifyPointList, smootherstep, smoothstep, toFixed, toFixedAry, toGeometryBuffer, toRadians, translate, triangulation, unique, v2, v3, v4, vecs, vectorCompare };
|
package/dist/struct/3d/Circle.js
CHANGED
|
@@ -114,7 +114,7 @@ var Circle = /** @class */ (function () {
|
|
|
114
114
|
var cr = r / Math.sin(angle / 2);
|
|
115
115
|
var c = a.clone().add(b).normalize().multiplyScalar(cr).add(p);
|
|
116
116
|
var cd1 = a.clone().multiplyScalar(d).add(p).sub(c).normalize();
|
|
117
|
-
var cd2 =
|
|
117
|
+
var cd2 = b.clone().multiplyScalar(d).add(p).sub(c).normalize();
|
|
118
118
|
var up = cd1.clone().cross(cd2).normalize();
|
|
119
119
|
var q = (0, Quat_1.quat)().setFromUnitVecs(up, Vec3_1.Vec3.UnitY); //两个向量形成一个旋转4元数
|
|
120
120
|
cd1.applyQuat(q);
|
package/package.json
CHANGED
package/rollup.config.js
CHANGED
|
@@ -55,25 +55,28 @@ if (MIN) {
|
|
|
55
55
|
plugins.push(gzip());
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
export default
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
58
|
+
export default [
|
|
59
|
+
{
|
|
60
|
+
input: path.join('dist', 'index.js'),
|
|
61
|
+
external: ['lodash'],
|
|
62
|
+
plugins: plugins,
|
|
63
|
+
output: {
|
|
64
|
+
file: path.join(DIST ? 'dist' : 'build', '@xort_cga' + (MIN ? '.min' : '') + '.js'),
|
|
65
|
+
format: 'umd',
|
|
66
|
+
// format: 'umd',
|
|
67
|
+
name: 'cga',
|
|
68
|
+
banner: banner,
|
|
69
|
+
globals: {
|
|
70
|
+
lodash: '_'
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
72
75
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
76
|
+
input: "dist/index.d.ts",
|
|
77
|
+
output: [{
|
|
78
|
+
file: "build/cga.d.ts", format: "es",
|
|
79
|
+
name: 'cga'
|
|
80
|
+
}],
|
|
81
|
+
plugins: [dts()],
|
|
82
|
+
}]
|
package/src/struct/3d/Circle.ts
CHANGED
|
@@ -117,7 +117,7 @@ export class Circle {
|
|
|
117
117
|
const c = a.clone().add(b).normalize().multiplyScalar(cr).add(p)
|
|
118
118
|
|
|
119
119
|
const cd1 = a.clone().multiplyScalar(d).add(p).sub(c).normalize();
|
|
120
|
-
const cd2 =
|
|
120
|
+
const cd2 = b.clone().multiplyScalar(d).add(p).sub(c).normalize();
|
|
121
121
|
|
|
122
122
|
const up = cd1.clone().cross(cd2).normalize();
|
|
123
123
|
|