更新代码,支持更高精度的圆弧拉伸实体
This commit is contained in:
parent
eb204d4f8a
commit
4388a1f7c8
29
api.esm.js
29
api.esm.js
@ -1,4 +1,4 @@
|
||||
import { Vector3, LineDashedMaterial, Vector2, MeshBasicMaterial, LineBasicMaterial, DoubleSide, ShaderMaterial, Color, Matrix4, Box3, Object3D, BufferGeometry, Shape as Shape$1, ShapeGeometry, BufferAttribute, EllipseCurve, ExtrudeGeometry, Mesh, Plane as Plane$1, Line3, Line as Line$1, MathUtils, Geometry, Face3, Path, LineSegments, InstancedInterleavedBuffer, InterleavedBufferAttribute, CylinderBufferGeometry, Float32BufferAttribute, ShapeUtils, CatmullRomCurve3, BoxBufferGeometry, BoxGeometry } from 'three';
|
||||
import { Box3, BoxBufferGeometry, BoxGeometry, BufferAttribute, BufferGeometry, CatmullRomCurve3, Color, CylinderBufferGeometry, DoubleSide, EllipseCurve, ExtrudeGeometry, Face3, Float32BufferAttribute, Geometry, InstancedInterleavedBuffer, InterleavedBufferAttribute, Line as Line$1, Line3, LineBasicMaterial, LineDashedMaterial, LineSegments, MathUtils, Matrix4, Mesh, MeshBasicMaterial, Object3D, Path, Plane as Plane$1, ShaderMaterial, Shape as Shape$1, ShapeGeometry, ShapeUtils, Vector2, Vector3 } from 'three';
|
||||
import { Line2 } from 'three/examples/jsm/lines/Line2';
|
||||
import { LineGeometry } from 'three/examples/jsm/lines/LineGeometry';
|
||||
import { LineMaterial } from 'three/examples/jsm/lines/LineMaterial';
|
||||
@ -2824,21 +2824,38 @@ var BufferGeometryUtils;
|
||||
BufferGeometryUtils.MergeBufferAttributes = MergeBufferAttributes;
|
||||
})(BufferGeometryUtils || (BufferGeometryUtils = {}));
|
||||
|
||||
let tempArc;
|
||||
class Shape2 extends Shape$1
|
||||
{
|
||||
getPoints(divisions = 12)
|
||||
getPoints(divisions = 12, optimizeArc = true)
|
||||
{
|
||||
divisions = divisions || 12;
|
||||
let points = [], last;
|
||||
for (let i = 0, curves = this.curves; i < curves.length; i++) {
|
||||
let curve = curves[i];
|
||||
let resolution = divisions;
|
||||
//@ts-ignore
|
||||
let resolution = (curve && curve.isEllipseCurve) ? clamp(curve.getLength() / 20, divisions * 2, 60)
|
||||
if (curve && curve.isEllipseCurve) {
|
||||
if (optimizeArc) {
|
||||
if (!tempArc)
|
||||
tempArc = new Arc;
|
||||
tempArc.IsClockWise = curve.aClockwise;
|
||||
tempArc.StartAngle = curve.aStartAngle;
|
||||
tempArc.EndAngle = curve.aEndAngle;
|
||||
tempArc.Radius = Math.abs(curve.xRadius);
|
||||
//根据圆弧的角度,来确定绘制个数
|
||||
let count = Math.max(2, Math.abs(Math.ceil((tempArc.AllAngle) / Math.PI)) * divisions);
|
||||
resolution = clamp(Math.ceil(tempArc.Length / 5), count, 360);
|
||||
}
|
||||
else
|
||||
resolution = divisions * 2;
|
||||
}
|
||||
else {
|
||||
//@ts-ignore
|
||||
: (curve && (curve.isLineCurve || curve.isLineCurve3)) ? 1
|
||||
resolution = (curve && (curve.isLineCurve || curve.isLineCurve3)) ? 1
|
||||
//@ts-ignore
|
||||
: (curve && curve.isSplineCurve) ? divisions * curve.points.length
|
||||
: divisions;
|
||||
}
|
||||
let pts = curve.getPoints(resolution);
|
||||
for (let j = 0; j < pts.length; j++) {
|
||||
let point = pts[j];
|
||||
@ -20715,5 +20732,5 @@ function ProjectBoard(knifBoard, projectBoard)
|
||||
//用于翻转绘制出来的槽
|
||||
const OverturnMatrix = new Matrix4().makeBasis(YAxis, ZAxis, XAxis);
|
||||
|
||||
export { Circle, ContourTreeNode, CurveTapeShape, DepthType, ExtrudeBuildConfig, ExtrudeGeometryBuilder, ExtrudeSolid, FastMeshGeometry, Groove, Polyline, TempPolyline };
|
||||
export { Circle, ContourTreeNode, CurveTapeShape, DepthType, ExtrudeBuildConfig, ExtrudeGeometryBuilder, ExtrudeSolid, FastMeshGeometry, Groove, Polyline, TempPolyline, Shape2 };
|
||||
//# sourceMappingURL=api.esm.js.map
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "webcad_ue4_api",
|
||||
"version": "0.2.1",
|
||||
"version": "0.2.2",
|
||||
"description": "",
|
||||
"main": "api.esm.js",
|
||||
"module": "api.esm.js",
|
||||
|
3
types/ueapi.d.ts
vendored
3
types/ueapi.d.ts
vendored
@ -1,5 +1,6 @@
|
||||
export * from "./DatabaseServices/Entity/Circle";
|
||||
export * from "./DatabaseServices/Entity/Extrude";
|
||||
export * from "./DatabaseServices/Entity/Polyline";
|
||||
export * from "./DatabaseServices/Shape2";
|
||||
export * from "./Geometry/ExtrudeEdgeGeometry2";
|
||||
//# sourceMappingURL=ueapi.d.ts.map
|
||||
//# sourceMappingURL=ueapi.d.ts.map
|
||||
|
Loading…
Reference in New Issue
Block a user