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