brepjs 2.0.3 → 2.0.4
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/dist/brepjs.cjs +374 -793
- package/dist/brepjs.d.ts +136 -312
- package/dist/brepjs.js +374 -793
- package/package.json +3 -3
package/dist/brepjs.js
CHANGED
|
@@ -1435,9 +1435,9 @@ function vecRotate(v, axis, angleRad) {
|
|
|
1435
1435
|
v[2] * cos + cross[2] * sin + n[2] * dot * (1 - cos)
|
|
1436
1436
|
];
|
|
1437
1437
|
}
|
|
1438
|
-
const round3
|
|
1438
|
+
const round3 = (v) => Math.round(v * 1e3) / 1e3;
|
|
1439
1439
|
function vecRepr(v) {
|
|
1440
|
-
return `x: ${round3
|
|
1440
|
+
return `x: ${round3(v[0])}, y: ${round3(v[1])}, z: ${round3(v[2])}`;
|
|
1441
1441
|
}
|
|
1442
1442
|
function toOcVec(v) {
|
|
1443
1443
|
const oc = getKernel().oc;
|
|
@@ -1498,7 +1498,11 @@ function makeOcAx2(origin, zDir, xDir) {
|
|
|
1498
1498
|
const pnt2 = toOcPnt(origin);
|
|
1499
1499
|
const z = toOcDir(zDir);
|
|
1500
1500
|
let ax;
|
|
1501
|
-
{
|
|
1501
|
+
if (xDir) {
|
|
1502
|
+
const x = toOcDir(xDir);
|
|
1503
|
+
ax = new oc.gp_Ax2_2(pnt2, z, x);
|
|
1504
|
+
x.delete();
|
|
1505
|
+
} else {
|
|
1502
1506
|
ax = new oc.gp_Ax2_3(pnt2, z);
|
|
1503
1507
|
}
|
|
1504
1508
|
pnt2.delete();
|
|
@@ -1517,148 +1521,11 @@ function makeOcAx3(origin, zDir, xDir) {
|
|
|
1517
1521
|
z.delete();
|
|
1518
1522
|
return ax;
|
|
1519
1523
|
}
|
|
1520
|
-
const round3 = (v) => Math.round(v * 1e3) / 1e3;
|
|
1521
1524
|
function isPoint(p) {
|
|
1522
1525
|
if (Array.isArray(p)) return p.length === 3 || p.length === 2;
|
|
1523
|
-
else if (p instanceof Vector) return true;
|
|
1524
1526
|
else if (p && typeof p?.XYZ === "function") return true;
|
|
1525
1527
|
return false;
|
|
1526
1528
|
}
|
|
1527
|
-
const makeAx3 = (center, dir, xDir) => {
|
|
1528
|
-
const oc = getKernel().oc;
|
|
1529
|
-
const origin = asPnt(center);
|
|
1530
|
-
const direction = asDir(dir);
|
|
1531
|
-
const xDirection = xDir ? asDir(xDir) : null;
|
|
1532
|
-
try {
|
|
1533
|
-
if (xDirection) {
|
|
1534
|
-
return new oc.gp_Ax3_3(origin, direction, xDirection);
|
|
1535
|
-
} else {
|
|
1536
|
-
return new oc.gp_Ax3_4(origin, direction);
|
|
1537
|
-
}
|
|
1538
|
-
} finally {
|
|
1539
|
-
origin.delete();
|
|
1540
|
-
direction.delete();
|
|
1541
|
-
if (xDirection) xDirection.delete();
|
|
1542
|
-
}
|
|
1543
|
-
};
|
|
1544
|
-
const makeAx2 = (center, dir, xDir) => {
|
|
1545
|
-
const oc = getKernel().oc;
|
|
1546
|
-
const origin = asPnt(center);
|
|
1547
|
-
const direction = asDir(dir);
|
|
1548
|
-
const xDirection = xDir ? asDir(xDir) : null;
|
|
1549
|
-
try {
|
|
1550
|
-
if (xDirection) {
|
|
1551
|
-
return new oc.gp_Ax2_2(origin, direction, xDirection);
|
|
1552
|
-
} else {
|
|
1553
|
-
return new oc.gp_Ax2_3(origin, direction);
|
|
1554
|
-
}
|
|
1555
|
-
} finally {
|
|
1556
|
-
origin.delete();
|
|
1557
|
-
direction.delete();
|
|
1558
|
-
if (xDirection) xDirection.delete();
|
|
1559
|
-
}
|
|
1560
|
-
};
|
|
1561
|
-
const makeAx1 = (center, dir) => {
|
|
1562
|
-
const oc = getKernel().oc;
|
|
1563
|
-
const origin = asPnt(center);
|
|
1564
|
-
const direction = asDir(dir);
|
|
1565
|
-
try {
|
|
1566
|
-
return new oc.gp_Ax1_2(origin, direction);
|
|
1567
|
-
} finally {
|
|
1568
|
-
origin.delete();
|
|
1569
|
-
direction.delete();
|
|
1570
|
-
}
|
|
1571
|
-
};
|
|
1572
|
-
const makeVec = (vector = [0, 0, 0]) => {
|
|
1573
|
-
const oc = getKernel().oc;
|
|
1574
|
-
if (Array.isArray(vector)) {
|
|
1575
|
-
if (vector.length === 3) return new oc.gp_Vec_4(...vector);
|
|
1576
|
-
return new oc.gp_Vec_4(...vector, 0);
|
|
1577
|
-
} else if (vector instanceof Vector) {
|
|
1578
|
-
return new oc.gp_Vec_3(vector.wrapped.XYZ());
|
|
1579
|
-
}
|
|
1580
|
-
return new oc.gp_Vec_3(vector.XYZ());
|
|
1581
|
-
};
|
|
1582
|
-
class Vector extends WrappingObj {
|
|
1583
|
-
constructor(vector = [0, 0, 0]) {
|
|
1584
|
-
super(makeVec(vector));
|
|
1585
|
-
}
|
|
1586
|
-
get repr() {
|
|
1587
|
-
return `x: ${round3(this.x)}, y: ${round3(this.y)}, z: ${round3(this.z)}`;
|
|
1588
|
-
}
|
|
1589
|
-
get x() {
|
|
1590
|
-
return this.wrapped.X();
|
|
1591
|
-
}
|
|
1592
|
-
get y() {
|
|
1593
|
-
return this.wrapped.Y();
|
|
1594
|
-
}
|
|
1595
|
-
get z() {
|
|
1596
|
-
return this.wrapped.Z();
|
|
1597
|
-
}
|
|
1598
|
-
get Length() {
|
|
1599
|
-
return this.wrapped.Magnitude();
|
|
1600
|
-
}
|
|
1601
|
-
toTuple() {
|
|
1602
|
-
return [this.x, this.y, this.z];
|
|
1603
|
-
}
|
|
1604
|
-
/** Convert to Vec3 tuple */
|
|
1605
|
-
toVec3() {
|
|
1606
|
-
return [this.x, this.y, this.z];
|
|
1607
|
-
}
|
|
1608
|
-
cross(v) {
|
|
1609
|
-
return new Vector(this.wrapped.Crossed(v.wrapped));
|
|
1610
|
-
}
|
|
1611
|
-
dot(v) {
|
|
1612
|
-
return this.wrapped.Dot(v.wrapped);
|
|
1613
|
-
}
|
|
1614
|
-
sub(v) {
|
|
1615
|
-
return new Vector(this.wrapped.Subtracted(v.wrapped));
|
|
1616
|
-
}
|
|
1617
|
-
add(v) {
|
|
1618
|
-
return new Vector(this.wrapped.Added(v.wrapped));
|
|
1619
|
-
}
|
|
1620
|
-
multiply(scale2) {
|
|
1621
|
-
return new Vector(this.wrapped.Multiplied(scale2));
|
|
1622
|
-
}
|
|
1623
|
-
normalized() {
|
|
1624
|
-
return new Vector(this.wrapped.Normalized());
|
|
1625
|
-
}
|
|
1626
|
-
normalize() {
|
|
1627
|
-
this.wrapped.Normalize();
|
|
1628
|
-
return this;
|
|
1629
|
-
}
|
|
1630
|
-
getCenter() {
|
|
1631
|
-
return this;
|
|
1632
|
-
}
|
|
1633
|
-
getAngle(v) {
|
|
1634
|
-
return this.wrapped.Angle(v.wrapped) * RAD2DEG;
|
|
1635
|
-
}
|
|
1636
|
-
projectToPlane(plane) {
|
|
1637
|
-
const base = plane.origin;
|
|
1638
|
-
const normal = plane.zDir;
|
|
1639
|
-
const v1 = this.sub(base);
|
|
1640
|
-
const v2 = normal.multiply(v1.dot(normal) / normal.Length ** 2);
|
|
1641
|
-
const projection = this.sub(v2);
|
|
1642
|
-
v1.delete();
|
|
1643
|
-
v2.delete();
|
|
1644
|
-
return projection;
|
|
1645
|
-
}
|
|
1646
|
-
equals(other) {
|
|
1647
|
-
return this.wrapped.IsEqual(other.wrapped, 1e-5, 1e-5);
|
|
1648
|
-
}
|
|
1649
|
-
toPnt() {
|
|
1650
|
-
return new this.oc.gp_Pnt_2(this.wrapped.XYZ());
|
|
1651
|
-
}
|
|
1652
|
-
toDir() {
|
|
1653
|
-
return new this.oc.gp_Dir_3(this.wrapped.XYZ());
|
|
1654
|
-
}
|
|
1655
|
-
rotate(angle, center = [0, 0, 0], direction = [0, 0, 1]) {
|
|
1656
|
-
const ax = makeAx1(center, direction);
|
|
1657
|
-
this.wrapped.Rotate(ax, angle * DEG2RAD);
|
|
1658
|
-
ax.delete();
|
|
1659
|
-
return this;
|
|
1660
|
-
}
|
|
1661
|
-
}
|
|
1662
1529
|
const DIRECTIONS$2 = {
|
|
1663
1530
|
X: [1, 0, 0],
|
|
1664
1531
|
Y: [0, 1, 0],
|
|
@@ -1670,221 +1537,24 @@ function makeDirection(p) {
|
|
|
1670
1537
|
}
|
|
1671
1538
|
return p;
|
|
1672
1539
|
}
|
|
1673
|
-
function
|
|
1674
|
-
const
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
class Transformation extends WrappingObj {
|
|
1686
|
-
constructor(transform2) {
|
|
1687
|
-
const oc = getKernel().oc;
|
|
1688
|
-
super(transform2 || new oc.gp_Trsf_1());
|
|
1689
|
-
}
|
|
1690
|
-
translate(xDistOrVector, yDist = 0, zDist = 0) {
|
|
1691
|
-
const translation = new Vector(
|
|
1692
|
-
typeof xDistOrVector === "number" ? [xDistOrVector, yDist, zDist] : xDistOrVector
|
|
1693
|
-
);
|
|
1694
|
-
this.wrapped.SetTranslation_1(translation.wrapped);
|
|
1695
|
-
translation.delete();
|
|
1696
|
-
return this;
|
|
1697
|
-
}
|
|
1698
|
-
rotate(angle, position = [0, 0, 0], direction = [0, 0, 1]) {
|
|
1699
|
-
const dir = asDir(direction);
|
|
1700
|
-
const origin = asPnt(position);
|
|
1701
|
-
const axis = new this.oc.gp_Ax1_2(origin, dir);
|
|
1702
|
-
this.wrapped.SetRotation_1(axis, angle * DEG2RAD);
|
|
1703
|
-
axis.delete();
|
|
1704
|
-
dir.delete();
|
|
1705
|
-
origin.delete();
|
|
1706
|
-
return this;
|
|
1707
|
-
}
|
|
1708
|
-
mirror(inputPlane = "YZ", inputOrigin) {
|
|
1709
|
-
const r = gcWithScope();
|
|
1710
|
-
let origin;
|
|
1711
|
-
let direction;
|
|
1712
|
-
if (typeof inputPlane === "string") {
|
|
1713
|
-
const plane = r(unwrap(createNamedPlane$1(inputPlane, inputOrigin)));
|
|
1714
|
-
origin = plane.origin;
|
|
1715
|
-
direction = plane.zDir;
|
|
1716
|
-
} else if (inputPlane instanceof Plane) {
|
|
1717
|
-
origin = inputOrigin || inputPlane.origin;
|
|
1718
|
-
direction = inputPlane.zDir;
|
|
1719
|
-
} else {
|
|
1720
|
-
origin = inputOrigin || [0, 0, 0];
|
|
1721
|
-
direction = inputPlane;
|
|
1722
|
-
}
|
|
1723
|
-
const mirrorAxis = r(makeAx2(origin, direction));
|
|
1724
|
-
this.wrapped.SetMirror_3(mirrorAxis);
|
|
1725
|
-
return this;
|
|
1726
|
-
}
|
|
1727
|
-
scale(center, scale2) {
|
|
1728
|
-
const pnt2 = asPnt(center);
|
|
1729
|
-
this.wrapped.SetScale(pnt2, scale2);
|
|
1730
|
-
pnt2.delete();
|
|
1731
|
-
return this;
|
|
1732
|
-
}
|
|
1733
|
-
coordSystemChange(fromSystem, toSystem) {
|
|
1734
|
-
const r = gcWithScope();
|
|
1735
|
-
const fromAx = r(
|
|
1736
|
-
fromSystem === "reference" ? new this.oc.gp_Ax3_1() : makeAx3(fromSystem.origin, fromSystem.zDir, fromSystem.xDir)
|
|
1737
|
-
);
|
|
1738
|
-
const toAx = r(
|
|
1739
|
-
toSystem === "reference" ? new this.oc.gp_Ax3_1() : makeAx3(toSystem.origin, toSystem.zDir, toSystem.xDir)
|
|
1740
|
-
);
|
|
1741
|
-
this.wrapped.SetTransformation_1(fromAx, toAx);
|
|
1742
|
-
return this;
|
|
1743
|
-
}
|
|
1744
|
-
transformPoint(point) {
|
|
1745
|
-
const pnt2 = asPnt(point);
|
|
1746
|
-
const newPoint = pnt2.Transformed(this.wrapped);
|
|
1747
|
-
pnt2.delete();
|
|
1748
|
-
return newPoint;
|
|
1749
|
-
}
|
|
1750
|
-
transform(shape) {
|
|
1751
|
-
const transformer = new this.oc.BRepBuilderAPI_Transform_2(shape, this.wrapped, true);
|
|
1752
|
-
const result = transformer.ModifiedShape(shape);
|
|
1753
|
-
transformer.delete();
|
|
1754
|
-
return result;
|
|
1755
|
-
}
|
|
1756
|
-
}
|
|
1757
|
-
class Plane {
|
|
1758
|
-
oc;
|
|
1759
|
-
xDir;
|
|
1760
|
-
yDir;
|
|
1761
|
-
zDir;
|
|
1762
|
-
// @ts-expect-error -- initialised indirectly via origin setter
|
|
1763
|
-
_origin;
|
|
1764
|
-
// @ts-expect-error -- initialised indirectly via _calcTransforms
|
|
1765
|
-
localToGlobal;
|
|
1766
|
-
// @ts-expect-error -- initialised indirectly via _calcTransforms
|
|
1767
|
-
globalToLocal;
|
|
1768
|
-
constructor(origin, xDirection = null, normal = [0, 0, 1]) {
|
|
1769
|
-
this.oc = getKernel().oc;
|
|
1770
|
-
const zDir = new Vector(normal);
|
|
1771
|
-
if (zDir.Length === 0) {
|
|
1772
|
-
bug("Plane", "Plane normal must be non-zero");
|
|
1773
|
-
}
|
|
1774
|
-
this.zDir = zDir.normalize();
|
|
1775
|
-
let xDir;
|
|
1776
|
-
if (!xDirection) {
|
|
1777
|
-
const ax3 = makeAx3(origin, zDir);
|
|
1778
|
-
xDir = new Vector(ax3.XDirection());
|
|
1779
|
-
ax3.delete();
|
|
1780
|
-
} else {
|
|
1781
|
-
xDir = new Vector(xDirection);
|
|
1782
|
-
}
|
|
1783
|
-
if (xDir.Length === 0) {
|
|
1784
|
-
bug("Plane", "Plane xDir must be non-zero");
|
|
1785
|
-
}
|
|
1786
|
-
this.xDir = xDir.normalize();
|
|
1787
|
-
this.yDir = this.zDir.cross(this.xDir).normalize();
|
|
1788
|
-
this.origin = new Vector(origin);
|
|
1789
|
-
}
|
|
1790
|
-
delete() {
|
|
1791
|
-
this.localToGlobal.delete();
|
|
1792
|
-
this.globalToLocal.delete();
|
|
1793
|
-
this.xDir.delete();
|
|
1794
|
-
this.yDir.delete();
|
|
1795
|
-
this.zDir.delete();
|
|
1796
|
-
this._origin.delete();
|
|
1797
|
-
}
|
|
1798
|
-
clone() {
|
|
1799
|
-
return new Plane(this.origin, this.xDir, this.zDir);
|
|
1800
|
-
}
|
|
1801
|
-
get origin() {
|
|
1802
|
-
return this._origin;
|
|
1803
|
-
}
|
|
1804
|
-
set origin(newOrigin) {
|
|
1805
|
-
if (this._origin) this._origin.delete();
|
|
1806
|
-
this._origin = newOrigin;
|
|
1807
|
-
this._calcTransforms();
|
|
1808
|
-
}
|
|
1809
|
-
translateTo(point) {
|
|
1810
|
-
const newPlane = this.clone();
|
|
1811
|
-
newPlane.origin = new Vector(point);
|
|
1812
|
-
return newPlane;
|
|
1813
|
-
}
|
|
1814
|
-
translate(xDistOrVector, yDist = 0, zDist = 0) {
|
|
1815
|
-
const translation = new Vector(
|
|
1816
|
-
typeof xDistOrVector === "number" ? [xDistOrVector, yDist, zDist] : xDistOrVector
|
|
1817
|
-
);
|
|
1818
|
-
const newOrigin = this.origin.add(translation);
|
|
1819
|
-
translation.delete();
|
|
1820
|
-
const result = this.translateTo(newOrigin);
|
|
1821
|
-
newOrigin.delete();
|
|
1822
|
-
return result;
|
|
1823
|
-
}
|
|
1824
|
-
translateX(xDist) {
|
|
1825
|
-
return this.translate(xDist, 0, 0);
|
|
1826
|
-
}
|
|
1827
|
-
translateY(yDist) {
|
|
1828
|
-
return this.translate(0, yDist, 0);
|
|
1829
|
-
}
|
|
1830
|
-
translateZ(zDist) {
|
|
1831
|
-
return this.translate(0, 0, zDist);
|
|
1832
|
-
}
|
|
1833
|
-
pivot(angle, direction = [1, 0, 0]) {
|
|
1834
|
-
const dir = makeDirection(direction);
|
|
1835
|
-
const zDir = new Vector(this.zDir).rotate(angle, [0, 0, 0], dir);
|
|
1836
|
-
const xDir = new Vector(this.xDir).rotate(angle, [0, 0, 0], dir);
|
|
1837
|
-
try {
|
|
1838
|
-
return new Plane(this.origin, xDir, zDir);
|
|
1839
|
-
} finally {
|
|
1840
|
-
zDir.delete();
|
|
1841
|
-
xDir.delete();
|
|
1842
|
-
}
|
|
1843
|
-
}
|
|
1844
|
-
rotate2DAxes(angle) {
|
|
1845
|
-
const xDir = new Vector(this.xDir).rotate(angle, [0, 0, 0], this.zDir);
|
|
1846
|
-
try {
|
|
1847
|
-
return new Plane(this.origin, xDir, this.zDir);
|
|
1848
|
-
} finally {
|
|
1849
|
-
xDir.delete();
|
|
1850
|
-
}
|
|
1851
|
-
}
|
|
1852
|
-
_calcTransforms() {
|
|
1853
|
-
if (this.globalToLocal) this.globalToLocal.delete();
|
|
1854
|
-
if (this.localToGlobal) this.localToGlobal.delete();
|
|
1855
|
-
this.globalToLocal = new Transformation();
|
|
1856
|
-
this.globalToLocal.coordSystemChange("reference", {
|
|
1857
|
-
origin: this.origin,
|
|
1858
|
-
zDir: this.zDir,
|
|
1859
|
-
xDir: this.xDir
|
|
1860
|
-
});
|
|
1861
|
-
this.localToGlobal = new Transformation();
|
|
1862
|
-
this.localToGlobal.coordSystemChange(
|
|
1863
|
-
{
|
|
1864
|
-
origin: this.origin,
|
|
1865
|
-
zDir: this.zDir,
|
|
1866
|
-
xDir: this.xDir
|
|
1867
|
-
},
|
|
1868
|
-
"reference"
|
|
1869
|
-
);
|
|
1870
|
-
}
|
|
1871
|
-
setOrigin2d(x, y) {
|
|
1872
|
-
this.origin = this.toWorldCoords([x, y]);
|
|
1873
|
-
}
|
|
1874
|
-
toLocalCoords(vec2) {
|
|
1875
|
-
const pnt2 = this.globalToLocal.transformPoint(vec2);
|
|
1876
|
-
const newVec = new Vector(pnt2);
|
|
1877
|
-
pnt2.delete();
|
|
1878
|
-
return newVec;
|
|
1879
|
-
}
|
|
1880
|
-
toWorldCoords(v) {
|
|
1881
|
-
const pnt2 = this.localToGlobal.transformPoint(v);
|
|
1882
|
-
const newVec = new Vector(pnt2);
|
|
1883
|
-
pnt2.delete();
|
|
1884
|
-
return newVec;
|
|
1540
|
+
function createPlane(origin, xDirection = null, normal = [0, 0, 1]) {
|
|
1541
|
+
const zDir = vecNormalize(normal);
|
|
1542
|
+
if (vecIsZero(zDir)) throw new Error("Plane normal must be non-zero");
|
|
1543
|
+
let xDir;
|
|
1544
|
+
if (!xDirection) {
|
|
1545
|
+
const ax3 = makeOcAx3(origin, zDir);
|
|
1546
|
+
const ocXDir = ax3.XDirection();
|
|
1547
|
+
xDir = vecNormalize([ocXDir.X(), ocXDir.Y(), ocXDir.Z()]);
|
|
1548
|
+
ocXDir.delete();
|
|
1549
|
+
ax3.delete();
|
|
1550
|
+
} else {
|
|
1551
|
+
xDir = vecNormalize(xDirection);
|
|
1885
1552
|
}
|
|
1553
|
+
if (vecIsZero(xDir)) throw new Error("Plane xDir must be non-zero");
|
|
1554
|
+
const yDir = vecNormalize(vecCross(zDir, xDir));
|
|
1555
|
+
return { origin, xDir, yDir, zDir };
|
|
1886
1556
|
}
|
|
1887
|
-
const PLANES_CONFIG
|
|
1557
|
+
const PLANES_CONFIG = {
|
|
1888
1558
|
XY: { xDir: [1, 0, 0], normal: [0, 0, 1] },
|
|
1889
1559
|
YZ: { xDir: [0, 1, 0], normal: [1, 0, 0] },
|
|
1890
1560
|
ZX: { xDir: [0, 0, 1], normal: [0, 1, 0] },
|
|
@@ -1898,118 +1568,123 @@ const PLANES_CONFIG$1 = {
|
|
|
1898
1568
|
top: { xDir: [1, 0, 0], normal: [0, 1, 0] },
|
|
1899
1569
|
bottom: { xDir: [1, 0, 0], normal: [0, -1, 0] }
|
|
1900
1570
|
};
|
|
1901
|
-
|
|
1902
|
-
const config = PLANES_CONFIG
|
|
1903
|
-
if (!config) return err(validationError("UNKNOWN_PLANE", `Could not find plane ${
|
|
1571
|
+
function createNamedPlane(name, sourceOrigin = [0, 0, 0]) {
|
|
1572
|
+
const config = PLANES_CONFIG[name];
|
|
1573
|
+
if (!config) return err(validationError("UNKNOWN_PLANE", `Could not find plane ${name}`));
|
|
1904
1574
|
let origin;
|
|
1905
1575
|
if (typeof sourceOrigin === "number") {
|
|
1906
|
-
origin = config.normal
|
|
1576
|
+
origin = vecScale(config.normal, sourceOrigin);
|
|
1907
1577
|
} else {
|
|
1908
|
-
origin = sourceOrigin;
|
|
1909
|
-
}
|
|
1910
|
-
return ok(new Plane(origin, config.xDir, config.normal));
|
|
1911
|
-
};
|
|
1912
|
-
class BoundingBox extends WrappingObj {
|
|
1913
|
-
constructor(wrapped) {
|
|
1914
|
-
const oc = getKernel().oc;
|
|
1915
|
-
let boundBox = wrapped;
|
|
1916
|
-
if (!boundBox) {
|
|
1917
|
-
boundBox = new oc.Bnd_Box_1();
|
|
1918
|
-
}
|
|
1919
|
-
super(boundBox);
|
|
1920
|
-
}
|
|
1921
|
-
get repr() {
|
|
1922
|
-
const [min, max] = this.bounds;
|
|
1923
|
-
const fmt = ([x, y, z]) => `x: ${round3(x)}, y: ${round3(y)}, z: ${round3(z)}`;
|
|
1924
|
-
return `${fmt(min)} - ${fmt(max)}`;
|
|
1925
|
-
}
|
|
1926
|
-
get bounds() {
|
|
1927
|
-
const xMin = { current: 0 };
|
|
1928
|
-
const yMin = { current: 0 };
|
|
1929
|
-
const zMin = { current: 0 };
|
|
1930
|
-
const xMax = { current: 0 };
|
|
1931
|
-
const yMax = { current: 0 };
|
|
1932
|
-
const zMax = { current: 0 };
|
|
1933
|
-
this.wrapped.Get(xMin, yMin, zMin, xMax, yMax, zMax);
|
|
1934
|
-
return [
|
|
1935
|
-
[xMin.current, yMin.current, zMin.current],
|
|
1936
|
-
[xMax.current, yMax.current, zMax.current]
|
|
1937
|
-
];
|
|
1938
|
-
}
|
|
1939
|
-
get center() {
|
|
1940
|
-
const [[xmin, ymin, zmin], [xmax, ymax, zmax]] = this.bounds;
|
|
1941
|
-
return [xmin + (xmax - xmin) / 2, ymin + (ymax - ymin) / 2, zmin + (zmax - zmin) / 2];
|
|
1942
|
-
}
|
|
1943
|
-
get width() {
|
|
1944
|
-
const [[xmin], [xmax]] = this.bounds;
|
|
1945
|
-
return Math.abs(xmax - xmin);
|
|
1946
|
-
}
|
|
1947
|
-
get height() {
|
|
1948
|
-
const [[, ymin], [, ymax]] = this.bounds;
|
|
1949
|
-
return Math.abs(ymax - ymin);
|
|
1950
|
-
}
|
|
1951
|
-
get depth() {
|
|
1952
|
-
const [[, , zmin], [, , zmax]] = this.bounds;
|
|
1953
|
-
return Math.abs(zmax - zmin);
|
|
1954
|
-
}
|
|
1955
|
-
add(other) {
|
|
1956
|
-
this.wrapped.Add_1(other.wrapped);
|
|
1578
|
+
origin = toVec3(sourceOrigin);
|
|
1957
1579
|
}
|
|
1958
|
-
|
|
1959
|
-
|
|
1580
|
+
return ok(createPlane(origin, config.xDir, config.normal));
|
|
1581
|
+
}
|
|
1582
|
+
function resolvePlane(input, origin) {
|
|
1583
|
+
if (typeof input === "string") {
|
|
1584
|
+
const result = createNamedPlane(input, origin);
|
|
1585
|
+
if (!result.ok) throw new Error(result.error.message);
|
|
1586
|
+
return result.value;
|
|
1960
1587
|
}
|
|
1588
|
+
return input;
|
|
1589
|
+
}
|
|
1590
|
+
function planeToWorld(plane, local) {
|
|
1591
|
+
const [u, v] = local;
|
|
1592
|
+
return vecAdd(vecAdd(plane.origin, vecScale(plane.xDir, u)), vecScale(plane.yDir, v));
|
|
1593
|
+
}
|
|
1594
|
+
function planeToLocal(plane, world) {
|
|
1595
|
+
const relative = vecSub(world, plane.origin);
|
|
1596
|
+
return [vecDot(relative, plane.xDir), vecDot(relative, plane.yDir)];
|
|
1597
|
+
}
|
|
1598
|
+
function translatePlane(plane, offset2) {
|
|
1599
|
+
return { ...plane, origin: vecAdd(plane.origin, offset2) };
|
|
1600
|
+
}
|
|
1601
|
+
function pivotPlane(plane, angleDeg, axis = [1, 0, 0]) {
|
|
1602
|
+
const angleRad = angleDeg * DEG2RAD;
|
|
1603
|
+
const newZDir = vecRotate(plane.zDir, axis, angleRad);
|
|
1604
|
+
const newXDir = vecRotate(plane.xDir, axis, angleRad);
|
|
1605
|
+
const newYDir = vecNormalize(vecCross(newZDir, newXDir));
|
|
1606
|
+
return { origin: plane.origin, xDir: newXDir, yDir: newYDir, zDir: newZDir };
|
|
1961
1607
|
}
|
|
1962
1608
|
const makePlaneFromFace = (face, originOnSurface = [0, 0]) => {
|
|
1963
|
-
const
|
|
1964
|
-
const
|
|
1965
|
-
const
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
};
|
|
1977
|
-
function makePlane(plane = "XY", origin = [0, 0, 0]) {
|
|
1978
|
-
if (plane instanceof Plane) {
|
|
1979
|
-
return plane.clone();
|
|
1609
|
+
const originPoint = face.pointOnSurface(...originOnSurface);
|
|
1610
|
+
const normal = face.normalAt(originPoint);
|
|
1611
|
+
const ref = [0, 0, 1];
|
|
1612
|
+
let xd = vecCross(ref, normal);
|
|
1613
|
+
if (vecLength(xd) < 1e-8) {
|
|
1614
|
+
xd = [1, 0, 0];
|
|
1615
|
+
}
|
|
1616
|
+
xd = vecNormalize(xd);
|
|
1617
|
+
return createPlane(originPoint, xd, normal);
|
|
1618
|
+
};
|
|
1619
|
+
function makePlane(plane, origin) {
|
|
1620
|
+
if (plane && typeof plane !== "string") {
|
|
1621
|
+
return { ...plane };
|
|
1980
1622
|
} else {
|
|
1981
|
-
return
|
|
1623
|
+
return resolvePlane(plane ?? "XY", origin);
|
|
1982
1624
|
}
|
|
1983
1625
|
}
|
|
1984
1626
|
function rotate(shape, angle, position = [0, 0, 0], direction = [0, 0, 1]) {
|
|
1627
|
+
const oc = getKernel().oc;
|
|
1985
1628
|
const [r, gc] = localGC();
|
|
1986
|
-
const
|
|
1987
|
-
|
|
1988
|
-
const
|
|
1629
|
+
const posVec = toVec3(position);
|
|
1630
|
+
const dirVec = toVec3(direction);
|
|
1631
|
+
const ax = r(makeOcAx1(posVec, dirVec));
|
|
1632
|
+
const trsf = r(new oc.gp_Trsf_1());
|
|
1633
|
+
trsf.SetRotation_1(ax, angle * DEG2RAD);
|
|
1634
|
+
const transformer = r(new oc.BRepBuilderAPI_Transform_2(shape, trsf, true));
|
|
1635
|
+
const newShape = transformer.ModifiedShape(shape);
|
|
1989
1636
|
gc();
|
|
1990
1637
|
return newShape;
|
|
1991
1638
|
}
|
|
1992
1639
|
function translate(shape, vector) {
|
|
1640
|
+
const oc = getKernel().oc;
|
|
1993
1641
|
const [r, gc] = localGC();
|
|
1994
|
-
const
|
|
1995
|
-
|
|
1996
|
-
const
|
|
1642
|
+
const vecArr = toVec3(vector);
|
|
1643
|
+
const ocVec = r(toOcVec(vecArr));
|
|
1644
|
+
const trsf = r(new oc.gp_Trsf_1());
|
|
1645
|
+
trsf.SetTranslation_1(ocVec);
|
|
1646
|
+
const transformer = r(new oc.BRepBuilderAPI_Transform_2(shape, trsf, true));
|
|
1647
|
+
const newShape = transformer.ModifiedShape(shape);
|
|
1997
1648
|
gc();
|
|
1998
1649
|
return newShape;
|
|
1999
1650
|
}
|
|
2000
1651
|
function mirror(shape, inputPlane, origin) {
|
|
1652
|
+
const oc = getKernel().oc;
|
|
2001
1653
|
const [r, gc] = localGC();
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
1654
|
+
let originVec;
|
|
1655
|
+
let directionVec;
|
|
1656
|
+
if (typeof inputPlane === "string") {
|
|
1657
|
+
const plane = resolvePlane(inputPlane, origin);
|
|
1658
|
+
originVec = plane.origin;
|
|
1659
|
+
directionVec = plane.zDir;
|
|
1660
|
+
} else if (inputPlane && typeof inputPlane === "object" && "origin" in inputPlane && "zDir" in inputPlane) {
|
|
1661
|
+
originVec = origin ? toVec3(origin) : inputPlane.origin;
|
|
1662
|
+
directionVec = inputPlane.zDir;
|
|
1663
|
+
} else if (inputPlane) {
|
|
1664
|
+
originVec = origin ? toVec3(origin) : [0, 0, 0];
|
|
1665
|
+
directionVec = toVec3(inputPlane);
|
|
1666
|
+
} else {
|
|
1667
|
+
const plane = resolvePlane("YZ", origin);
|
|
1668
|
+
originVec = plane.origin;
|
|
1669
|
+
directionVec = plane.zDir;
|
|
1670
|
+
}
|
|
1671
|
+
const mirrorAxis = r(makeOcAx2(originVec, directionVec));
|
|
1672
|
+
const trsf = r(new oc.gp_Trsf_1());
|
|
1673
|
+
trsf.SetMirror_3(mirrorAxis);
|
|
1674
|
+
const transformer = r(new oc.BRepBuilderAPI_Transform_2(shape, trsf, true));
|
|
1675
|
+
const newShape = transformer.ModifiedShape(shape);
|
|
2005
1676
|
gc();
|
|
2006
1677
|
return newShape;
|
|
2007
1678
|
}
|
|
2008
1679
|
function scale(shape, center, scaleFactor) {
|
|
1680
|
+
const oc = getKernel().oc;
|
|
2009
1681
|
const [r, gc] = localGC();
|
|
2010
|
-
const
|
|
2011
|
-
|
|
2012
|
-
const
|
|
1682
|
+
const centerVec = toVec3(center);
|
|
1683
|
+
const pnt2 = r(toOcPnt(centerVec));
|
|
1684
|
+
const trsf = r(new oc.gp_Trsf_1());
|
|
1685
|
+
trsf.SetScale(pnt2, scaleFactor);
|
|
1686
|
+
const transformer = r(new oc.BRepBuilderAPI_Transform_2(shape, trsf, true));
|
|
1687
|
+
const newShape = transformer.ModifiedShape(shape);
|
|
2013
1688
|
gc();
|
|
2014
1689
|
return newShape;
|
|
2015
1690
|
}
|
|
@@ -2519,11 +2194,6 @@ class Shape extends WrappingObj {
|
|
|
2519
2194
|
get wires() {
|
|
2520
2195
|
return this._listTopo("wire").map((e) => new Wire(e));
|
|
2521
2196
|
}
|
|
2522
|
-
get boundingBox() {
|
|
2523
|
-
const bbox = new BoundingBox();
|
|
2524
|
-
this.oc.BRepBndLib.Add(this.wrapped, bbox.wrapped, true);
|
|
2525
|
-
return bbox;
|
|
2526
|
-
}
|
|
2527
2197
|
_mesh({ tolerance = 1e-3, angularTolerance = 0.1 } = {}) {
|
|
2528
2198
|
const mesher = new this.oc.BRepMesh_IncrementalMesh_2(
|
|
2529
2199
|
this.wrapped,
|
|
@@ -2639,9 +2309,7 @@ class Vertex extends Shape {
|
|
|
2639
2309
|
class Curve extends WrappingObj {
|
|
2640
2310
|
get repr() {
|
|
2641
2311
|
const { startPoint, endPoint } = this;
|
|
2642
|
-
const retVal = `start: (${startPoint
|
|
2643
|
-
startPoint.delete();
|
|
2644
|
-
endPoint.delete();
|
|
2312
|
+
const retVal = `start: (${vecRepr(startPoint)}) end:(${vecRepr(endPoint)})`;
|
|
2645
2313
|
return retVal;
|
|
2646
2314
|
}
|
|
2647
2315
|
get curveType() {
|
|
@@ -2650,11 +2318,15 @@ class Curve extends WrappingObj {
|
|
|
2650
2318
|
}
|
|
2651
2319
|
get startPoint() {
|
|
2652
2320
|
const umin = this.wrapped.Value(this.wrapped.FirstParameter());
|
|
2653
|
-
|
|
2321
|
+
const result = fromOcPnt(umin);
|
|
2322
|
+
umin.delete();
|
|
2323
|
+
return result;
|
|
2654
2324
|
}
|
|
2655
2325
|
get endPoint() {
|
|
2656
2326
|
const umax = this.wrapped.Value(this.wrapped.LastParameter());
|
|
2657
|
-
|
|
2327
|
+
const result = fromOcPnt(umax);
|
|
2328
|
+
umax.delete();
|
|
2329
|
+
return result;
|
|
2658
2330
|
}
|
|
2659
2331
|
_mapParameter(position) {
|
|
2660
2332
|
const firstParam = this.wrapped.FirstParameter();
|
|
@@ -2662,14 +2334,17 @@ class Curve extends WrappingObj {
|
|
|
2662
2334
|
return firstParam + (lastParam - firstParam) * position;
|
|
2663
2335
|
}
|
|
2664
2336
|
pointAt(position = 0.5) {
|
|
2665
|
-
|
|
2337
|
+
const pnt2 = this.wrapped.Value(this._mapParameter(position));
|
|
2338
|
+
const result = fromOcPnt(pnt2);
|
|
2339
|
+
pnt2.delete();
|
|
2340
|
+
return result;
|
|
2666
2341
|
}
|
|
2667
2342
|
tangentAt(position = 0.5) {
|
|
2668
2343
|
const pos = this._mapParameter(position);
|
|
2669
2344
|
const tmp = new this.oc.gp_Pnt_1();
|
|
2670
2345
|
const res = new this.oc.gp_Vec_1();
|
|
2671
2346
|
this.wrapped.D1(pos, tmp, res);
|
|
2672
|
-
const tangent =
|
|
2347
|
+
const tangent = fromOcVec(res);
|
|
2673
2348
|
tmp.delete();
|
|
2674
2349
|
res.delete();
|
|
2675
2350
|
return tangent;
|
|
@@ -2687,9 +2362,7 @@ class Curve extends WrappingObj {
|
|
|
2687
2362
|
class _1DShape extends Shape {
|
|
2688
2363
|
get repr() {
|
|
2689
2364
|
const { startPoint, endPoint } = this;
|
|
2690
|
-
const retVal = `start: (${startPoint
|
|
2691
|
-
startPoint.delete();
|
|
2692
|
-
endPoint.delete();
|
|
2365
|
+
const retVal = `start: (${vecRepr(startPoint)}) end:(${vecRepr(endPoint)})`;
|
|
2693
2366
|
return retVal;
|
|
2694
2367
|
}
|
|
2695
2368
|
get curve() {
|
|
@@ -2859,7 +2532,7 @@ class Face extends Shape {
|
|
|
2859
2532
|
const absoluteU = u * (uMax - uMin) + uMin;
|
|
2860
2533
|
const absoluteV = v * (vMax - vMin) + vMin;
|
|
2861
2534
|
surface.D0(absoluteU, absoluteV, p);
|
|
2862
|
-
const point =
|
|
2535
|
+
const point = fromOcPnt(p);
|
|
2863
2536
|
surface.delete();
|
|
2864
2537
|
p.delete();
|
|
2865
2538
|
return point;
|
|
@@ -2869,7 +2542,7 @@ class Face extends Shape {
|
|
|
2869
2542
|
const surface = r(this.oc.BRep_Tool.Surface_2(this.wrapped));
|
|
2870
2543
|
const projectedPoint = r(
|
|
2871
2544
|
new this.oc.GeomAPI_ProjectPointOnSurf_2(
|
|
2872
|
-
r(
|
|
2545
|
+
r(toOcPnt(toVec3(point))),
|
|
2873
2546
|
surface,
|
|
2874
2547
|
this.oc.Extrema_ExtAlgo.Extrema_ExtAlgo_Grad
|
|
2875
2548
|
)
|
|
@@ -2894,13 +2567,15 @@ class Face extends Shape {
|
|
|
2894
2567
|
const vn = r(new this.oc.gp_Vec_1());
|
|
2895
2568
|
const props = r(new this.oc.BRepGProp_Face_2(this.wrapped, false));
|
|
2896
2569
|
props.Normal(u, v, p, vn);
|
|
2897
|
-
const normal =
|
|
2570
|
+
const normal = fromOcVec(vn);
|
|
2898
2571
|
return normal;
|
|
2899
2572
|
}
|
|
2900
2573
|
get center() {
|
|
2901
2574
|
const properties = new this.oc.GProp_GProps_1();
|
|
2902
2575
|
this.oc.BRepGProp.SurfaceProperties_2(this.wrapped, properties, 1e-7, true);
|
|
2903
|
-
const
|
|
2576
|
+
const centerPnt = properties.CentreOfMass();
|
|
2577
|
+
const center = fromOcPnt(centerPnt);
|
|
2578
|
+
centerPnt.delete();
|
|
2904
2579
|
properties.delete();
|
|
2905
2580
|
return center;
|
|
2906
2581
|
}
|
|
@@ -3239,8 +2914,8 @@ function zip(arrays) {
|
|
|
3239
2914
|
const makeLine = (v1, v2) => {
|
|
3240
2915
|
const oc = getKernel().oc;
|
|
3241
2916
|
const [r, gc] = localGC();
|
|
3242
|
-
const p1 = r(
|
|
3243
|
-
const p2 = r(
|
|
2917
|
+
const p1 = r(toOcPnt(v1));
|
|
2918
|
+
const p2 = r(toOcPnt(v2));
|
|
3244
2919
|
const maker = r(new oc.BRepBuilderAPI_MakeEdge_3(p1, p2));
|
|
3245
2920
|
const edge = new Edge(maker.Edge());
|
|
3246
2921
|
gc();
|
|
@@ -3249,7 +2924,7 @@ const makeLine = (v1, v2) => {
|
|
|
3249
2924
|
const makeCircle = (radius, center = [0, 0, 0], normal = [0, 0, 1]) => {
|
|
3250
2925
|
const oc = getKernel().oc;
|
|
3251
2926
|
const [r, gc] = localGC();
|
|
3252
|
-
const ax = r(
|
|
2927
|
+
const ax = r(makeOcAx2(center, normal));
|
|
3253
2928
|
const circleGp = r(new oc.gp_Circ_2(ax, radius));
|
|
3254
2929
|
const edgeMaker = r(new oc.BRepBuilderAPI_MakeEdge_8(circleGp));
|
|
3255
2930
|
const shape = new Edge(edgeMaker.Edge());
|
|
@@ -3259,7 +2934,7 @@ const makeCircle = (radius, center = [0, 0, 0], normal = [0, 0, 1]) => {
|
|
|
3259
2934
|
const makeEllipse = (majorRadius, minorRadius, center = [0, 0, 0], normal = [0, 0, 1], xDir) => {
|
|
3260
2935
|
const oc = getKernel().oc;
|
|
3261
2936
|
const [r, gc] = localGC();
|
|
3262
|
-
const ax = r(
|
|
2937
|
+
const ax = r(makeOcAx2(center, normal, xDir));
|
|
3263
2938
|
if (minorRadius > majorRadius) {
|
|
3264
2939
|
gc();
|
|
3265
2940
|
return err(
|
|
@@ -3286,7 +2961,7 @@ const makeHelix = (pitch, height, radius, center = [0, 0, 0], dir = [0, 0, 1], l
|
|
|
3286
2961
|
const uStart = r(geomLine.Value(0));
|
|
3287
2962
|
const uStop = r(geomLine.Value(nTurns * Math.sqrt((2 * Math.PI) ** 2 + pitch ** 2)));
|
|
3288
2963
|
const geomSeg = r(new oc.GCE2d_MakeSegment_1(uStart, uStop));
|
|
3289
|
-
const geomSurf = new oc.Geom_CylindricalSurface_1(r(
|
|
2964
|
+
const geomSurf = new oc.Geom_CylindricalSurface_1(r(makeOcAx3(center, dir)), radius);
|
|
3290
2965
|
const e = r(
|
|
3291
2966
|
new oc.BRepBuilderAPI_MakeEdge_30(
|
|
3292
2967
|
r(new oc.Handle_Geom2d_Curve_2(geomSeg.Value().get())),
|
|
@@ -3301,9 +2976,9 @@ const makeHelix = (pitch, height, radius, center = [0, 0, 0], dir = [0, 0, 1], l
|
|
|
3301
2976
|
const makeThreePointArc = (v1, v2, v3) => {
|
|
3302
2977
|
const oc = getKernel().oc;
|
|
3303
2978
|
const [r, gc] = localGC();
|
|
3304
|
-
const p1 = r(
|
|
3305
|
-
const p2 = r(
|
|
3306
|
-
const p3 = r(
|
|
2979
|
+
const p1 = r(toOcPnt(v1));
|
|
2980
|
+
const p2 = r(toOcPnt(v2));
|
|
2981
|
+
const p3 = r(toOcPnt(v3));
|
|
3307
2982
|
const arcMaker = r(new oc.GC_MakeArcOfCircle_4(p1, p2, p3));
|
|
3308
2983
|
const circleGeom = r(arcMaker.Value());
|
|
3309
2984
|
const curve = r(new oc.Handle_Geom_Curve_2(circleGeom.get()));
|
|
@@ -3315,7 +2990,7 @@ const makeThreePointArc = (v1, v2, v3) => {
|
|
|
3315
2990
|
const makeEllipseArc = (majorRadius, minorRadius, startAngle, endAngle, center = [0, 0, 0], normal = [0, 0, 1], xDir) => {
|
|
3316
2991
|
const oc = getKernel().oc;
|
|
3317
2992
|
const [r, gc] = localGC();
|
|
3318
|
-
const ax = r(
|
|
2993
|
+
const ax = r(makeOcAx2(center, normal, xDir));
|
|
3319
2994
|
if (minorRadius > majorRadius) {
|
|
3320
2995
|
gc();
|
|
3321
2996
|
return err(
|
|
@@ -3333,7 +3008,7 @@ const makeBSplineApproximation = function makeBSplineApproximation2(points, { to
|
|
|
3333
3008
|
const [r, gc] = localGC();
|
|
3334
3009
|
const pnts = r(new oc.TColgp_Array1OfPnt_2(1, points.length));
|
|
3335
3010
|
points.forEach((point, index) => {
|
|
3336
|
-
pnts.SetValue(index + 1, r(
|
|
3011
|
+
pnts.SetValue(index + 1, r(toOcPnt(point)));
|
|
3337
3012
|
});
|
|
3338
3013
|
let splineBuilder;
|
|
3339
3014
|
if (smoothing) {
|
|
@@ -3377,7 +3052,7 @@ const makeBezierCurve = (points) => {
|
|
|
3377
3052
|
const [r, gc] = localGC();
|
|
3378
3053
|
const arrayOfPoints = r(new oc.TColgp_Array1OfPnt_2(1, points.length));
|
|
3379
3054
|
points.forEach((p, i) => {
|
|
3380
|
-
arrayOfPoints.SetValue(i + 1, r(
|
|
3055
|
+
arrayOfPoints.SetValue(i + 1, r(toOcPnt(p)));
|
|
3381
3056
|
});
|
|
3382
3057
|
const bezCurve = new oc.Geom_BezierCurve_1(arrayOfPoints);
|
|
3383
3058
|
const curve = r(new oc.Handle_Geom_Curve_2(bezCurve));
|
|
@@ -3391,9 +3066,9 @@ const makeTangentArc = (startPoint, startTgt, endPoint) => {
|
|
|
3391
3066
|
const [r, gc] = localGC();
|
|
3392
3067
|
const circleGeom = r(
|
|
3393
3068
|
new oc.GC_MakeArcOfCircle_5(
|
|
3394
|
-
r(
|
|
3395
|
-
r(
|
|
3396
|
-
r(
|
|
3069
|
+
r(toOcPnt(startPoint)),
|
|
3070
|
+
r(toOcVec(startTgt)),
|
|
3071
|
+
r(toOcPnt(endPoint))
|
|
3397
3072
|
).Value()
|
|
3398
3073
|
);
|
|
3399
3074
|
const curve = r(new oc.Handle_Geom_Curve_2(circleGeom.get()));
|
|
@@ -3485,7 +3160,7 @@ const makeNonPlanarFace = (wire) => {
|
|
|
3485
3160
|
const makeCylinder = (radius, height, location = [0, 0, 0], direction = [0, 0, 1]) => {
|
|
3486
3161
|
const oc = getKernel().oc;
|
|
3487
3162
|
const [r, gc] = localGC();
|
|
3488
|
-
const axis = r(
|
|
3163
|
+
const axis = r(makeOcAx2(location, direction));
|
|
3489
3164
|
const cylinder = r(new oc.BRepPrimAPI_MakeCylinder_3(axis, radius, height));
|
|
3490
3165
|
const solid = new Solid(cylinder.Shape());
|
|
3491
3166
|
gc();
|
|
@@ -3506,9 +3181,9 @@ class EllipsoidTransform extends WrappingObj {
|
|
|
3506
3181
|
const xyRatio = Math.sqrt(x * y / z);
|
|
3507
3182
|
const xzRatio = x / xyRatio;
|
|
3508
3183
|
const yzRatio = y / xyRatio;
|
|
3509
|
-
const ax1 = r(
|
|
3510
|
-
const ax2 = r(
|
|
3511
|
-
const ax3 = r(
|
|
3184
|
+
const ax1 = r(makeOcAx1([0, 0, 0], [0, 1, 0]));
|
|
3185
|
+
const ax2 = r(makeOcAx1([0, 0, 0], [0, 0, 1]));
|
|
3186
|
+
const ax3 = r(makeOcAx1([0, 0, 0], [1, 0, 0]));
|
|
3512
3187
|
const transform2 = new oc.gp_GTrsf_1();
|
|
3513
3188
|
transform2.SetAffinity_1(ax1, xzRatio);
|
|
3514
3189
|
const xy = r(new oc.gp_GTrsf_1());
|
|
@@ -3567,8 +3242,8 @@ const makeEllipsoid = (aLength, bLength, cLength) => {
|
|
|
3567
3242
|
const makeBox = (corner1, corner2) => {
|
|
3568
3243
|
const oc = getKernel().oc;
|
|
3569
3244
|
const [r, gc] = localGC();
|
|
3570
|
-
const p1 = r(
|
|
3571
|
-
const p2 = r(
|
|
3245
|
+
const p1 = r(toOcPnt(corner1));
|
|
3246
|
+
const p2 = r(toOcPnt(corner2));
|
|
3572
3247
|
const boxMaker = r(new oc.BRepPrimAPI_MakeBox_4(p1, p2));
|
|
3573
3248
|
const box = new Solid(boxMaker.Solid());
|
|
3574
3249
|
gc();
|
|
@@ -3577,7 +3252,7 @@ const makeBox = (corner1, corner2) => {
|
|
|
3577
3252
|
const makeVertex = (point) => {
|
|
3578
3253
|
const oc = getKernel().oc;
|
|
3579
3254
|
const [r, gc] = localGC();
|
|
3580
|
-
const pnt2 = r(
|
|
3255
|
+
const pnt2 = r(toOcPnt(point));
|
|
3581
3256
|
const vertexMaker = r(new oc.BRepBuilderAPI_MakeVertex(pnt2));
|
|
3582
3257
|
const vertex = vertexMaker.Vertex();
|
|
3583
3258
|
gc();
|
|
@@ -4281,9 +3956,9 @@ function buildLawFromProfile(extrusionLength, { profile, endFactor = 1 }) {
|
|
|
4281
3956
|
const basicFaceExtrusion = (face, extrusionVec) => {
|
|
4282
3957
|
const oc = getKernel().oc;
|
|
4283
3958
|
const [r, gc] = localGC();
|
|
4284
|
-
const
|
|
4285
|
-
|
|
4286
|
-
);
|
|
3959
|
+
const vec2 = toVec3(extrusionVec);
|
|
3960
|
+
const ocVec = r(new oc.gp_Vec_4(vec2[0], vec2[1], vec2[2]));
|
|
3961
|
+
const solidBuilder = r(new oc.BRepPrimAPI_MakePrism_1(face.wrapped, ocVec, false, true));
|
|
4287
3962
|
const solid = new Solid(unwrap(downcast(solidBuilder.Shape())));
|
|
4288
3963
|
gc();
|
|
4289
3964
|
return solid;
|
|
@@ -4291,7 +3966,9 @@ const basicFaceExtrusion = (face, extrusionVec) => {
|
|
|
4291
3966
|
const revolution = (face, center = [0, 0, 0], direction = [0, 0, 1], angle = 360) => {
|
|
4292
3967
|
const oc = getKernel().oc;
|
|
4293
3968
|
const [r, gc] = localGC();
|
|
4294
|
-
const
|
|
3969
|
+
const centerVec = toVec3(center);
|
|
3970
|
+
const directionVec = toVec3(direction);
|
|
3971
|
+
const ax = r(makeOcAx1(centerVec, directionVec));
|
|
4295
3972
|
const revolBuilder = r(new oc.BRepPrimAPI_MakeRevol_1(face.wrapped, ax, angle * DEG2RAD, false));
|
|
4296
3973
|
const result = andThen(cast(revolBuilder.Shape()), (shape) => {
|
|
4297
3974
|
if (!isShape3D$2(shape))
|
|
@@ -4365,9 +4042,9 @@ function genericSweep(wire, spine, {
|
|
|
4365
4042
|
}
|
|
4366
4043
|
const supportExtrude$1 = (wire, center, normal, support) => {
|
|
4367
4044
|
const [r, gc] = localGC();
|
|
4368
|
-
const centerVec =
|
|
4369
|
-
const normalVec =
|
|
4370
|
-
const endVec =
|
|
4045
|
+
const centerVec = toVec3(center);
|
|
4046
|
+
const normalVec = toVec3(normal);
|
|
4047
|
+
const endVec = vecAdd(centerVec, normalVec);
|
|
4371
4048
|
const mainSpineEdge = r(makeLine(centerVec, endVec));
|
|
4372
4049
|
const spine = r(unwrap(assembleWire$1([mainSpineEdge])));
|
|
4373
4050
|
const result = genericSweep(wire, spine, { support });
|
|
@@ -4376,27 +4053,27 @@ const supportExtrude$1 = (wire, center, normal, support) => {
|
|
|
4376
4053
|
};
|
|
4377
4054
|
function complexExtrude$1(wire, center, normal, profileShape, shellMode = false) {
|
|
4378
4055
|
const [r, gc] = localGC();
|
|
4379
|
-
const centerVec =
|
|
4380
|
-
const normalVec =
|
|
4381
|
-
const endVec =
|
|
4056
|
+
const centerVec = toVec3(center);
|
|
4057
|
+
const normalVec = toVec3(normal);
|
|
4058
|
+
const endVec = vecAdd(centerVec, normalVec);
|
|
4382
4059
|
const mainSpineEdge = r(makeLine(centerVec, endVec));
|
|
4383
4060
|
const spine = r(unwrap(assembleWire$1([mainSpineEdge])));
|
|
4384
|
-
const law = profileShape ? r(unwrap(buildLawFromProfile(normalVec
|
|
4061
|
+
const law = profileShape ? r(unwrap(buildLawFromProfile(vecLength(normalVec), profileShape))) : null;
|
|
4385
4062
|
const result = shellMode ? genericSweep(wire, spine, { law }, shellMode) : genericSweep(wire, spine, { law }, shellMode);
|
|
4386
4063
|
gc();
|
|
4387
4064
|
return result;
|
|
4388
4065
|
}
|
|
4389
4066
|
function twistExtrude$1(wire, angleDegrees, center, normal, profileShape, shellMode = false) {
|
|
4390
4067
|
const [r, gc] = localGC();
|
|
4391
|
-
const centerVec =
|
|
4392
|
-
const normalVec =
|
|
4393
|
-
const endVec =
|
|
4068
|
+
const centerVec = toVec3(center);
|
|
4069
|
+
const normalVec = toVec3(normal);
|
|
4070
|
+
const endVec = vecAdd(centerVec, normalVec);
|
|
4394
4071
|
const mainSpineEdge = r(makeLine(centerVec, endVec));
|
|
4395
4072
|
const spine = r(unwrap(assembleWire$1([mainSpineEdge])));
|
|
4396
|
-
const extrusionLength = normalVec
|
|
4073
|
+
const extrusionLength = vecLength(normalVec);
|
|
4397
4074
|
const pitch = 360 / angleDegrees * extrusionLength;
|
|
4398
4075
|
const radius = 1;
|
|
4399
|
-
const auxiliarySpine = r(makeHelix(pitch, extrusionLength, radius,
|
|
4076
|
+
const auxiliarySpine = r(makeHelix(pitch, extrusionLength, radius, centerVec, normalVec));
|
|
4400
4077
|
const law = profileShape ? r(unwrap(buildLawFromProfile(extrusionLength, profileShape))) : null;
|
|
4401
4078
|
const result = shellMode ? genericSweep(wire, spine, { auxiliarySpine, law }, shellMode) : genericSweep(wire, spine, { auxiliarySpine, law }, shellMode);
|
|
4402
4079
|
gc();
|
|
@@ -4407,11 +4084,11 @@ const loft = (wires, { ruled = true, startPoint, endPoint } = {}, returnShell =
|
|
|
4407
4084
|
const [r, gc] = localGC();
|
|
4408
4085
|
const loftBuilder = r(new oc.BRepOffsetAPI_ThruSections(!returnShell, ruled, 1e-6));
|
|
4409
4086
|
if (startPoint) {
|
|
4410
|
-
loftBuilder.AddVertex(r(makeVertex(startPoint)).wrapped);
|
|
4087
|
+
loftBuilder.AddVertex(r(makeVertex(toVec3(startPoint))).wrapped);
|
|
4411
4088
|
}
|
|
4412
4089
|
wires.forEach((w) => loftBuilder.AddWire(w.wrapped));
|
|
4413
4090
|
if (endPoint) {
|
|
4414
|
-
loftBuilder.AddVertex(r(makeVertex(endPoint)).wrapped);
|
|
4091
|
+
loftBuilder.AddVertex(r(makeVertex(toVec3(endPoint))).wrapped);
|
|
4415
4092
|
}
|
|
4416
4093
|
const progress = r(new oc.Message_ProgressRange_1());
|
|
4417
4094
|
loftBuilder.Build(progress);
|
|
@@ -5886,7 +5563,7 @@ const curvesBoundingBox = (curves) => {
|
|
|
5886
5563
|
};
|
|
5887
5564
|
function curvesAsEdgesOnPlane(curves, plane) {
|
|
5888
5565
|
const [r, gc] = localGC();
|
|
5889
|
-
const ax = r(
|
|
5566
|
+
const ax = r(makeOcAx2(plane.origin, plane.zDir, plane.xDir));
|
|
5890
5567
|
const oc = getKernel().oc;
|
|
5891
5568
|
const edges = curves.map((curve) => {
|
|
5892
5569
|
const curve3d = r(oc.GeomLib.To3d(ax, curve.wrapped));
|
|
@@ -6132,7 +5809,7 @@ class Finder {
|
|
|
6132
5809
|
}
|
|
6133
5810
|
const makeVertexOc = (point) => {
|
|
6134
5811
|
const oc = getKernel().oc;
|
|
6135
|
-
const pnt2 =
|
|
5812
|
+
const pnt2 = toOcPnt(toVec3(point));
|
|
6136
5813
|
const vertexMaker = new oc.BRepBuilderAPI_MakeVertex(pnt2);
|
|
6137
5814
|
const vertex = vertexMaker.Vertex();
|
|
6138
5815
|
vertexMaker.delete();
|
|
@@ -6141,8 +5818,8 @@ const makeVertexOc = (point) => {
|
|
|
6141
5818
|
};
|
|
6142
5819
|
const makeBoxOc = (corner1, corner2) => {
|
|
6143
5820
|
const oc = getKernel().oc;
|
|
6144
|
-
const p1 =
|
|
6145
|
-
const p2 =
|
|
5821
|
+
const p1 = toOcPnt(toVec3(corner1));
|
|
5822
|
+
const p2 = toOcPnt(toVec3(corner2));
|
|
6146
5823
|
const boxMaker = new oc.BRepPrimAPI_MakeBox_4(p1, p2);
|
|
6147
5824
|
const solid = boxMaker.Solid();
|
|
6148
5825
|
boxMaker.delete();
|
|
@@ -6214,13 +5891,14 @@ class Finder3d extends Finder {
|
|
|
6214
5891
|
atAngleWith(direction = "Z", angle = 0) {
|
|
6215
5892
|
let myDirection;
|
|
6216
5893
|
if (typeof direction === "string") {
|
|
6217
|
-
myDirection =
|
|
5894
|
+
myDirection = toVec3(DIRECTIONS$1[direction]);
|
|
6218
5895
|
} else {
|
|
6219
|
-
myDirection =
|
|
5896
|
+
myDirection = toVec3(direction);
|
|
6220
5897
|
}
|
|
5898
|
+
const normalizedDirection = vecNormalize(myDirection);
|
|
6221
5899
|
const checkAngle = ({ normal }) => {
|
|
6222
5900
|
if (!normal) return false;
|
|
6223
|
-
const angleOfNormal = Math.acos(Math.abs(normal
|
|
5901
|
+
const angleOfNormal = Math.acos(Math.abs(vecDot(normal, normalizedDirection)));
|
|
6224
5902
|
return Math.abs(angleOfNormal - DEG2RAD * angle) < 1e-6;
|
|
6225
5903
|
};
|
|
6226
5904
|
this.filters.push(checkAngle);
|
|
@@ -6303,15 +5981,13 @@ class FaceFinder extends Finder3d {
|
|
|
6303
5981
|
* @category Filter
|
|
6304
5982
|
*/
|
|
6305
5983
|
parallelTo(plane) {
|
|
6306
|
-
const [r, gc] = localGC();
|
|
6307
5984
|
if (typeof plane === "string") return this.atAngleWith(PLANE_TO_DIR[plane]);
|
|
6308
|
-
if (typeof plane !== "string" &&
|
|
5985
|
+
if (typeof plane !== "string" && "zDir" in plane) {
|
|
6309
5986
|
return this.atAngleWith(plane.zDir);
|
|
5987
|
+
}
|
|
6310
5988
|
if (typeof plane !== "string" && "normalAt" in plane) {
|
|
6311
|
-
const normal =
|
|
6312
|
-
|
|
6313
|
-
gc();
|
|
6314
|
-
return this.atAngleWith(normalPoint);
|
|
5989
|
+
const normal = plane.normalAt();
|
|
5990
|
+
return this.atAngleWith(normal);
|
|
6315
5991
|
}
|
|
6316
5992
|
return this;
|
|
6317
5993
|
}
|
|
@@ -6335,24 +6011,20 @@ class FaceFinder extends Finder3d {
|
|
|
6335
6011
|
* @category Filter
|
|
6336
6012
|
*/
|
|
6337
6013
|
inPlane(inputPlane, origin) {
|
|
6338
|
-
const plane = inputPlane
|
|
6014
|
+
const plane = typeof inputPlane === "string" ? resolvePlane(inputPlane, origin) : inputPlane;
|
|
6339
6015
|
this.parallelTo(plane);
|
|
6340
6016
|
const centerInPlane = ({ element }) => {
|
|
6341
|
-
const [r, gc] = localGC();
|
|
6342
6017
|
const center = element.center;
|
|
6343
|
-
const projected =
|
|
6344
|
-
const result = center
|
|
6345
|
-
gc();
|
|
6018
|
+
const projected = vecProjectToPlane(center, plane.origin, plane.zDir);
|
|
6019
|
+
const result = vecEquals(center, projected);
|
|
6346
6020
|
return result;
|
|
6347
6021
|
};
|
|
6348
6022
|
this.filters.push(centerInPlane);
|
|
6349
6023
|
return this;
|
|
6350
6024
|
}
|
|
6351
6025
|
shouldKeep(element) {
|
|
6352
|
-
const
|
|
6353
|
-
const normal = r(element.normalAt());
|
|
6026
|
+
const normal = element.normalAt();
|
|
6354
6027
|
const shouldKeep = this.filters.every((filter) => filter({ normal, element }));
|
|
6355
|
-
gc();
|
|
6356
6028
|
return shouldKeep;
|
|
6357
6029
|
}
|
|
6358
6030
|
applyFilter(shape) {
|
|
@@ -6446,7 +6118,7 @@ class Blueprint {
|
|
|
6446
6118
|
return new Blueprint(curves);
|
|
6447
6119
|
}
|
|
6448
6120
|
sketchOnPlane(inputPlane, origin) {
|
|
6449
|
-
const plane = inputPlane
|
|
6121
|
+
const plane = inputPlane && typeof inputPlane !== "string" ? { ...inputPlane } : makePlane(inputPlane, origin);
|
|
6450
6122
|
const edges = curvesAsEdgesOnPlane(this.curves, plane);
|
|
6451
6123
|
const wire = assembleWire(edges);
|
|
6452
6124
|
return {
|
|
@@ -6466,10 +6138,9 @@ class Blueprint {
|
|
|
6466
6138
|
return { wire, baseFace: face };
|
|
6467
6139
|
}
|
|
6468
6140
|
subFace(face, origin) {
|
|
6469
|
-
const
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
);
|
|
6141
|
+
const originPoint = origin || [...face.center];
|
|
6142
|
+
const originVec3 = toVec3(originPoint);
|
|
6143
|
+
const sketch = this.translate(face.uvCoordinates(originVec3)).sketchOnFace(face, "original");
|
|
6473
6144
|
return unwrap(makeFace(sketch.wire));
|
|
6474
6145
|
}
|
|
6475
6146
|
punchHole(shape, face, {
|
|
@@ -6789,12 +6460,10 @@ class Sketch {
|
|
|
6789
6460
|
/**
|
|
6790
6461
|
* @ignore
|
|
6791
6462
|
*/
|
|
6792
|
-
// @ts-expect-error initialised indirectly
|
|
6793
6463
|
_defaultOrigin;
|
|
6794
6464
|
/**
|
|
6795
6465
|
* @ignore
|
|
6796
6466
|
*/
|
|
6797
|
-
// @ts-expect-error initialised indirectly
|
|
6798
6467
|
_defaultDirection;
|
|
6799
6468
|
_baseFace;
|
|
6800
6469
|
constructor(wire, {
|
|
@@ -6802,8 +6471,8 @@ class Sketch {
|
|
|
6802
6471
|
defaultDirection = [0, 0, 1]
|
|
6803
6472
|
} = {}) {
|
|
6804
6473
|
this.wire = wire;
|
|
6805
|
-
this.
|
|
6806
|
-
this.
|
|
6474
|
+
this._defaultOrigin = toVec3(defaultOrigin);
|
|
6475
|
+
this._defaultDirection = toVec3(defaultDirection);
|
|
6807
6476
|
this.baseFace = null;
|
|
6808
6477
|
}
|
|
6809
6478
|
get baseFace() {
|
|
@@ -6815,8 +6484,6 @@ class Sketch {
|
|
|
6815
6484
|
}
|
|
6816
6485
|
delete() {
|
|
6817
6486
|
this.wire.delete();
|
|
6818
|
-
this._defaultOrigin.delete();
|
|
6819
|
-
this._defaultDirection.delete();
|
|
6820
6487
|
if (this.baseFace) this.baseFace.delete();
|
|
6821
6488
|
}
|
|
6822
6489
|
clone() {
|
|
@@ -6831,13 +6498,13 @@ class Sketch {
|
|
|
6831
6498
|
return this._defaultOrigin;
|
|
6832
6499
|
}
|
|
6833
6500
|
set defaultOrigin(newOrigin) {
|
|
6834
|
-
this._defaultOrigin =
|
|
6501
|
+
this._defaultOrigin = toVec3(newOrigin);
|
|
6835
6502
|
}
|
|
6836
6503
|
get defaultDirection() {
|
|
6837
6504
|
return this._defaultDirection;
|
|
6838
6505
|
}
|
|
6839
6506
|
set defaultDirection(newDirection) {
|
|
6840
|
-
this._defaultDirection =
|
|
6507
|
+
this._defaultDirection = toVec3(newDirection);
|
|
6841
6508
|
}
|
|
6842
6509
|
/**
|
|
6843
6510
|
* Transforms the lines into a face. The lines should be closed.
|
|
@@ -6884,13 +6551,13 @@ class Sketch {
|
|
|
6884
6551
|
twistAngle,
|
|
6885
6552
|
origin
|
|
6886
6553
|
} = {}) {
|
|
6887
|
-
const
|
|
6888
|
-
const
|
|
6889
|
-
|
|
6890
|
-
);
|
|
6554
|
+
const gc = localGC()[1];
|
|
6555
|
+
const direction = extrusionDirection ? toVec3(extrusionDirection) : this.defaultDirection;
|
|
6556
|
+
const extrusionVec = vecScale(vecNormalize(direction), extrusionDistance);
|
|
6557
|
+
const originVec = origin ? toVec3(origin) : this.defaultOrigin;
|
|
6891
6558
|
if (extrusionProfile && !twistAngle) {
|
|
6892
6559
|
const solid2 = unwrap(
|
|
6893
|
-
complexExtrude$1(this.wire,
|
|
6560
|
+
complexExtrude$1(this.wire, [...originVec], [...extrusionVec], extrusionProfile)
|
|
6894
6561
|
);
|
|
6895
6562
|
gc();
|
|
6896
6563
|
this.delete();
|
|
@@ -6898,20 +6565,14 @@ class Sketch {
|
|
|
6898
6565
|
}
|
|
6899
6566
|
if (twistAngle) {
|
|
6900
6567
|
const solid2 = unwrap(
|
|
6901
|
-
twistExtrude$1(
|
|
6902
|
-
this.wire,
|
|
6903
|
-
twistAngle,
|
|
6904
|
-
origin || this.defaultOrigin,
|
|
6905
|
-
extrusionVec,
|
|
6906
|
-
extrusionProfile
|
|
6907
|
-
)
|
|
6568
|
+
twistExtrude$1(this.wire, twistAngle, [...originVec], [...extrusionVec], extrusionProfile)
|
|
6908
6569
|
);
|
|
6909
6570
|
gc();
|
|
6910
6571
|
this.delete();
|
|
6911
6572
|
return solid2;
|
|
6912
6573
|
}
|
|
6913
6574
|
const face = unwrap(makeFace(this.wire));
|
|
6914
|
-
const solid = basicFaceExtrusion(face, extrusionVec);
|
|
6575
|
+
const solid = basicFaceExtrusion(face, [...extrusionVec]);
|
|
6915
6576
|
gc();
|
|
6916
6577
|
this.delete();
|
|
6917
6578
|
return solid;
|
|
@@ -6922,9 +6583,13 @@ class Sketch {
|
|
|
6922
6583
|
*/
|
|
6923
6584
|
sweepSketch(sketchOnPlane, sweepConfig = {}) {
|
|
6924
6585
|
const startPoint = this.wire.startPoint;
|
|
6925
|
-
const
|
|
6926
|
-
const
|
|
6927
|
-
const
|
|
6586
|
+
const tangent = this.wire.tangentAt(1e-9);
|
|
6587
|
+
const normal = vecNormalize(vecScale(tangent, -1));
|
|
6588
|
+
const defaultDir = this.defaultDirection;
|
|
6589
|
+
const xDir = vecScale(vecCross(normal, defaultDir), -1);
|
|
6590
|
+
const sketch = sketchOnPlane(createPlane([...startPoint], [...xDir], [...normal]), [
|
|
6591
|
+
...startPoint
|
|
6592
|
+
]);
|
|
6928
6593
|
const config = {
|
|
6929
6594
|
forceProfileSpineOthogonality: true,
|
|
6930
6595
|
...sweepConfig
|
|
@@ -7447,12 +7112,16 @@ class FaceSketcher extends BaseSketcher2d {
|
|
|
7447
7112
|
const sketch = new Sketch(wire);
|
|
7448
7113
|
if (wire.isClosed) {
|
|
7449
7114
|
const face = r(sketch.clone().face());
|
|
7450
|
-
|
|
7451
|
-
|
|
7115
|
+
const origin = face.pointOnSurface(0.5, 0.5);
|
|
7116
|
+
const normal = face.normalAt();
|
|
7117
|
+
const direction = vecScale(normal, -1);
|
|
7118
|
+
sketch.defaultOrigin = [origin[0], origin[1], origin[2]];
|
|
7119
|
+
sketch.defaultDirection = [direction[0], direction[1], direction[2]];
|
|
7452
7120
|
} else {
|
|
7453
|
-
const startPoint =
|
|
7454
|
-
|
|
7455
|
-
sketch.
|
|
7121
|
+
const startPoint = wire.startPoint;
|
|
7122
|
+
const normal = this.face.normalAt([startPoint[0], startPoint[1], startPoint[2]]);
|
|
7123
|
+
sketch.defaultOrigin = [startPoint[0], startPoint[1], startPoint[2]];
|
|
7124
|
+
sketch.defaultDirection = [normal[0], normal[1], normal[2]];
|
|
7456
7125
|
}
|
|
7457
7126
|
sketch.baseFace = this.face;
|
|
7458
7127
|
gc();
|
|
@@ -8250,15 +7919,13 @@ class EdgeFinder extends Finder3d {
|
|
|
8250
7919
|
* @category Filter
|
|
8251
7920
|
*/
|
|
8252
7921
|
parallelTo(plane) {
|
|
8253
|
-
const [r, gc] = localGC();
|
|
8254
7922
|
if (typeof plane === "string") return this.atAngleWith(PLANE_TO_DIR[plane], 90);
|
|
8255
|
-
if (typeof plane !== "string" &&
|
|
7923
|
+
if (typeof plane !== "string" && "zDir" in plane) {
|
|
8256
7924
|
return this.atAngleWith(plane.zDir, 90);
|
|
7925
|
+
}
|
|
8257
7926
|
if (typeof plane !== "string" && "normalAt" in plane) {
|
|
8258
|
-
const normal =
|
|
8259
|
-
|
|
8260
|
-
gc();
|
|
8261
|
-
return this.atAngleWith(normalPoint, 90);
|
|
7927
|
+
const normal = plane.normalAt();
|
|
7928
|
+
return this.atAngleWith(normal, 90);
|
|
8262
7929
|
}
|
|
8263
7930
|
return this;
|
|
8264
7931
|
}
|
|
@@ -8271,30 +7938,25 @@ class EdgeFinder extends Finder3d {
|
|
|
8271
7938
|
* @category Filter
|
|
8272
7939
|
*/
|
|
8273
7940
|
inPlane(inputPlane, origin) {
|
|
8274
|
-
const plane = inputPlane
|
|
7941
|
+
const plane = typeof inputPlane === "string" ? resolvePlane(inputPlane, origin) : inputPlane;
|
|
8275
7942
|
this.parallelTo(plane);
|
|
8276
7943
|
const firstPointInPlane = ({ element }) => {
|
|
8277
|
-
const [r, gc] = localGC();
|
|
8278
7944
|
const startPoint = element.startPoint;
|
|
8279
|
-
const projected =
|
|
8280
|
-
const result = startPoint
|
|
8281
|
-
gc();
|
|
7945
|
+
const projected = vecProjectToPlane(startPoint, plane.origin, plane.zDir);
|
|
7946
|
+
const result = vecEquals(startPoint, projected);
|
|
8282
7947
|
return result;
|
|
8283
7948
|
};
|
|
8284
7949
|
this.filters.push(firstPointInPlane);
|
|
8285
7950
|
return this;
|
|
8286
7951
|
}
|
|
8287
7952
|
shouldKeep(element) {
|
|
8288
|
-
const [r, gc] = localGC();
|
|
8289
7953
|
let normal = null;
|
|
8290
|
-
let tangent = null;
|
|
8291
7954
|
try {
|
|
8292
|
-
tangent =
|
|
8293
|
-
normal =
|
|
7955
|
+
const tangent = element.tangentAt();
|
|
7956
|
+
normal = vecNormalize(tangent);
|
|
8294
7957
|
} catch {
|
|
8295
7958
|
}
|
|
8296
7959
|
const result = this.filters.every((filter) => filter({ normal, element }));
|
|
8297
|
-
gc();
|
|
8298
7960
|
return result;
|
|
8299
7961
|
}
|
|
8300
7962
|
applyFilter(shape) {
|
|
@@ -8576,42 +8238,37 @@ class Sketcher {
|
|
|
8576
8238
|
pendingEdges;
|
|
8577
8239
|
_mirrorWire;
|
|
8578
8240
|
constructor(plane, origin) {
|
|
8579
|
-
this.plane = plane
|
|
8580
|
-
this.pointer =
|
|
8581
|
-
this.firstPoint =
|
|
8241
|
+
this.plane = plane && typeof plane !== "string" ? { ...plane } : resolvePlane(plane ?? "XY", origin);
|
|
8242
|
+
this.pointer = [...this.plane.origin];
|
|
8243
|
+
this.firstPoint = [...this.plane.origin];
|
|
8582
8244
|
this.pendingEdges = [];
|
|
8583
8245
|
this._mirrorWire = false;
|
|
8584
8246
|
}
|
|
8585
8247
|
delete() {
|
|
8586
|
-
this.plane.delete();
|
|
8587
|
-
this.pointer.delete();
|
|
8588
|
-
this.firstPoint.delete();
|
|
8589
8248
|
for (const edge of this.pendingEdges) {
|
|
8590
8249
|
edge.delete();
|
|
8591
8250
|
}
|
|
8592
8251
|
this.pendingEdges = [];
|
|
8593
8252
|
}
|
|
8594
8253
|
_updatePointer(newPointer) {
|
|
8595
|
-
this.pointer.delete();
|
|
8596
8254
|
this.pointer = newPointer;
|
|
8597
8255
|
}
|
|
8598
8256
|
movePointerTo([x, y]) {
|
|
8599
8257
|
if (this.pendingEdges.length)
|
|
8600
8258
|
bug("Sketcher.movePointerTo", "You can only move the pointer if there is no edge defined");
|
|
8601
|
-
this._updatePointer(this.plane
|
|
8602
|
-
this.firstPoint.
|
|
8603
|
-
this.firstPoint = new Vector(this.pointer);
|
|
8259
|
+
this._updatePointer(planeToWorld(this.plane, [x, y]));
|
|
8260
|
+
this.firstPoint = this.pointer;
|
|
8604
8261
|
return this;
|
|
8605
8262
|
}
|
|
8606
8263
|
lineTo([x, y]) {
|
|
8607
|
-
const endPoint = this.plane
|
|
8264
|
+
const endPoint = planeToWorld(this.plane, [x, y]);
|
|
8608
8265
|
this.pendingEdges.push(makeLine(this.pointer, endPoint));
|
|
8609
8266
|
this._updatePointer(endPoint);
|
|
8610
8267
|
return this;
|
|
8611
8268
|
}
|
|
8612
8269
|
line(xDist, yDist) {
|
|
8613
|
-
const
|
|
8614
|
-
return this.lineTo([xDist +
|
|
8270
|
+
const [px, py] = planeToLocal(this.plane, this.pointer);
|
|
8271
|
+
return this.lineTo([xDist + px, yDist + py]);
|
|
8615
8272
|
}
|
|
8616
8273
|
vLine(distance) {
|
|
8617
8274
|
return this.line(0, distance);
|
|
@@ -8620,12 +8277,12 @@ class Sketcher {
|
|
|
8620
8277
|
return this.line(distance, 0);
|
|
8621
8278
|
}
|
|
8622
8279
|
vLineTo(yPos) {
|
|
8623
|
-
const
|
|
8624
|
-
return this.lineTo([
|
|
8280
|
+
const [px] = planeToLocal(this.plane, this.pointer);
|
|
8281
|
+
return this.lineTo([px, yPos]);
|
|
8625
8282
|
}
|
|
8626
8283
|
hLineTo(xPos) {
|
|
8627
|
-
const
|
|
8628
|
-
return this.lineTo([xPos,
|
|
8284
|
+
const [, py] = planeToLocal(this.plane, this.pointer);
|
|
8285
|
+
return this.lineTo([xPos, py]);
|
|
8629
8286
|
}
|
|
8630
8287
|
polarLine(distance, angle) {
|
|
8631
8288
|
const angleInRads = angle * DEG2RAD;
|
|
@@ -8638,66 +8295,59 @@ class Sketcher {
|
|
|
8638
8295
|
return this.lineTo(point);
|
|
8639
8296
|
}
|
|
8640
8297
|
tangentLine(distance) {
|
|
8641
|
-
const [r, gc] = localGC();
|
|
8642
8298
|
const previousEdge = this.pendingEdges.length ? this.pendingEdges[this.pendingEdges.length - 1] : null;
|
|
8643
8299
|
if (!previousEdge)
|
|
8644
8300
|
bug("Sketcher.tangentLine", "You need a previous edge to create a tangent line");
|
|
8645
|
-
const tangent =
|
|
8646
|
-
const
|
|
8301
|
+
const tangent = previousEdge.tangentAt(1);
|
|
8302
|
+
const scaledTangent = vecScale(vecNormalize(tangent), distance);
|
|
8303
|
+
const endPoint = vecAdd(scaledTangent, this.pointer);
|
|
8647
8304
|
this.pendingEdges.push(makeLine(this.pointer, endPoint));
|
|
8648
8305
|
this._updatePointer(endPoint);
|
|
8649
|
-
gc();
|
|
8650
8306
|
return this;
|
|
8651
8307
|
}
|
|
8652
8308
|
threePointsArcTo(end, innerPoint) {
|
|
8653
|
-
const gpoint1 = this.plane
|
|
8654
|
-
const gpoint2 = this.plane
|
|
8309
|
+
const gpoint1 = planeToWorld(this.plane, innerPoint);
|
|
8310
|
+
const gpoint2 = planeToWorld(this.plane, end);
|
|
8655
8311
|
this.pendingEdges.push(makeThreePointArc(this.pointer, gpoint1, gpoint2));
|
|
8656
8312
|
this._updatePointer(gpoint2);
|
|
8657
8313
|
return this;
|
|
8658
8314
|
}
|
|
8659
8315
|
threePointsArc(xDist, yDist, viaXDist, viaYDist) {
|
|
8660
|
-
const
|
|
8661
|
-
return this.threePointsArcTo(
|
|
8662
|
-
[pointer.x + xDist, pointer.y + yDist],
|
|
8663
|
-
[pointer.x + viaXDist, pointer.y + viaYDist]
|
|
8664
|
-
);
|
|
8316
|
+
const [px, py] = planeToLocal(this.plane, this.pointer);
|
|
8317
|
+
return this.threePointsArcTo([px + xDist, py + yDist], [px + viaXDist, py + viaYDist]);
|
|
8665
8318
|
}
|
|
8666
8319
|
tangentArcTo(end) {
|
|
8667
|
-
const
|
|
8668
|
-
const endPoint = this.plane.toWorldCoords(end);
|
|
8320
|
+
const endPoint = planeToWorld(this.plane, end);
|
|
8669
8321
|
const previousEdge = this.pendingEdges.length ? this.pendingEdges[this.pendingEdges.length - 1] : null;
|
|
8670
8322
|
if (!previousEdge)
|
|
8671
8323
|
bug("Sketcher.tangentArcTo", "You need a previous edge to create a tangent arc");
|
|
8672
|
-
const prevEnd =
|
|
8673
|
-
const prevTangent =
|
|
8324
|
+
const prevEnd = previousEdge.endPoint;
|
|
8325
|
+
const prevTangent = previousEdge.tangentAt(1);
|
|
8674
8326
|
this.pendingEdges.push(makeTangentArc(prevEnd, prevTangent, endPoint));
|
|
8675
8327
|
this._updatePointer(endPoint);
|
|
8676
|
-
gc();
|
|
8677
8328
|
return this;
|
|
8678
8329
|
}
|
|
8679
8330
|
tangentArc(xDist, yDist) {
|
|
8680
|
-
const
|
|
8681
|
-
return this.tangentArcTo([xDist +
|
|
8331
|
+
const [px, py] = planeToLocal(this.plane, this.pointer);
|
|
8332
|
+
return this.tangentArcTo([xDist + px, yDist + py]);
|
|
8682
8333
|
}
|
|
8683
8334
|
sagittaArcTo(end, sagitta) {
|
|
8684
|
-
const [r, gc] = localGC();
|
|
8685
8335
|
const startPoint = this.pointer;
|
|
8686
|
-
const endPoint = this.plane
|
|
8687
|
-
const sum =
|
|
8688
|
-
const midPoint =
|
|
8689
|
-
const diff =
|
|
8690
|
-
const
|
|
8691
|
-
const
|
|
8692
|
-
const
|
|
8336
|
+
const endPoint = planeToWorld(this.plane, end);
|
|
8337
|
+
const sum = vecAdd(endPoint, startPoint);
|
|
8338
|
+
const midPoint = vecScale(sum, 0.5);
|
|
8339
|
+
const diff = vecSub(endPoint, startPoint);
|
|
8340
|
+
const crossResult = vecCross(diff, this.plane.zDir);
|
|
8341
|
+
const sagDirection = vecNormalize(crossResult);
|
|
8342
|
+
const sagVector = vecScale(sagDirection, sagitta);
|
|
8343
|
+
const sagPoint = vecAdd(midPoint, sagVector);
|
|
8693
8344
|
this.pendingEdges.push(makeThreePointArc(this.pointer, sagPoint, endPoint));
|
|
8694
8345
|
this._updatePointer(endPoint);
|
|
8695
|
-
gc();
|
|
8696
8346
|
return this;
|
|
8697
8347
|
}
|
|
8698
8348
|
sagittaArc(xDist, yDist, sagitta) {
|
|
8699
|
-
const
|
|
8700
|
-
return this.sagittaArcTo([xDist +
|
|
8349
|
+
const [px, py] = planeToLocal(this.plane, this.pointer);
|
|
8350
|
+
return this.sagittaArcTo([xDist + px, yDist + py], sagitta);
|
|
8701
8351
|
}
|
|
8702
8352
|
vSagittaArc(distance, sagitta) {
|
|
8703
8353
|
return this.sagittaArc(0, distance, sagitta);
|
|
@@ -8707,14 +8357,14 @@ class Sketcher {
|
|
|
8707
8357
|
}
|
|
8708
8358
|
bulgeArcTo(end, bulge) {
|
|
8709
8359
|
if (!bulge) return this.lineTo(end);
|
|
8710
|
-
const
|
|
8711
|
-
const halfChord = distance2d([
|
|
8360
|
+
const [px, py] = planeToLocal(this.plane, this.pointer);
|
|
8361
|
+
const halfChord = distance2d([px, py], end) / 2;
|
|
8712
8362
|
const bulgeAsSagitta = -bulge * halfChord;
|
|
8713
8363
|
return this.sagittaArcTo(end, bulgeAsSagitta);
|
|
8714
8364
|
}
|
|
8715
8365
|
bulgeArc(xDist, yDist, bulge) {
|
|
8716
|
-
const
|
|
8717
|
-
return this.bulgeArcTo([xDist +
|
|
8366
|
+
const [px, py] = planeToLocal(this.plane, this.pointer);
|
|
8367
|
+
return this.bulgeArcTo([xDist + px, yDist + py], bulge);
|
|
8718
8368
|
}
|
|
8719
8369
|
vBulgeArc(distance, bulge) {
|
|
8720
8370
|
return this.bulgeArc(0, distance, bulge);
|
|
@@ -8723,8 +8373,8 @@ class Sketcher {
|
|
|
8723
8373
|
return this.bulgeArc(distance, 0, bulge);
|
|
8724
8374
|
}
|
|
8725
8375
|
ellipseTo(end, horizontalRadius, verticalRadius, rotation = 0, longAxis = false, sweep2 = false) {
|
|
8726
|
-
const [
|
|
8727
|
-
const
|
|
8376
|
+
const [, gc] = localGC();
|
|
8377
|
+
const [startX, startY] = planeToLocal(this.plane, this.pointer);
|
|
8728
8378
|
let rotationAngle = rotation;
|
|
8729
8379
|
let majorRadius = horizontalRadius;
|
|
8730
8380
|
let minorRadius = verticalRadius;
|
|
@@ -8734,7 +8384,7 @@ class Sketcher {
|
|
|
8734
8384
|
minorRadius = horizontalRadius;
|
|
8735
8385
|
}
|
|
8736
8386
|
const { cx, cy, rx, ry, startAngle, endAngle, clockwise } = convertSvgEllipseParams(
|
|
8737
|
-
[
|
|
8387
|
+
[startX, startY],
|
|
8738
8388
|
end,
|
|
8739
8389
|
majorRadius,
|
|
8740
8390
|
minorRadius,
|
|
@@ -8742,16 +8392,14 @@ class Sketcher {
|
|
|
8742
8392
|
longAxis,
|
|
8743
8393
|
sweep2
|
|
8744
8394
|
);
|
|
8745
|
-
const xDir =
|
|
8746
|
-
new Vector(this.plane.xDir).rotate(rotationAngle, this.plane.origin, this.plane.zDir)
|
|
8747
|
-
);
|
|
8395
|
+
const xDir = vecRotate(this.plane.xDir, this.plane.zDir, rotationAngle * DEG2RAD);
|
|
8748
8396
|
const arc = unwrap(
|
|
8749
8397
|
makeEllipseArc(
|
|
8750
8398
|
rx,
|
|
8751
8399
|
ry,
|
|
8752
8400
|
clockwise ? startAngle : endAngle,
|
|
8753
8401
|
clockwise ? endAngle : startAngle,
|
|
8754
|
-
|
|
8402
|
+
planeToWorld(this.plane, [cx, cy]),
|
|
8755
8403
|
this.plane.zDir,
|
|
8756
8404
|
xDir
|
|
8757
8405
|
)
|
|
@@ -8760,14 +8408,14 @@ class Sketcher {
|
|
|
8760
8408
|
arc.wrapped.Reverse();
|
|
8761
8409
|
}
|
|
8762
8410
|
this.pendingEdges.push(arc);
|
|
8763
|
-
this._updatePointer(this.plane
|
|
8411
|
+
this._updatePointer(planeToWorld(this.plane, end));
|
|
8764
8412
|
gc();
|
|
8765
8413
|
return this;
|
|
8766
8414
|
}
|
|
8767
8415
|
ellipse(xDist, yDist, horizontalRadius, verticalRadius, rotation = 0, longAxis = false, sweep2 = false) {
|
|
8768
|
-
const
|
|
8416
|
+
const [px, py] = planeToLocal(this.plane, this.pointer);
|
|
8769
8417
|
return this.ellipseTo(
|
|
8770
|
-
[xDist +
|
|
8418
|
+
[xDist + px, yDist + py],
|
|
8771
8419
|
horizontalRadius,
|
|
8772
8420
|
verticalRadius,
|
|
8773
8421
|
rotation,
|
|
@@ -8776,15 +8424,15 @@ class Sketcher {
|
|
|
8776
8424
|
);
|
|
8777
8425
|
}
|
|
8778
8426
|
halfEllipseTo(end, verticalRadius, sweep2 = false) {
|
|
8779
|
-
const
|
|
8780
|
-
const start = [
|
|
8427
|
+
const [px, py] = planeToLocal(this.plane, this.pointer);
|
|
8428
|
+
const start = [px, py];
|
|
8781
8429
|
const angle = polarAngle2d(end, start);
|
|
8782
8430
|
const distance = distance2d(end, start);
|
|
8783
8431
|
return this.ellipseTo(end, distance / 2, verticalRadius, angle * RAD2DEG, false, sweep2);
|
|
8784
8432
|
}
|
|
8785
8433
|
halfEllipse(xDist, yDist, verticalRadius, sweep2 = false) {
|
|
8786
|
-
const
|
|
8787
|
-
return this.halfEllipseTo([xDist +
|
|
8434
|
+
const [px, py] = planeToLocal(this.plane, this.pointer);
|
|
8435
|
+
return this.halfEllipseTo([xDist + px, yDist + py], verticalRadius, sweep2);
|
|
8788
8436
|
}
|
|
8789
8437
|
bezierCurveTo(end, controlPoints) {
|
|
8790
8438
|
let cp;
|
|
@@ -8793,8 +8441,8 @@ class Sketcher {
|
|
|
8793
8441
|
} else {
|
|
8794
8442
|
cp = controlPoints;
|
|
8795
8443
|
}
|
|
8796
|
-
const inWorldPoints = cp.map((p) => this.plane
|
|
8797
|
-
const endPoint = this.plane
|
|
8444
|
+
const inWorldPoints = cp.map((p) => planeToWorld(this.plane, p));
|
|
8445
|
+
const endPoint = planeToWorld(this.plane, end);
|
|
8798
8446
|
this.pendingEdges.push(makeBezierCurve([this.pointer, ...inWorldPoints, endPoint]));
|
|
8799
8447
|
this._updatePointer(endPoint);
|
|
8800
8448
|
return this;
|
|
@@ -8809,35 +8457,35 @@ class Sketcher {
|
|
|
8809
8457
|
const [r, gc] = localGC();
|
|
8810
8458
|
try {
|
|
8811
8459
|
const { endTangent, startTangent, startFactor, endFactor } = defaultsSplineConfig(config);
|
|
8812
|
-
const endPoint = this.plane
|
|
8460
|
+
const endPoint = planeToWorld(this.plane, end);
|
|
8813
8461
|
const previousEdge = this.pendingEdges.length ? this.pendingEdges[this.pendingEdges.length - 1] : null;
|
|
8814
|
-
const
|
|
8462
|
+
const diff = vecSub(endPoint, this.pointer);
|
|
8463
|
+
const defaultDistance = vecLength(diff) * 0.25;
|
|
8815
8464
|
let startPoleDirection;
|
|
8816
8465
|
if (startTangent) {
|
|
8817
|
-
startPoleDirection = this.plane
|
|
8466
|
+
startPoleDirection = planeToWorld(this.plane, startTangent);
|
|
8818
8467
|
} else if (!previousEdge) {
|
|
8819
|
-
startPoleDirection = this.plane
|
|
8468
|
+
startPoleDirection = planeToWorld(this.plane, [1, 0]);
|
|
8820
8469
|
} else if (previousEdge.geomType === "BEZIER_CURVE") {
|
|
8821
8470
|
const rawCurve = r(previousEdge.curve).wrapped.Bezier().get();
|
|
8822
|
-
const previousPole =
|
|
8823
|
-
startPoleDirection =
|
|
8471
|
+
const previousPole = toVec3(rawCurve.Pole(rawCurve.NbPoles() - 1));
|
|
8472
|
+
startPoleDirection = vecSub(this.pointer, previousPole);
|
|
8824
8473
|
} else {
|
|
8825
|
-
startPoleDirection =
|
|
8474
|
+
startPoleDirection = previousEdge.tangentAt(1);
|
|
8826
8475
|
}
|
|
8827
|
-
const poleDistance =
|
|
8828
|
-
startPoleDirection
|
|
8476
|
+
const poleDistance = vecScale(
|
|
8477
|
+
vecNormalize(startPoleDirection),
|
|
8478
|
+
startFactor * defaultDistance
|
|
8829
8479
|
);
|
|
8830
|
-
const startControl =
|
|
8480
|
+
const startControl = vecAdd(this.pointer, poleDistance);
|
|
8831
8481
|
let endPoleDirection;
|
|
8832
8482
|
if (endTangent === "symmetric") {
|
|
8833
|
-
endPoleDirection =
|
|
8483
|
+
endPoleDirection = vecScale(startPoleDirection, -1);
|
|
8834
8484
|
} else {
|
|
8835
|
-
endPoleDirection =
|
|
8485
|
+
endPoleDirection = planeToWorld(this.plane, endTangent);
|
|
8836
8486
|
}
|
|
8837
|
-
const endPoleDistance =
|
|
8838
|
-
|
|
8839
|
-
);
|
|
8840
|
-
const endControl = r(endPoint.sub(endPoleDistance));
|
|
8487
|
+
const endPoleDistance = vecScale(vecNormalize(endPoleDirection), endFactor * defaultDistance);
|
|
8488
|
+
const endControl = vecSub(endPoint, endPoleDistance);
|
|
8841
8489
|
this.pendingEdges.push(makeBezierCurve([this.pointer, startControl, endControl, endPoint]));
|
|
8842
8490
|
this._updatePointer(endPoint);
|
|
8843
8491
|
return this;
|
|
@@ -8846,17 +8494,15 @@ class Sketcher {
|
|
|
8846
8494
|
}
|
|
8847
8495
|
}
|
|
8848
8496
|
smoothSpline(xDist, yDist, splineConfig = {}) {
|
|
8849
|
-
const
|
|
8850
|
-
return this.smoothSplineTo([xDist +
|
|
8497
|
+
const [px, py] = planeToLocal(this.plane, this.pointer);
|
|
8498
|
+
return this.smoothSplineTo([xDist + px, yDist + py], splineConfig);
|
|
8851
8499
|
}
|
|
8852
8500
|
_mirrorWireOnStartEnd(wire) {
|
|
8853
|
-
const
|
|
8854
|
-
const
|
|
8855
|
-
const
|
|
8856
|
-
const normal = r(startToEndVector.cross(this.plane.zDir));
|
|
8501
|
+
const diff = vecSub(this.pointer, this.firstPoint);
|
|
8502
|
+
const startToEndVector = vecNormalize(diff);
|
|
8503
|
+
const normal = vecCross(startToEndVector, this.plane.zDir);
|
|
8857
8504
|
const mirroredWire = wire.clone().mirror(normal, this.pointer);
|
|
8858
8505
|
const combinedWire = unwrap(assembleWire$1([wire, mirroredWire]));
|
|
8859
|
-
gc();
|
|
8860
8506
|
return combinedWire;
|
|
8861
8507
|
}
|
|
8862
8508
|
buildWire() {
|
|
@@ -8868,9 +8514,9 @@ class Sketcher {
|
|
|
8868
8514
|
return wire;
|
|
8869
8515
|
}
|
|
8870
8516
|
_closeSketch() {
|
|
8871
|
-
if (!this.pointer
|
|
8872
|
-
const
|
|
8873
|
-
this.lineTo([
|
|
8517
|
+
if (!vecEquals(this.pointer, this.firstPoint) && !this._mirrorWire) {
|
|
8518
|
+
const [endX, endY] = planeToLocal(this.plane, this.firstPoint);
|
|
8519
|
+
this.lineTo([endX, endY]);
|
|
8874
8520
|
}
|
|
8875
8521
|
}
|
|
8876
8522
|
done() {
|
|
@@ -8982,17 +8628,17 @@ class CompoundSketch {
|
|
|
8982
8628
|
twistAngle,
|
|
8983
8629
|
origin
|
|
8984
8630
|
} = {}) {
|
|
8985
|
-
const [
|
|
8986
|
-
const rawVec =
|
|
8987
|
-
const normVec =
|
|
8988
|
-
const extrusionVec =
|
|
8631
|
+
const [, gc] = localGC();
|
|
8632
|
+
const rawVec = extrusionDirection ? toVec3(extrusionDirection) : this.outerSketch.defaultDirection;
|
|
8633
|
+
const normVec = vecNormalize(rawVec);
|
|
8634
|
+
const extrusionVec = vecScale(normVec, extrusionDistance);
|
|
8989
8635
|
let result;
|
|
8990
8636
|
if (extrusionProfile && !twistAngle) {
|
|
8991
8637
|
result = solidFromShellGenerator(
|
|
8992
8638
|
this.sketches,
|
|
8993
8639
|
(sketch) => complexExtrude$1(
|
|
8994
8640
|
sketch.wire,
|
|
8995
|
-
origin
|
|
8641
|
+
origin ? toVec3(origin) : this.outerSketch.defaultOrigin,
|
|
8996
8642
|
extrusionVec,
|
|
8997
8643
|
extrusionProfile,
|
|
8998
8644
|
true
|
|
@@ -9004,7 +8650,7 @@ class CompoundSketch {
|
|
|
9004
8650
|
(sketch) => twistExtrude$1(
|
|
9005
8651
|
sketch.wire,
|
|
9006
8652
|
twistAngle,
|
|
9007
|
-
origin
|
|
8653
|
+
origin ? toVec3(origin) : this.outerSketch.defaultOrigin,
|
|
9008
8654
|
extrusionVec,
|
|
9009
8655
|
extrusionProfile,
|
|
9010
8656
|
true
|
|
@@ -9022,7 +8668,11 @@ class CompoundSketch {
|
|
|
9022
8668
|
*/
|
|
9023
8669
|
revolve(revolutionAxis, { origin } = {}) {
|
|
9024
8670
|
return unwrap(
|
|
9025
|
-
revolution(
|
|
8671
|
+
revolution(
|
|
8672
|
+
this.face(),
|
|
8673
|
+
origin ? toVec3(origin) : this.outerSketch.defaultOrigin,
|
|
8674
|
+
revolutionAxis
|
|
8675
|
+
)
|
|
9026
8676
|
);
|
|
9027
8677
|
}
|
|
9028
8678
|
loftWith(otherCompound, loftConfig) {
|
|
@@ -9076,38 +8726,35 @@ class Sketches {
|
|
|
9076
8726
|
}
|
|
9077
8727
|
}
|
|
9078
8728
|
const sketchCircle = (radius, planeConfig = {}) => {
|
|
9079
|
-
const plane = planeConfig.plane
|
|
8729
|
+
const plane = planeConfig.plane && typeof planeConfig.plane !== "string" ? { ...planeConfig.plane } : resolvePlane(planeConfig.plane ?? "XY", planeConfig.origin);
|
|
9080
8730
|
const wire = unwrap(assembleWire$1([makeCircle(radius, plane.origin, plane.zDir)]));
|
|
9081
8731
|
const sketch = new Sketch(wire, {
|
|
9082
|
-
defaultOrigin: plane.origin,
|
|
9083
|
-
defaultDirection: plane.zDir
|
|
8732
|
+
defaultOrigin: [...plane.origin],
|
|
8733
|
+
defaultDirection: [...plane.zDir]
|
|
9084
8734
|
});
|
|
9085
|
-
plane.delete();
|
|
9086
8735
|
return sketch;
|
|
9087
8736
|
};
|
|
9088
8737
|
const sketchEllipse = (xRadius = 1, yRadius = 2, planeConfig = {}) => {
|
|
9089
|
-
const plane = planeConfig.plane
|
|
9090
|
-
|
|
8738
|
+
const plane = planeConfig.plane && typeof planeConfig.plane !== "string" ? { ...planeConfig.plane } : resolvePlane(planeConfig.plane ?? "XY", planeConfig.origin);
|
|
8739
|
+
let xDir = plane.xDir;
|
|
9091
8740
|
let majR = xRadius;
|
|
9092
8741
|
let minR = yRadius;
|
|
9093
8742
|
if (yRadius > xRadius) {
|
|
9094
|
-
xDir
|
|
8743
|
+
xDir = vecRotate(xDir, plane.zDir, 90 * DEG2RAD);
|
|
9095
8744
|
majR = yRadius;
|
|
9096
8745
|
minR = xRadius;
|
|
9097
8746
|
}
|
|
9098
8747
|
const wire = unwrap(
|
|
9099
8748
|
assembleWire$1([unwrap(makeEllipse(majR, minR, plane.origin, plane.zDir, xDir))])
|
|
9100
8749
|
);
|
|
9101
|
-
xDir.delete();
|
|
9102
8750
|
const sketch = new Sketch(wire, {
|
|
9103
|
-
defaultOrigin: plane.origin,
|
|
9104
|
-
defaultDirection: plane.zDir
|
|
8751
|
+
defaultOrigin: [...plane.origin],
|
|
8752
|
+
defaultDirection: [...plane.zDir]
|
|
9105
8753
|
});
|
|
9106
|
-
plane.delete();
|
|
9107
8754
|
return sketch;
|
|
9108
8755
|
};
|
|
9109
8756
|
const sketchRectangle = (xLength, yLength, planeConfig = {}) => {
|
|
9110
|
-
const sketcher = planeConfig.plane
|
|
8757
|
+
const sketcher = planeConfig.plane && typeof planeConfig.plane !== "string" ? new Sketcher(planeConfig.plane) : new Sketcher(planeConfig.plane, planeConfig.origin);
|
|
9111
8758
|
return sketcher.movePointerTo([-xLength / 2, -yLength / 2]).hLine(xLength).vLine(yLength).hLine(-xLength).vLine(-yLength).done();
|
|
9112
8759
|
};
|
|
9113
8760
|
const sketchRoundedRectangle = (width, height, r = 0, planeConfig = {}) => {
|
|
@@ -9123,7 +8770,7 @@ const sketchPolysides = (radius, sidesCount, sagitta = 0, planeConfig = {}) => {
|
|
|
9123
8770
|
const theta = -(Math.PI * 2 / sidesCount) * i;
|
|
9124
8771
|
return [radius * Math.sin(theta), radius * Math.cos(theta)];
|
|
9125
8772
|
});
|
|
9126
|
-
const sketcher = planeConfig.plane
|
|
8773
|
+
const sketcher = planeConfig.plane && typeof planeConfig.plane !== "string" ? new Sketcher(planeConfig.plane) : new Sketcher(planeConfig.plane, planeConfig.origin);
|
|
9127
8774
|
const lastPoint = points[points.length - 1];
|
|
9128
8775
|
const sketch = sketcher.movePointerTo([
|
|
9129
8776
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -9145,37 +8792,35 @@ const polysideInnerRadius = (outerRadius, sidesCount, sagitta = 0) => {
|
|
|
9145
8792
|
return innerRadius + sagitta;
|
|
9146
8793
|
};
|
|
9147
8794
|
const sketchFaceOffset = (face, offset2) => {
|
|
9148
|
-
const defaultOrigin = face.center;
|
|
9149
|
-
const defaultDirection = face.normalAt();
|
|
8795
|
+
const defaultOrigin = [...face.center];
|
|
8796
|
+
const defaultDirection = [...face.normalAt()];
|
|
9150
8797
|
const wire = unwrap(face.outerWire().offset2D(offset2));
|
|
9151
8798
|
const sketch = new Sketch(wire, { defaultOrigin, defaultDirection });
|
|
9152
|
-
defaultOrigin.delete();
|
|
9153
|
-
defaultDirection.delete();
|
|
9154
8799
|
return sketch;
|
|
9155
8800
|
};
|
|
9156
8801
|
const sketchParametricFunction = (func, planeConfig = {}, { pointsCount = 400, start = 0, stop = 1 } = {}, approximationConfig = {}) => {
|
|
9157
8802
|
const [r, gc] = localGC();
|
|
9158
|
-
const plane =
|
|
9159
|
-
planeConfig.plane instanceof Plane ? makePlane(planeConfig.plane) : makePlane(planeConfig.plane, planeConfig.origin)
|
|
9160
|
-
);
|
|
8803
|
+
const plane = planeConfig.plane && typeof planeConfig.plane !== "string" ? { ...planeConfig.plane } : resolvePlane(planeConfig.plane ?? "XY", planeConfig.origin);
|
|
9161
8804
|
const stepSize = (stop - start) / pointsCount;
|
|
9162
8805
|
const points = [...Array(pointsCount + 1).keys()].map((t) => {
|
|
9163
8806
|
const point = func(start + t * stepSize);
|
|
9164
|
-
return
|
|
8807
|
+
return planeToWorld(plane, point);
|
|
9165
8808
|
});
|
|
9166
8809
|
const wire = unwrap(
|
|
9167
8810
|
assembleWire$1([r(unwrap(makeBSplineApproximation(points, approximationConfig)))])
|
|
9168
8811
|
);
|
|
9169
8812
|
const sketch = new Sketch(wire, {
|
|
9170
|
-
defaultOrigin: plane.origin,
|
|
9171
|
-
defaultDirection: plane.zDir
|
|
8813
|
+
defaultOrigin: [...plane.origin],
|
|
8814
|
+
defaultDirection: [...plane.zDir]
|
|
9172
8815
|
});
|
|
9173
8816
|
gc();
|
|
9174
8817
|
return sketch;
|
|
9175
8818
|
};
|
|
9176
8819
|
const sketchHelix = (pitch, height, radius, center = [0, 0, 0], dir = [0, 0, 1], lefthand = false) => {
|
|
8820
|
+
const centerVec3 = toVec3(center);
|
|
8821
|
+
const dirVec3 = toVec3(dir);
|
|
9177
8822
|
return new Sketch(
|
|
9178
|
-
unwrap(assembleWire$1(makeHelix(pitch, height, radius,
|
|
8823
|
+
unwrap(assembleWire$1(makeHelix(pitch, height, radius, centerVec3, dirVec3, lefthand).wires))
|
|
9179
8824
|
);
|
|
9180
8825
|
};
|
|
9181
8826
|
const makeBaseBox = (xLength, yLength, zLength) => {
|
|
@@ -9556,78 +9201,84 @@ function lookFromPlane(projectionPlane) {
|
|
|
9556
9201
|
);
|
|
9557
9202
|
}
|
|
9558
9203
|
function defaultXDir(direction) {
|
|
9559
|
-
const
|
|
9560
|
-
const
|
|
9561
|
-
let
|
|
9562
|
-
|
|
9563
|
-
|
|
9564
|
-
xAxis
|
|
9565
|
-
yAxis = r(new Vector([0, 1, 0]));
|
|
9566
|
-
xAxis = yAxis.cross(dir);
|
|
9204
|
+
const dir = toVec3(direction);
|
|
9205
|
+
const yAxis = [0, 0, 1];
|
|
9206
|
+
let xAxis = vecCross(yAxis, dir);
|
|
9207
|
+
if (vecLength(xAxis) === 0) {
|
|
9208
|
+
const yAxis2 = [0, 1, 0];
|
|
9209
|
+
xAxis = vecCross(yAxis2, dir);
|
|
9567
9210
|
}
|
|
9568
|
-
|
|
9569
|
-
return xAxis.normalize();
|
|
9211
|
+
return vecNormalize(xAxis);
|
|
9570
9212
|
}
|
|
9571
9213
|
class ProjectionCamera extends WrappingObj {
|
|
9572
9214
|
constructor(position = [0, 0, 0], direction = [0, 0, 1], xAxis) {
|
|
9573
|
-
const
|
|
9574
|
-
const
|
|
9575
|
-
const
|
|
9576
|
-
|
|
9215
|
+
const pos = toVec3(position);
|
|
9216
|
+
const dir = toVec3(direction);
|
|
9217
|
+
const xDir = xAxis ? toVec3(xAxis) : defaultXDir(direction);
|
|
9218
|
+
const ax2 = makeOcAx2(pos, dir, xDir);
|
|
9577
9219
|
super(ax2);
|
|
9578
9220
|
}
|
|
9579
9221
|
get position() {
|
|
9580
|
-
return
|
|
9222
|
+
return fromOcPnt(this.wrapped.Location());
|
|
9581
9223
|
}
|
|
9582
9224
|
get direction() {
|
|
9583
|
-
return
|
|
9225
|
+
return fromOcDir(this.wrapped.Direction());
|
|
9584
9226
|
}
|
|
9585
9227
|
get xAxis() {
|
|
9586
|
-
return
|
|
9228
|
+
return fromOcDir(this.wrapped.XDirection());
|
|
9587
9229
|
}
|
|
9588
9230
|
get yAxis() {
|
|
9589
|
-
return
|
|
9231
|
+
return fromOcDir(this.wrapped.YDirection());
|
|
9590
9232
|
}
|
|
9591
9233
|
autoAxes() {
|
|
9592
9234
|
const [r, gc] = localGC();
|
|
9593
|
-
const dir =
|
|
9594
|
-
const xAxis =
|
|
9595
|
-
const ocDir = r(
|
|
9235
|
+
const dir = this.direction;
|
|
9236
|
+
const xAxis = defaultXDir(dir);
|
|
9237
|
+
const ocDir = r(toOcDir(xAxis));
|
|
9596
9238
|
this.wrapped.SetXDirection(ocDir);
|
|
9597
9239
|
gc();
|
|
9598
9240
|
}
|
|
9599
9241
|
setPosition(position) {
|
|
9600
9242
|
const [r, gc] = localGC();
|
|
9601
|
-
const pnt2 = r(
|
|
9243
|
+
const pnt2 = r(toOcPnt(toVec3(position)));
|
|
9602
9244
|
this.wrapped.SetLocation(pnt2);
|
|
9603
9245
|
gc();
|
|
9604
9246
|
return this;
|
|
9605
9247
|
}
|
|
9606
9248
|
setXAxis(xAxis) {
|
|
9607
9249
|
const [r, gc] = localGC();
|
|
9608
|
-
const dir = r(
|
|
9250
|
+
const dir = r(toOcDir(toVec3(xAxis)));
|
|
9609
9251
|
this.wrapped.SetXDirection(dir);
|
|
9610
9252
|
gc();
|
|
9611
9253
|
return this;
|
|
9612
9254
|
}
|
|
9613
9255
|
setYAxis(yAxis) {
|
|
9614
9256
|
const [r, gc] = localGC();
|
|
9615
|
-
const dir = r(
|
|
9257
|
+
const dir = r(toOcDir(toVec3(yAxis)));
|
|
9616
9258
|
this.wrapped.SetYDirection(dir);
|
|
9617
9259
|
gc();
|
|
9618
9260
|
return this;
|
|
9619
9261
|
}
|
|
9620
9262
|
lookAt(shape) {
|
|
9621
9263
|
const [r, gc] = localGC();
|
|
9622
|
-
|
|
9623
|
-
|
|
9624
|
-
|
|
9625
|
-
|
|
9626
|
-
|
|
9627
|
-
|
|
9628
|
-
|
|
9629
|
-
|
|
9630
|
-
|
|
9264
|
+
let lookAtPoint;
|
|
9265
|
+
if (typeof shape === "object" && "wrapped" in shape) {
|
|
9266
|
+
const bounds = getBounds(shape);
|
|
9267
|
+
lookAtPoint = [
|
|
9268
|
+
(bounds.xMin + bounds.xMax) / 2,
|
|
9269
|
+
(bounds.yMin + bounds.yMax) / 2,
|
|
9270
|
+
(bounds.zMin + bounds.zMax) / 2
|
|
9271
|
+
];
|
|
9272
|
+
} else {
|
|
9273
|
+
lookAtPoint = toVec3(shape);
|
|
9274
|
+
}
|
|
9275
|
+
const pos = this.position;
|
|
9276
|
+
const diff = vecNormalize([
|
|
9277
|
+
pos[0] - lookAtPoint[0],
|
|
9278
|
+
pos[1] - lookAtPoint[1],
|
|
9279
|
+
pos[2] - lookAtPoint[2]
|
|
9280
|
+
]);
|
|
9281
|
+
const ocDir = r(toOcDir(diff));
|
|
9631
9282
|
this.wrapped.SetDirection(ocDir);
|
|
9632
9283
|
gc();
|
|
9633
9284
|
this.autoAxes();
|
|
@@ -10015,66 +9666,6 @@ function scaleDrawing(drawing, factor, center) {
|
|
|
10015
9666
|
function mirrorDrawing(drawing, centerOrDirection, origin, mode) {
|
|
10016
9667
|
return drawing.mirror(centerOrDirection, origin, mode);
|
|
10017
9668
|
}
|
|
10018
|
-
function createPlane(origin, xDirection = null, normal = [0, 0, 1]) {
|
|
10019
|
-
const zDir = vecNormalize(normal);
|
|
10020
|
-
if (vecIsZero(zDir)) throw new Error("Plane normal must be non-zero");
|
|
10021
|
-
let xDir;
|
|
10022
|
-
if (!xDirection) {
|
|
10023
|
-
const ax3 = makeOcAx3(origin, zDir);
|
|
10024
|
-
const ocXDir = ax3.XDirection();
|
|
10025
|
-
xDir = vecNormalize([ocXDir.X(), ocXDir.Y(), ocXDir.Z()]);
|
|
10026
|
-
ocXDir.delete();
|
|
10027
|
-
ax3.delete();
|
|
10028
|
-
} else {
|
|
10029
|
-
xDir = vecNormalize(xDirection);
|
|
10030
|
-
}
|
|
10031
|
-
if (vecIsZero(xDir)) throw new Error("Plane xDir must be non-zero");
|
|
10032
|
-
const yDir = vecNormalize(vecCross(zDir, xDir));
|
|
10033
|
-
return { origin, xDir, yDir, zDir };
|
|
10034
|
-
}
|
|
10035
|
-
const PLANES_CONFIG = {
|
|
10036
|
-
XY: { xDir: [1, 0, 0], normal: [0, 0, 1] },
|
|
10037
|
-
YZ: { xDir: [0, 1, 0], normal: [1, 0, 0] },
|
|
10038
|
-
ZX: { xDir: [0, 0, 1], normal: [0, 1, 0] },
|
|
10039
|
-
XZ: { xDir: [1, 0, 0], normal: [0, -1, 0] },
|
|
10040
|
-
YX: { xDir: [0, 1, 0], normal: [0, 0, -1] },
|
|
10041
|
-
ZY: { xDir: [0, 0, 1], normal: [-1, 0, 0] },
|
|
10042
|
-
front: { xDir: [1, 0, 0], normal: [0, 0, 1] },
|
|
10043
|
-
back: { xDir: [-1, 0, 0], normal: [0, 0, -1] },
|
|
10044
|
-
left: { xDir: [0, 0, 1], normal: [-1, 0, 0] },
|
|
10045
|
-
right: { xDir: [0, 0, -1], normal: [1, 0, 0] },
|
|
10046
|
-
top: { xDir: [1, 0, 0], normal: [0, 1, 0] },
|
|
10047
|
-
bottom: { xDir: [1, 0, 0], normal: [0, -1, 0] }
|
|
10048
|
-
};
|
|
10049
|
-
function createNamedPlane(name, sourceOrigin = [0, 0, 0]) {
|
|
10050
|
-
const config = PLANES_CONFIG[name];
|
|
10051
|
-
if (!config) return err(validationError("UNKNOWN_PLANE", `Could not find plane ${name}`));
|
|
10052
|
-
let origin;
|
|
10053
|
-
if (typeof sourceOrigin === "number") {
|
|
10054
|
-
origin = vecScale(config.normal, sourceOrigin);
|
|
10055
|
-
} else {
|
|
10056
|
-
origin = toVec3(sourceOrigin);
|
|
10057
|
-
}
|
|
10058
|
-
return ok(createPlane(origin, config.xDir, config.normal));
|
|
10059
|
-
}
|
|
10060
|
-
function resolvePlane(input, origin) {
|
|
10061
|
-
if (typeof input === "string") {
|
|
10062
|
-
const result = createNamedPlane(input, origin);
|
|
10063
|
-
if (!result.ok) throw new Error(result.error.message);
|
|
10064
|
-
return result.value;
|
|
10065
|
-
}
|
|
10066
|
-
return input;
|
|
10067
|
-
}
|
|
10068
|
-
function translatePlane(plane, offset2) {
|
|
10069
|
-
return { ...plane, origin: vecAdd(plane.origin, offset2) };
|
|
10070
|
-
}
|
|
10071
|
-
function pivotPlane(plane, angleDeg, axis = [1, 0, 0]) {
|
|
10072
|
-
const angleRad = angleDeg * DEG2RAD;
|
|
10073
|
-
const newZDir = vecRotate(plane.zDir, axis, angleRad);
|
|
10074
|
-
const newXDir = vecRotate(plane.xDir, axis, angleRad);
|
|
10075
|
-
const newYDir = vecNormalize(vecCross(newZDir, newXDir));
|
|
10076
|
-
return { origin: plane.origin, xDir: newXDir, yDir: newYDir, zDir: newZDir };
|
|
10077
|
-
}
|
|
10078
9669
|
function makeSpineWire(start, end) {
|
|
10079
9670
|
const oc = getKernel().oc;
|
|
10080
9671
|
const r = gcWithScope();
|
|
@@ -10585,7 +10176,6 @@ export {
|
|
|
10585
10176
|
Blueprint,
|
|
10586
10177
|
BlueprintSketcher,
|
|
10587
10178
|
Blueprints,
|
|
10588
|
-
BoundingBox,
|
|
10589
10179
|
BoundingBox2d,
|
|
10590
10180
|
BrepBugError,
|
|
10591
10181
|
CompSolid,
|
|
@@ -10612,7 +10202,6 @@ export {
|
|
|
10612
10202
|
LinearPhysicalProperties,
|
|
10613
10203
|
_1DShape as LinearShape,
|
|
10614
10204
|
OK,
|
|
10615
|
-
Plane,
|
|
10616
10205
|
ProjectionCamera,
|
|
10617
10206
|
RAD2DEG,
|
|
10618
10207
|
Shape,
|
|
@@ -10624,8 +10213,6 @@ export {
|
|
|
10624
10213
|
_3DShape as SolidShape,
|
|
10625
10214
|
Surface,
|
|
10626
10215
|
SurfacePhysicalProperties,
|
|
10627
|
-
Transformation,
|
|
10628
|
-
Vector,
|
|
10629
10216
|
Vertex,
|
|
10630
10217
|
VolumePhysicalProperties,
|
|
10631
10218
|
Wire,
|
|
@@ -10635,8 +10222,6 @@ export {
|
|
|
10635
10222
|
addHolesInFace,
|
|
10636
10223
|
andThen,
|
|
10637
10224
|
applyGlue$1 as applyGlue,
|
|
10638
|
-
asDir,
|
|
10639
|
-
asPnt,
|
|
10640
10225
|
asTopo,
|
|
10641
10226
|
assembleWire$1 as assembleWire,
|
|
10642
10227
|
axis2d,
|
|
@@ -10669,7 +10254,6 @@ export {
|
|
|
10669
10254
|
createCamera,
|
|
10670
10255
|
createDistanceQuery,
|
|
10671
10256
|
createHandle,
|
|
10672
|
-
createNamedPlane$1 as createNamedPlane,
|
|
10673
10257
|
createOcHandle,
|
|
10674
10258
|
createPlane,
|
|
10675
10259
|
curve2dBoundingBox,
|
|
@@ -10817,9 +10401,6 @@ export {
|
|
|
10817
10401
|
loft,
|
|
10818
10402
|
loftWires,
|
|
10819
10403
|
lookFromPlane,
|
|
10820
|
-
makeAx1,
|
|
10821
|
-
makeAx2,
|
|
10822
|
-
makeAx3,
|
|
10823
10404
|
makeBSplineApproximation,
|
|
10824
10405
|
makeBaseBox,
|
|
10825
10406
|
makeBezierCurve,
|