@bitbybit-dev/base 1.6.2 → 1.8.0

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.
Files changed (204) hide show
  1. package/NOTICE +24 -0
  2. package/README.md +3 -1
  3. package/lib/api/GlobalCDNProvider.js +1 -1
  4. package/lib/api/inputs/base-inputs.d.ts +40 -7
  5. package/lib/api/inputs/base-inputs.js +32 -0
  6. package/lib/api/inputs/io-inputs.d.ts +927 -59
  7. package/lib/api/inputs/io-inputs.js +769 -40
  8. package/lib/api/inputs/line-inputs.d.ts +17 -0
  9. package/lib/api/inputs/line-inputs.js +15 -0
  10. package/lib/api/inputs/mesh-inputs.d.ts +20 -1
  11. package/lib/api/inputs/mesh-inputs.js +23 -0
  12. package/lib/api/inputs/recipes-inputs.d.ts +13 -5
  13. package/lib/api/inputs/recipes-inputs.js +10 -5
  14. package/lib/api/kernel-calls/index.d.ts +2 -0
  15. package/lib/api/kernel-calls/index.js +2 -0
  16. package/lib/api/kernel-calls/resolve-dto.d.ts +3 -1
  17. package/lib/api/kernel-calls/resolve-dto.js +7 -2
  18. package/lib/api/kernel-calls/settings.d.ts +101 -0
  19. package/lib/api/kernel-calls/settings.js +123 -0
  20. package/lib/api/kernel-calls/up-axis-aliases.d.ts +25 -0
  21. package/lib/api/kernel-calls/up-axis-aliases.js +70 -0
  22. package/lib/api/models/simplex.d.ts +2 -0
  23. package/lib/api/models/simplex.js +10 -1
  24. package/lib/api/recipes/surface-mesh.d.ts +2 -1
  25. package/lib/api/recipes/surface-mesh.js +5 -3
  26. package/lib/api/resolved-inputs/index.d.ts +32 -3
  27. package/lib/api/services/base-bitbybit.d.ts +12 -0
  28. package/lib/api/services/base-bitbybit.js +19 -3
  29. package/lib/api/services/color.js +2 -3
  30. package/lib/api/services/helpers/color/color-forms.constants.d.ts +3 -0
  31. package/lib/api/services/helpers/color/color-forms.constants.js +3 -0
  32. package/lib/api/services/helpers/color/color-forms.d.ts +1 -0
  33. package/lib/api/services/helpers/color/color-forms.js +4 -1
  34. package/lib/api/services/helpers/color/css-colors.constants.d.ts +9 -0
  35. package/lib/api/services/helpers/color/css-colors.constants.js +158 -0
  36. package/lib/api/services/helpers/color/css-colors.d.ts +1 -0
  37. package/lib/api/services/helpers/color/css-colors.js +61 -0
  38. package/lib/api/services/helpers/curves/bezier-pieces.constants.d.ts +5 -0
  39. package/lib/api/services/helpers/curves/bezier-pieces.constants.js +5 -0
  40. package/lib/api/services/helpers/curves/bezier-pieces.d.ts +24 -0
  41. package/lib/api/services/helpers/curves/bezier-pieces.js +149 -0
  42. package/lib/api/services/helpers/curves/conic-arcs.constants.d.ts +5 -0
  43. package/lib/api/services/helpers/curves/conic-arcs.constants.js +5 -0
  44. package/lib/api/services/helpers/curves/conic-arcs.d.ts +26 -0
  45. package/lib/api/services/helpers/curves/conic-arcs.js +87 -0
  46. package/lib/api/services/helpers/curves/nurbs-forms.d.ts +20 -0
  47. package/lib/api/services/helpers/curves/nurbs-forms.js +112 -0
  48. package/lib/api/services/helpers/curves/nurbs.d.ts +4 -0
  49. package/lib/api/services/helpers/curves/nurbs.js +10 -9
  50. package/lib/api/services/helpers/files/drawing/drawing-budget.d.ts +3 -0
  51. package/lib/api/services/helpers/files/drawing/drawing-budget.js +34 -0
  52. package/lib/api/services/helpers/files/drawing/drawing-dimension.constants.d.ts +14 -0
  53. package/lib/api/services/helpers/files/drawing/drawing-dimension.constants.js +14 -0
  54. package/lib/api/services/helpers/files/drawing/drawing-dimension.d.ts +4 -0
  55. package/lib/api/services/helpers/files/drawing/drawing-dimension.js +271 -0
  56. package/lib/api/services/helpers/files/drawing/drawing-geometry.d.ts +21 -0
  57. package/lib/api/services/helpers/files/drawing/drawing-geometry.js +101 -0
  58. package/lib/api/services/helpers/files/drawing/drawing-hatch.d.ts +10 -0
  59. package/lib/api/services/helpers/files/drawing/drawing-hatch.js +123 -0
  60. package/lib/api/services/helpers/files/drawing/drawing-loops.d.ts +3 -0
  61. package/lib/api/services/helpers/files/drawing/drawing-loops.js +91 -0
  62. package/lib/api/services/helpers/files/drawing/drawing-model.d.ts +10 -0
  63. package/lib/api/services/helpers/files/drawing/drawing-model.js +336 -0
  64. package/lib/api/services/helpers/files/drawing/drawing-scale.d.ts +2 -0
  65. package/lib/api/services/helpers/files/drawing/drawing-scale.js +47 -0
  66. package/lib/api/services/helpers/files/drawing/drawing-text.d.ts +9 -0
  67. package/lib/api/services/helpers/files/drawing/drawing-text.js +25 -0
  68. package/lib/api/services/helpers/files/drawing/drawing-types.d.ts +117 -0
  69. package/lib/api/services/helpers/files/drawing/drawing-types.js +1 -0
  70. package/lib/api/services/helpers/files/drawing/drawing.constants.d.ts +41 -0
  71. package/lib/api/services/helpers/files/drawing/drawing.constants.js +46 -0
  72. package/lib/api/services/helpers/files/dxf/dxf-annotations.d.ts +5 -0
  73. package/lib/api/services/helpers/files/dxf/dxf-annotations.js +96 -0
  74. package/lib/api/services/helpers/files/dxf/dxf-colors.d.ts +5 -0
  75. package/lib/api/services/helpers/files/dxf/dxf-colors.js +45 -0
  76. package/lib/api/services/helpers/files/dxf/dxf-entities.d.ts +21 -0
  77. package/lib/api/services/helpers/files/dxf/dxf-entities.js +196 -0
  78. package/lib/api/services/helpers/files/dxf/dxf-file-text.d.ts +1 -0
  79. package/lib/api/services/helpers/files/dxf/dxf-file-text.js +50 -0
  80. package/lib/api/services/helpers/files/dxf/dxf-generator.d.ts +2 -36
  81. package/lib/api/services/helpers/files/dxf/dxf-generator.js +97 -523
  82. package/lib/api/services/helpers/files/dxf/dxf-reader-annotations.d.ts +9 -0
  83. package/lib/api/services/helpers/files/dxf/dxf-reader-annotations.js +312 -0
  84. package/lib/api/services/helpers/files/dxf/dxf-reader-dtos.d.ts +6 -0
  85. package/lib/api/services/helpers/files/dxf/dxf-reader-dtos.js +115 -0
  86. package/lib/api/services/helpers/files/dxf/dxf-reader-geometry.d.ts +21 -0
  87. package/lib/api/services/helpers/files/dxf/dxf-reader-geometry.js +67 -0
  88. package/lib/api/services/helpers/files/dxf/dxf-reader-segments.d.ts +9 -0
  89. package/lib/api/services/helpers/files/dxf/dxf-reader-segments.js +151 -0
  90. package/lib/api/services/helpers/files/dxf/dxf-reader-types.d.ts +96 -0
  91. package/lib/api/services/helpers/files/dxf/dxf-reader-types.js +1 -0
  92. package/lib/api/services/helpers/files/dxf/dxf-reader.constants.d.ts +134 -0
  93. package/lib/api/services/helpers/files/dxf/dxf-reader.constants.js +95 -0
  94. package/lib/api/services/helpers/files/dxf/dxf-reader.d.ts +2 -0
  95. package/lib/api/services/helpers/files/dxf/dxf-reader.js +446 -0
  96. package/lib/api/services/helpers/files/dxf/dxf-tables.d.ts +29 -0
  97. package/lib/api/services/helpers/files/dxf/dxf-tables.js +248 -0
  98. package/lib/api/services/helpers/files/dxf/dxf-text.d.ts +26 -0
  99. package/lib/api/services/helpers/files/dxf/dxf-text.js +97 -0
  100. package/lib/api/services/helpers/files/dxf/dxf-tokens.d.ts +11 -0
  101. package/lib/api/services/helpers/files/dxf/dxf-tokens.js +89 -0
  102. package/lib/api/services/helpers/files/dxf/dxf.constants.d.ts +43 -1
  103. package/lib/api/services/helpers/files/dxf/dxf.constants.js +47 -1
  104. package/lib/api/services/helpers/files/file-bytes.d.ts +1 -0
  105. package/lib/api/services/helpers/files/file-bytes.js +15 -0
  106. package/lib/api/services/helpers/files/ground-axes.d.ts +2 -0
  107. package/lib/api/services/helpers/files/ground-axes.js +4 -0
  108. package/lib/api/services/helpers/files/mesh-file-axes.d.ts +7 -0
  109. package/lib/api/services/helpers/files/mesh-file-axes.js +17 -0
  110. package/lib/api/services/helpers/files/stl-axes.d.ts +4 -0
  111. package/lib/api/services/helpers/files/stl-axes.js +22 -0
  112. package/lib/api/services/helpers/files/stl-types.d.ts +7 -0
  113. package/lib/api/services/helpers/files/stl-types.js +1 -0
  114. package/lib/api/services/helpers/files/stl.constants.d.ts +11 -0
  115. package/lib/api/services/helpers/files/stl.constants.js +11 -0
  116. package/lib/api/services/helpers/files/stl.d.ts +3 -0
  117. package/lib/api/services/helpers/files/stl.js +93 -0
  118. package/lib/api/services/helpers/files/svg/svg-css.d.ts +48 -0
  119. package/lib/api/services/helpers/files/svg/svg-css.js +444 -0
  120. package/lib/api/services/helpers/files/svg/svg-dash-patterns.d.ts +2 -0
  121. package/lib/api/services/helpers/files/svg/svg-dash-patterns.js +35 -0
  122. package/lib/api/services/helpers/files/svg/svg-document.d.ts +26 -0
  123. package/lib/api/services/helpers/files/svg/svg-document.js +89 -0
  124. package/lib/api/services/helpers/files/svg/svg-memo.d.ts +1 -0
  125. package/lib/api/services/helpers/files/svg/svg-memo.js +8 -0
  126. package/lib/api/services/helpers/files/svg/svg-normalizer.d.ts +6 -0
  127. package/lib/api/services/helpers/files/svg/svg-normalizer.js +433 -0
  128. package/lib/api/services/helpers/files/svg/svg-numbers.d.ts +15 -0
  129. package/lib/api/services/helpers/files/svg/svg-numbers.js +61 -0
  130. package/lib/api/services/helpers/files/svg/svg-path-data.constants.d.ts +8 -0
  131. package/lib/api/services/helpers/files/svg/svg-path-data.constants.js +10 -0
  132. package/lib/api/services/helpers/files/svg/svg-path-data.d.ts +9 -0
  133. package/lib/api/services/helpers/files/svg/svg-path-data.js +203 -0
  134. package/lib/api/services/helpers/files/svg/svg-path-types.d.ts +33 -0
  135. package/lib/api/services/helpers/files/svg/svg-path-types.js +1 -0
  136. package/lib/api/services/helpers/files/svg/svg-reader.constants.d.ts +35 -0
  137. package/lib/api/services/helpers/files/svg/svg-reader.constants.js +35 -0
  138. package/lib/api/services/helpers/files/svg/svg-reading.constants.d.ts +9 -0
  139. package/lib/api/services/helpers/files/svg/svg-reading.constants.js +9 -0
  140. package/lib/api/services/helpers/files/svg/svg-reading.d.ts +6 -0
  141. package/lib/api/services/helpers/files/svg/svg-reading.js +233 -0
  142. package/lib/api/services/helpers/files/svg/svg-scene-types.d.ts +54 -0
  143. package/lib/api/services/helpers/files/svg/svg-scene-types.js +1 -0
  144. package/lib/api/services/helpers/files/svg/svg-shapes.d.ts +6 -0
  145. package/lib/api/services/helpers/files/svg/svg-shapes.js +102 -0
  146. package/lib/api/services/helpers/files/svg/svg-strokes.d.ts +38 -0
  147. package/lib/api/services/helpers/files/svg/svg-strokes.js +132 -0
  148. package/lib/api/services/helpers/files/svg/svg-style.d.ts +26 -0
  149. package/lib/api/services/helpers/files/svg/svg-style.js +211 -0
  150. package/lib/api/services/helpers/files/svg/svg-transform.d.ts +10 -0
  151. package/lib/api/services/helpers/files/svg/svg-transform.js +76 -0
  152. package/lib/api/services/helpers/files/svg/svg-writer.d.ts +18 -0
  153. package/lib/api/services/helpers/files/svg/svg-writer.js +230 -0
  154. package/lib/api/services/helpers/files/svg/svg-xml.d.ts +11 -0
  155. package/lib/api/services/helpers/files/svg/svg-xml.js +322 -0
  156. package/lib/api/services/helpers/files/svg/svg.constants.d.ts +14 -0
  157. package/lib/api/services/helpers/files/svg/svg.constants.js +14 -0
  158. package/lib/api/services/helpers/files/work-budget.d.ts +11 -0
  159. package/lib/api/services/helpers/files/work-budget.js +26 -0
  160. package/lib/api/services/helpers/geometry/affine2.d.ts +8 -0
  161. package/lib/api/services/helpers/geometry/affine2.js +18 -0
  162. package/lib/api/services/helpers/geometry/ellipse-arcs.d.ts +14 -0
  163. package/lib/api/services/helpers/geometry/ellipse-arcs.js +96 -0
  164. package/lib/api/services/helpers/geometry/frame-axes.d.ts +3 -1
  165. package/lib/api/services/helpers/geometry/loop-fill.d.ts +2 -0
  166. package/lib/api/services/helpers/geometry/loop-fill.js +37 -0
  167. package/lib/api/services/helpers/geometry/polygon-nesting.constants.d.ts +6 -0
  168. package/lib/api/services/helpers/geometry/polygon-nesting.constants.js +6 -0
  169. package/lib/api/services/helpers/geometry/polygon-nesting.d.ts +31 -0
  170. package/lib/api/services/helpers/geometry/polygon-nesting.js +251 -0
  171. package/lib/api/services/helpers/geometry/vectors.d.ts +1 -0
  172. package/lib/api/services/helpers/geometry/vectors.js +6 -0
  173. package/lib/api/services/helpers/helper-types.d.ts +33 -0
  174. package/lib/api/services/helpers/text/stroke-font.d.ts +6 -0
  175. package/lib/api/services/helpers/text/stroke-font.js +177 -0
  176. package/lib/api/services/helpers/text/stroke-letters.constants.d.ts +2 -0
  177. package/lib/api/services/helpers/text/stroke-letters.constants.js +18 -0
  178. package/lib/api/services/helpers/text/stroke-marks.constants.d.ts +14 -0
  179. package/lib/api/services/helpers/text/stroke-marks.constants.js +34 -0
  180. package/lib/api/services/io/drawing.d.ts +368 -0
  181. package/lib/api/services/io/drawing.js +454 -0
  182. package/lib/api/services/io/dxf.d.ts +134 -0
  183. package/lib/api/services/io/dxf.js +167 -0
  184. package/lib/api/services/io/index.d.ts +4 -0
  185. package/lib/api/services/io/index.js +4 -0
  186. package/lib/api/services/io/io.d.ts +14 -0
  187. package/lib/api/services/io/io.js +15 -0
  188. package/lib/api/services/io/svg.d.ts +66 -0
  189. package/lib/api/services/io/svg.js +105 -0
  190. package/lib/api/services/line.d.ts +17 -0
  191. package/lib/api/services/line.js +20 -1
  192. package/lib/api/services/mesh.d.ts +19 -0
  193. package/lib/api/services/mesh.js +40 -0
  194. package/lib/api/services/point.d.ts +4 -1
  195. package/lib/api/services/point.js +9 -4
  196. package/lib/api/services/recipes.d.ts +3 -0
  197. package/lib/api/services/recipes.js +6 -2
  198. package/lib/api/services/text.d.ts +7 -4
  199. package/lib/api/services/text.js +14 -27
  200. package/package.json +1 -1
  201. package/lib/api/services/helpers/files/dxf/dxf.d.ts +0 -87
  202. package/lib/api/services/helpers/files/dxf/dxf.js +0 -111
  203. package/lib/api/services/io.d.ts +0 -9
  204. package/lib/api/services/io.js +0 -10
@@ -0,0 +1,312 @@
1
+ import * as Inputs from "../../../../inputs";
2
+ import { simplex } from "../../../../models/simplex";
3
+ import { angleWithinTurn } from "../../curves/conic-arcs";
4
+ import { pointToWorld } from "../../geometry/frame-axes";
5
+ import { degreesOf, radiansOf } from "../../geometry/scalars";
6
+ import { distance2, dot2, leftOf2, polar2, scale2, subtract2 } from "../../geometry/vectors";
7
+ import { strokeFontInk, strokeTextAdvance } from "../../text/stroke-font";
8
+ import { FULL_TURN_DEGREES, LONGEST_TEXT, QUARTER_TURN_DEGREES } from "../drawing/drawing.constants";
9
+ import { mappedSegments } from "./dxf-reader-geometry";
10
+ import { ANNOTATION_GROUP, GROUP, HATCH_EDGE, HATCH_POLYLINE_FLAG, MAX_SPLINE_DEGREE, MIDDLE_DROP_SHARE, SAME_ANGLE_DEGREES, SAME_TURN, TEXT_CODES, TEXT_CONTROLS, TEXT_JUSTIFIED, TEXT_VERTICAL, } from "./dxf-reader.constants";
11
+ import { decodedText, numberIn, numberOf, textOf, valueOf } from "./dxf-tokens";
12
+ import { DXF_EXTRUSION_CODES, DXF_HATCH_NAMES, DXF_HATCH_NATIVE_ANGLE, DXF_HATCH_NATIVE_SPACING } from "./dxf.constants";
13
+ const HATCH_DEFAULTS = new Inputs.IO.DrawingHatchDto();
14
+ const NAMED_PATTERNS = new Map(Object.values(Inputs.IO.hatchPatternEnum)
15
+ .filter(pattern => pattern !== Inputs.IO.hatchPatternEnum.solid)
16
+ .map(pattern => [DXF_HATCH_NAMES[pattern].toLowerCase(), pattern]));
17
+ const CUT_SHORT = "its boundary is cut short or is not one this reads";
18
+ const TOO_HIGH_DEGREE = `its boundary holds a spline of a degree above ${MAX_SPLINE_DEGREE}, the highest a kernel curve takes`;
19
+ class Unread extends Error {
20
+ constructor(reason) {
21
+ super(reason);
22
+ this.reason = reason;
23
+ }
24
+ }
25
+ class Cursor {
26
+ constructor(groups, at) {
27
+ this.groups = groups;
28
+ this.at = at;
29
+ }
30
+ peek(ahead = 0) {
31
+ var _a;
32
+ return (_a = this.groups[this.at + ahead]) === null || _a === void 0 ? void 0 : _a.code;
33
+ }
34
+ take(code) {
35
+ return numberIn(this.next(code));
36
+ }
37
+ pass(code) {
38
+ this.next(code);
39
+ }
40
+ count(code) {
41
+ const value = this.take(code);
42
+ if (!Number.isInteger(value) || value < 0 || value > this.groups.length - this.at) {
43
+ throw new Unread(CUT_SHORT);
44
+ }
45
+ return value;
46
+ }
47
+ seek(code) {
48
+ const found = this.groups.findIndex((group, at) => at >= this.at && group.code === code);
49
+ if (found >= 0) {
50
+ this.at = found;
51
+ }
52
+ return found >= 0;
53
+ }
54
+ next(code) {
55
+ while (this.at < this.groups.length) {
56
+ const group = this.groups[this.at];
57
+ this.at += 1;
58
+ if (group.code === code) {
59
+ return group;
60
+ }
61
+ }
62
+ throw new Unread(CUT_SHORT);
63
+ }
64
+ }
65
+ export const planarTurnOf = (map) => {
66
+ const scale = Math.hypot(map.x[0], map.x[1]);
67
+ const slack = SAME_TURN * Math.max(1, scale);
68
+ const flat = Math.abs(map.x[2]) <= slack && Math.abs(map.y[2]) <= slack && Math.abs(map.z[0]) <= slack && Math.abs(map.z[1]) <= slack && map.z[2] > 0;
69
+ const square = Math.abs(map.y[0] + map.x[1]) <= slack && Math.abs(map.y[1] - map.x[0]) <= slack;
70
+ return flat && square && scale > 0 ? { scale, rotation: Math.atan2(map.x[1], map.x[0]) } : undefined;
71
+ };
72
+ export const plainDxfText = (value) => decodedText(value).replace(TEXT_CODES, (_found, code, caret) => {
73
+ if (code === undefined) {
74
+ return caret === " " ? "^" : "";
75
+ }
76
+ switch (code.toLowerCase()) {
77
+ case "%":
78
+ return "%";
79
+ case "c":
80
+ return "⌀";
81
+ case "d":
82
+ return "°";
83
+ case "p":
84
+ return "±";
85
+ case "u":
86
+ case "o":
87
+ case "k":
88
+ return "";
89
+ default:
90
+ return String.fromCharCode(Number(code));
91
+ }
92
+ }).replace(TEXT_CONTROLS, "");
93
+ const facesUp = (record) => numberOf(record, DXF_EXTRUSION_CODES[0], 0) === 0 && numberOf(record, DXF_EXTRUSION_CODES[1], 0) === 0 && numberOf(record, DXF_EXTRUSION_CODES[2], 1) > 0;
94
+ const pointAt = (record, xCode, yCode, fallback) => [numberOf(record, xCode, fallback[0]), numberOf(record, yCode, fallback[1]), 0];
95
+ const flat = (point) => [point[0], point[1]];
96
+ const verticalOf = (record, justified) => {
97
+ if (justified === TEXT_JUSTIFIED.middle) {
98
+ return TEXT_VERTICAL.middle;
99
+ }
100
+ return justified <= TEXT_JUSTIFIED.right ? numberOf(record, ANNOTATION_GROUP.verticalJustified, TEXT_VERTICAL.baseline) : TEXT_VERTICAL.baseline;
101
+ };
102
+ const dropOf = (vertical, height) => {
103
+ switch (vertical) {
104
+ case TEXT_VERTICAL.bottom:
105
+ return strokeFontInk(simplex).lowest * height;
106
+ case TEXT_VERTICAL.middle:
107
+ return MIDDLE_DROP_SHARE * height;
108
+ case TEXT_VERTICAL.top:
109
+ return height;
110
+ default:
111
+ return 0;
112
+ }
113
+ };
114
+ const baselineOf = (point, rotation, drop) => {
115
+ if (drop === 0) {
116
+ return point;
117
+ }
118
+ const lowered = subtract2(flat(point), scale2(leftOf2(polar2(1, radiansOf(rotation))), drop));
119
+ return [lowered[0], lowered[1], point[2]];
120
+ };
121
+ export const readTextOf = (record) => {
122
+ var _a;
123
+ if (!facesUp(record)) {
124
+ return "it is drawn out of the drawing's plane";
125
+ }
126
+ const value = plainDxfText((_a = valueOf(record, ANNOTATION_GROUP.text)) !== null && _a !== void 0 ? _a : "");
127
+ if (value.trim() === "") {
128
+ return undefined;
129
+ }
130
+ if (value.length > LONGEST_TEXT) {
131
+ return `its text is longer than ${LONGEST_TEXT} characters`;
132
+ }
133
+ const given = numberOf(record, ANNOTATION_GROUP.height, 0);
134
+ if (!(given > 0)) {
135
+ return "it has no height";
136
+ }
137
+ const first = pointAt(record, GROUP.x, GROUP.y, [0, 0, 0]);
138
+ const second = pointAt(record, GROUP.otherX, ANNOTATION_GROUP.otherY, first);
139
+ const justified = numberOf(record, ANNOTATION_GROUP.justified, TEXT_JUSTIFIED.left);
140
+ const natural = strokeTextAdvance(simplex, value) * given;
141
+ const span = distance2(flat(second), flat(first));
142
+ const written = numberOf(record, ANNOTATION_GROUP.widthFactor, 1);
143
+ const factor = written > 0 ? written : 1;
144
+ if ((justified === TEXT_JUSTIFIED.fit || justified === TEXT_JUSTIFIED.aligned) && span > 0 && natural > 0) {
145
+ const fitted = justified === TEXT_JUSTIFIED.fit;
146
+ return {
147
+ value,
148
+ position: first,
149
+ height: fitted ? given : given * span / (natural * factor),
150
+ anchor: "start",
151
+ rotation: degreesOf(Math.atan2(second[1] - first[1], second[0] - first[0])),
152
+ widthFactor: fitted ? span / natural : factor,
153
+ };
154
+ }
155
+ const centred = justified === TEXT_JUSTIFIED.center || justified === TEXT_JUSTIFIED.middle;
156
+ const ended = justified === TEXT_JUSTIFIED.right;
157
+ const vertical = verticalOf(record, justified);
158
+ const rotation = numberOf(record, GROUP.rotation, 0);
159
+ const aligned = centred || ended || vertical !== TEXT_VERTICAL.baseline ? second : first;
160
+ return {
161
+ value,
162
+ position: baselineOf(aligned, rotation, dropOf(vertical, given)),
163
+ height: given,
164
+ anchor: centred ? "middle" : ended ? "end" : "start",
165
+ rotation,
166
+ widthFactor: factor,
167
+ };
168
+ };
169
+ export const placedText = (text, turn, map) => (Object.assign(Object.assign({}, text), { position: pointToWorld(map, text.position), height: text.height * turn.scale, rotation: text.rotation + degreesOf(turn.rotation) }));
170
+ const arcOf = (cursor, xAxis, yAxis, center) => {
171
+ const from = cursor.take(GROUP.startAngle);
172
+ const to = cursor.take(GROUP.endAngle);
173
+ const counterclockwise = cursor.take(ANNOTATION_GROUP.counterclockwise) !== 0;
174
+ const start = counterclockwise ? from : FULL_TURN_DEGREES - to;
175
+ const end = counterclockwise ? to : FULL_TURN_DEGREES - from;
176
+ const sweep = angleWithinTurn(end - start, FULL_TURN_DEGREES);
177
+ return { kind: "conic", center, xAxis, yAxis, start: radiansOf(angleWithinTurn(start, FULL_TURN_DEGREES)), sweep: radiansOf(sweep === 0 ? FULL_TURN_DEGREES : sweep) };
178
+ };
179
+ const splineEdgeOf = (cursor) => {
180
+ const degree = cursor.take(ANNOTATION_GROUP.edgeDegree);
181
+ const rational = cursor.take(ANNOTATION_GROUP.rational) !== 0;
182
+ cursor.take(ANNOTATION_GROUP.periodic);
183
+ const knotCount = cursor.count(ANNOTATION_GROUP.knotCount);
184
+ const pointCount = cursor.count(ANNOTATION_GROUP.pointCount);
185
+ const knots = Array.from({ length: knotCount }, () => cursor.take(GROUP.knot));
186
+ const points = [];
187
+ const weights = [];
188
+ for (let at = 0; at < pointCount; at += 1) {
189
+ points.push([cursor.take(GROUP.x), cursor.take(GROUP.y), 0]);
190
+ weights.push(rational && cursor.peek() === ANNOTATION_GROUP.edgeWeight ? cursor.take(ANNOTATION_GROUP.edgeWeight) : 1);
191
+ }
192
+ if (cursor.peek() === ANNOTATION_GROUP.fitCount && (cursor.peek(1) === GROUP.otherX || cursor.peek(1) === ANNOTATION_GROUP.sources)) {
193
+ const fitted = cursor.count(ANNOTATION_GROUP.fitCount);
194
+ for (let at = 0; at < fitted; at += 1) {
195
+ cursor.take(GROUP.otherX);
196
+ cursor.take(ANNOTATION_GROUP.otherY);
197
+ }
198
+ }
199
+ if (degree > MAX_SPLINE_DEGREE) {
200
+ throw new Unread(TOO_HIGH_DEGREE);
201
+ }
202
+ if (!Number.isInteger(degree) || degree < 1 || pointCount <= degree || knots.length !== pointCount + degree + 1 || weights.some(weight => !(weight > 0))) {
203
+ throw new Unread(CUT_SHORT);
204
+ }
205
+ return { kind: "spline", curve: { degree, points, weights, knots } };
206
+ };
207
+ const edgeOf = (cursor) => {
208
+ const kind = cursor.take(ANNOTATION_GROUP.edgeType);
209
+ if (kind === HATCH_EDGE.spline) {
210
+ return splineEdgeOf(cursor);
211
+ }
212
+ const first = [cursor.take(GROUP.x), cursor.take(GROUP.y), 0];
213
+ if (kind === HATCH_EDGE.line) {
214
+ return { kind: "line", start: first, end: [cursor.take(GROUP.otherX), cursor.take(ANNOTATION_GROUP.otherY), 0] };
215
+ }
216
+ if (kind === HATCH_EDGE.arc) {
217
+ const radius = cursor.take(GROUP.radius);
218
+ return arcOf(cursor, [radius, 0, 0], [0, radius, 0], first);
219
+ }
220
+ if (kind === HATCH_EDGE.ellipse) {
221
+ const major = [cursor.take(GROUP.otherX), cursor.take(ANNOTATION_GROUP.otherY), 0];
222
+ const ratio = cursor.take(GROUP.ratio);
223
+ return arcOf(cursor, major, [-major[1] * ratio, major[0] * ratio, 0], first);
224
+ }
225
+ throw new Unread(CUT_SHORT);
226
+ };
227
+ const loopOf = (cursor) => {
228
+ const flags = cursor.take(ANNOTATION_GROUP.loopFlags);
229
+ let segments;
230
+ if ((flags & HATCH_POLYLINE_FLAG) !== 0) {
231
+ const bulged = cursor.take(ANNOTATION_GROUP.hasBulge) !== 0;
232
+ cursor.take(ANNOTATION_GROUP.closedLoop);
233
+ const count = cursor.count(ANNOTATION_GROUP.vertexCount);
234
+ const points = [];
235
+ const bulges = [];
236
+ for (let at = 0; at < count; at += 1) {
237
+ points.push([cursor.take(GROUP.x), cursor.take(GROUP.y), 0]);
238
+ bulges.push(bulged && cursor.peek() === GROUP.bulge ? cursor.take(GROUP.bulge) : 0);
239
+ }
240
+ segments = points.length < 2 ? [] : [{ kind: "polyline", points, bulges, closed: true, normal: [0, 0, 1] }];
241
+ }
242
+ else {
243
+ segments = Array.from({ length: cursor.count(ANNOTATION_GROUP.vertexCount) }, () => edgeOf(cursor));
244
+ }
245
+ const sources = cursor.count(ANNOTATION_GROUP.sources);
246
+ for (let at = 0; at < sources; at += 1) {
247
+ cursor.pass(ANNOTATION_GROUP.owner);
248
+ }
249
+ return segments;
250
+ };
251
+ const linesOf = (cursor) => {
252
+ if (!cursor.seek(ANNOTATION_GROUP.lineCount)) {
253
+ return [];
254
+ }
255
+ return Array.from({ length: cursor.count(ANNOTATION_GROUP.lineCount) }, () => {
256
+ const angle = cursor.take(ANNOTATION_GROUP.lineAngle);
257
+ cursor.take(ANNOTATION_GROUP.baseX);
258
+ cursor.take(ANNOTATION_GROUP.baseY);
259
+ const offset = [cursor.take(ANNOTATION_GROUP.offsetX), cursor.take(ANNOTATION_GROUP.offsetY)];
260
+ const dashes = cursor.count(ANNOTATION_GROUP.dashCount);
261
+ for (let at = 0; at < dashes; at += 1) {
262
+ cursor.take(ANNOTATION_GROUP.dash);
263
+ }
264
+ return { angle, spacing: Math.abs(dot2(offset, leftOf2(polar2(1, radiansOf(angle))))) };
265
+ });
266
+ };
267
+ const apart = (first, second) => {
268
+ const turned = angleWithinTurn(second - first, FULL_TURN_DEGREES / 2);
269
+ return Math.min(turned, FULL_TURN_DEGREES / 2 - turned);
270
+ };
271
+ const patternOf = (record, lines, measurement) => {
272
+ const pattern = Inputs.IO.hatchPatternEnum;
273
+ if (numberOf(record, ANNOTATION_GROUP.solid, 0) === 1) {
274
+ return { pattern: pattern.solid, angle: HATCH_DEFAULTS.angle, spacing: HATCH_DEFAULTS.spacing, simplified: false };
275
+ }
276
+ const [first, second] = lines;
277
+ if (first === undefined || !(first.spacing > 0)) {
278
+ const named = NAMED_PATTERNS.get(textOf(record, GROUP.name).toLowerCase());
279
+ const known = named !== null && named !== void 0 ? named : pattern.ansi31;
280
+ const scale = numberOf(record, ANNOTATION_GROUP.patternScale, 1);
281
+ return {
282
+ pattern: known,
283
+ angle: angleWithinTurn(DXF_HATCH_NATIVE_ANGLE + numberOf(record, ANNOTATION_GROUP.patternAngle, 0), FULL_TURN_DEGREES),
284
+ spacing: DXF_HATCH_NATIVE_SPACING[measurement][known] * (scale > 0 ? scale : 1),
285
+ simplified: named === undefined,
286
+ };
287
+ }
288
+ const paired = second !== undefined && lines.length === 2 && apart(first.angle, second.angle) <= SAME_ANGLE_DEGREES;
289
+ const crossed = second !== undefined && lines.length === 2 && Math.abs(apart(first.angle, second.angle) - QUARTER_TURN_DEGREES) <= SAME_ANGLE_DEGREES;
290
+ return { pattern: paired ? pattern.ansi32 : crossed ? pattern.ansi37 : pattern.ansi31, angle: first.angle, spacing: first.spacing, simplified: lines.length > 1 && !paired && !crossed };
291
+ };
292
+ export const readHatchOf = (record, measurement) => {
293
+ if (!facesUp(record)) {
294
+ return "it is drawn out of the drawing's plane";
295
+ }
296
+ const start = record.groups.findIndex(group => group.code === ANNOTATION_GROUP.loopCount);
297
+ if (start < 0) {
298
+ return "it has no boundary";
299
+ }
300
+ try {
301
+ const cursor = new Cursor(record.groups, start);
302
+ const boundaries = Array.from({ length: cursor.count(ANNOTATION_GROUP.loopCount) }, () => loopOf(cursor)).filter(loop => loop.length > 0);
303
+ return boundaries.length === 0 ? undefined : Object.assign(Object.assign({}, patternOf(record, linesOf(cursor), measurement)), { boundaries });
304
+ }
305
+ catch (error) {
306
+ if (error instanceof Unread) {
307
+ return error.reason;
308
+ }
309
+ throw error;
310
+ }
311
+ };
312
+ export const placedHatch = (hatch, turn, map, isPlaced) => (Object.assign(Object.assign({}, hatch), { boundaries: isPlaced ? hatch.boundaries.map(loop => loop.flatMap(segment => mappedSegments(map, segment))) : hatch.boundaries, angle: hatch.angle + degreesOf(turn.rotation), spacing: hatch.spacing * turn.scale }));
@@ -0,0 +1,6 @@
1
+ import type * as Inputs from "../../../../inputs";
2
+ import type { ReadConic, ReadDrawing } from "./dxf-reader-types";
3
+ type DxfSegment = Inputs.IO.DrawingPathDto["segments"][number];
4
+ export declare const conicSegmentDto: (conic: ReadConic) => DxfSegment | undefined;
5
+ export declare const drawingDtoOf: (drawing: ReadDrawing) => Inputs.IO.DxfDrawingDto;
6
+ export {};
@@ -0,0 +1,115 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { unitOf } from "../../geometry/frame-axes";
13
+ import { degreesOf } from "../../geometry/scalars";
14
+ import { dot3, length3 } from "../../geometry/vectors";
15
+ import { ocsAxesOf } from "../drawing/drawing-geometry";
16
+ import { polylineSegments, principalConicOf } from "./dxf-reader-geometry";
17
+ import { DXF_TURN_SLACK } from "./dxf.constants";
18
+ const AXIS_SLACK = 1e-12;
19
+ const ROUND_SHARE = 1e-12;
20
+ const alongZ = (normal) => (Math.abs(normal[0]) <= AXIS_SLACK && Math.abs(normal[1]) <= AXIS_SLACK ? Math.sign(normal[2]) : 0);
21
+ export const conicSegmentDto = (conic) => {
22
+ const principal = principalConicOf(conic);
23
+ if (principal === undefined) {
24
+ return undefined;
25
+ }
26
+ const majorLength = length3(principal.major);
27
+ const normal = alongZ(principal.normal) > 0 ? {} : { normal: principal.normal };
28
+ if (Math.abs(principal.minor - majorLength) <= ROUND_SHARE * majorLength) {
29
+ if (principal.end - principal.start >= 2 * Math.PI - DXF_TURN_SLACK) {
30
+ return Object.assign({ center: principal.center, radius: majorLength }, normal);
31
+ }
32
+ const axes = ocsAxesOf(principal.normal);
33
+ const direction = unitOf(principal.major);
34
+ const offset = Math.atan2(dot3(direction, axes.y), dot3(direction, axes.x));
35
+ return Object.assign({ center: principal.center, radius: majorLength, startAngle: degreesOf(offset + principal.start), endAngle: degreesOf(offset + principal.end) }, normal);
36
+ }
37
+ return Object.assign({ center: principal.center, majorAxis: principal.major, ratio: principal.minor / majorLength, startParameter: principal.start, endParameter: principal.end }, normal);
38
+ };
39
+ const polylineDtos = (polyline) => {
40
+ const facing = alongZ(polyline.normal);
41
+ if (polyline.bulges.every(bulge => bulge === 0)) {
42
+ return [{ points: [...polyline.points], bulges: [...polyline.bulges], closed: polyline.closed }];
43
+ }
44
+ if (facing !== 0) {
45
+ const height = polyline.points[0][2];
46
+ return [{ points: polyline.points.map((point) => [point[0], point[1], height]), bulges: polyline.bulges.map(bulge => (bulge === 0 ? 0 : facing * bulge)), closed: polyline.closed }];
47
+ }
48
+ return polylineSegments(polyline).flatMap(segmentDtos);
49
+ };
50
+ const segmentDtos = (segment) => {
51
+ switch (segment.kind) {
52
+ case "line":
53
+ return [{ start: segment.start, end: segment.end }];
54
+ case "conic":
55
+ return [conicSegmentDto(segment)];
56
+ case "polyline":
57
+ return polylineDtos(segment);
58
+ case "spline": {
59
+ const rational = segment.curve.weights.some(weight => weight !== 1);
60
+ const spline = { controlPoints: [...segment.curve.points], degree: segment.curve.degree, knots: [...segment.curve.knots] };
61
+ return [rational ? Object.assign(Object.assign({}, spline), { weights: [...segment.curve.weights] }) : spline];
62
+ }
63
+ case "fit":
64
+ return [];
65
+ }
66
+ };
67
+ export const drawingDtoOf = (drawing) => {
68
+ var _a, _b, _c;
69
+ const parts = new Map();
70
+ let fitSplines = 0;
71
+ let flatArcs = 0;
72
+ let simplified = 0;
73
+ for (const entity of drawing.entities) {
74
+ const key = `${entity.style.layer}\n${entity.style.color}\n${entity.style.lineType}`;
75
+ const part = (_a = parts.get(key)) !== null && _a !== void 0 ? _a : { layer: entity.style.layer, color: entity.style.color, lineType: entity.style.lineType, paths: [] };
76
+ parts.set(key, part);
77
+ fitSplines += entity.segments.filter(segment => segment.kind === "fit").length;
78
+ const dtos = entity.segments.flatMap(segmentDtos);
79
+ const segments = dtos.filter((dto) => dto !== undefined);
80
+ flatArcs += dtos.length - segments.length;
81
+ if (segments.length > 0) {
82
+ part.paths.push({ segments });
83
+ }
84
+ if (entity.text !== undefined) {
85
+ const _d = entity.text, { value } = _d, placed = __rest(_d, ["value"]);
86
+ const texts = (_b = part.texts) !== null && _b !== void 0 ? _b : [];
87
+ part.texts = texts;
88
+ texts.push(Object.assign({ text: value }, placed));
89
+ }
90
+ if (entity.hatch !== undefined) {
91
+ const { boundaries, pattern, angle, spacing } = entity.hatch;
92
+ const paths = boundaries.map(loop => {
93
+ const read = loop.flatMap(segmentDtos);
94
+ const kept = read.filter((dto) => dto !== undefined);
95
+ flatArcs += read.length - kept.length;
96
+ return { segments: kept };
97
+ }).filter(path => path.segments.length > 0);
98
+ simplified += entity.hatch.simplified ? 1 : 0;
99
+ if (paths.length > 0) {
100
+ const hatches = (_c = part.hatches) !== null && _c !== void 0 ? _c : [];
101
+ part.hatches = hatches;
102
+ hatches.push({ boundaries: paths, pattern, angle, spacing });
103
+ }
104
+ }
105
+ }
106
+ const simplifiedWarning = `${simplified} ${simplified === 1 ? "hatch has" : "hatches have"} a pattern other than single, paired or crossed lines; ${simplified === 1 ? "it is" : "they are"} read as single lines.`;
107
+ const fitWarning = `${fitSplines} ${fitSplines === 1 ? "spline is" : "splines are"} given only by fit points, which need a kernel to interpolate; they were left out here, and occt.io.loadDxf reads them.`;
108
+ const flatWarning = `${flatArcs} ${flatArcs === 1 ? "arc" : "arcs"} could not be drawn: a radius, a plane or a sweep is missing.`;
109
+ return {
110
+ parts: [...parts.values()].filter(part => part.paths.length > 0 || part.texts !== undefined || part.hatches !== undefined),
111
+ unit: drawing.unit,
112
+ version: drawing.version,
113
+ warnings: [...drawing.warnings, ...(fitSplines === 0 ? [] : [fitWarning]), ...(flatArcs === 0 ? [] : [flatWarning]), ...(simplified === 0 ? [] : [simplifiedWarning])],
114
+ };
115
+ };
@@ -0,0 +1,21 @@
1
+ import type * as Inputs from "../../../../inputs";
2
+ import type { FrameAxes } from "../../geometry/frame-axes";
3
+ import type { ReadConic, ReadPolyline, ReadSegment } from "./dxf-reader-types";
4
+ type Point3 = Inputs.Base.Point3;
5
+ type Vec3 = Inputs.Base.Vector3;
6
+ export interface PrincipalConic {
7
+ readonly center: Point3;
8
+ readonly normal: Vec3;
9
+ readonly major: Vec3;
10
+ readonly minor: number;
11
+ readonly start: number;
12
+ readonly end: number;
13
+ }
14
+ export declare const translation: (offset: Vec3) => FrameAxes;
15
+ export declare const scaling: (x: number, y: number, z: number) => FrameAxes;
16
+ export declare const rotationAboutZ: (radians: number) => FrameAxes;
17
+ export declare const positiveConic: (conic: ReadConic) => ReadConic;
18
+ export declare const polylineSegments: (polyline: ReadPolyline) => ReadSegment[];
19
+ export declare const mappedSegments: (map: FrameAxes, segment: ReadSegment) => ReadSegment[];
20
+ export declare const principalConicOf: (conic: ReadConic) => PrincipalConic | undefined;
21
+ export {};
@@ -0,0 +1,67 @@
1
+ import { bulgeArcOf, principalArcOf } from "../../curves/conic-arcs";
2
+ import { pointToWorld, unitOf, vectorToLocal, vectorToWorld, WORLD_AXES } from "../../geometry/frame-axes";
3
+ import { cross3, dot3, length3, scale3 } from "../../geometry/vectors";
4
+ import { ocsAxesOf } from "../drawing/drawing-geometry";
5
+ import { SAME_SCALE } from "./dxf-reader.constants";
6
+ export const translation = (offset) => (Object.assign(Object.assign({}, WORLD_AXES), { origin: offset }));
7
+ export const scaling = (x, y, z) => ({ origin: [0, 0, 0], x: [x, 0, 0], y: [0, y, 0], z: [0, 0, z] });
8
+ export const rotationAboutZ = (radians) => {
9
+ const cos = Math.cos(radians);
10
+ const sin = Math.sin(radians);
11
+ return { origin: [0, 0, 0], x: [cos, sin, 0], y: [-sin, cos, 0], z: [0, 0, 1] };
12
+ };
13
+ const determinantOf = (map) => dot3(map.x, cross3(map.y, map.z));
14
+ const isSimilarity = (map) => {
15
+ const size = length3(map.x);
16
+ const close = (a, b) => Math.abs(a - b) <= SAME_SCALE * Math.max(1, size * size);
17
+ return close(length3(map.y) * length3(map.y), size * size) && close(length3(map.z) * length3(map.z), size * size)
18
+ && close(dot3(map.x, map.y), 0) && close(dot3(map.y, map.z), 0) && close(dot3(map.z, map.x), 0);
19
+ };
20
+ export const positiveConic = (conic) => conic.sweep >= 0 ? conic : Object.assign(Object.assign({}, conic), { yAxis: scale3(conic.yAxis, -1), start: -conic.start, sweep: -conic.sweep });
21
+ export const polylineSegments = (polyline) => {
22
+ var _a, _b;
23
+ const axes = ocsAxesOf((_a = unitOf(polyline.normal)) !== null && _a !== void 0 ? _a : [0, 0, 1]);
24
+ const spans = polyline.closed ? polyline.points.length : polyline.points.length - 1;
25
+ const segments = [];
26
+ for (let span = 0; span < spans; span++) {
27
+ const start = polyline.points[span];
28
+ const end = polyline.points[(span + 1) % polyline.points.length];
29
+ const bulge = (_b = polyline.bulges[span]) !== null && _b !== void 0 ? _b : 0;
30
+ if (bulge === 0) {
31
+ segments.push({ kind: "line", start, end });
32
+ continue;
33
+ }
34
+ const arc = bulgeArcOf(vectorToLocal(axes, start), vectorToLocal(axes, end), bulge);
35
+ const radius = arc.frame.xAxis[0];
36
+ segments.push(positiveConic({ kind: "conic", center: vectorToWorld(axes, arc.frame.center), xAxis: scale3(axes.x, radius), yAxis: scale3(axes.y, radius), start: arc.start, sweep: arc.sweep }));
37
+ }
38
+ return segments;
39
+ };
40
+ export const mappedSegments = (map, segment) => {
41
+ var _a;
42
+ switch (segment.kind) {
43
+ case "line":
44
+ return [{ kind: "line", start: pointToWorld(map, segment.start), end: pointToWorld(map, segment.end) }];
45
+ case "conic":
46
+ return [Object.assign(Object.assign({}, segment), { center: pointToWorld(map, segment.center), xAxis: vectorToWorld(map, segment.xAxis), yAxis: vectorToWorld(map, segment.yAxis) })];
47
+ case "polyline": {
48
+ if (!isSimilarity(map)) {
49
+ return polylineSegments(segment).flatMap(part => mappedSegments(map, part));
50
+ }
51
+ const normal = (_a = unitOf(vectorToWorld(map, segment.normal))) !== null && _a !== void 0 ? _a : [0, 0, 1];
52
+ return [Object.assign(Object.assign({}, segment), { points: segment.points.map(point => pointToWorld(map, point)), normal: determinantOf(map) < 0 ? scale3(normal, -1) : normal })];
53
+ }
54
+ case "spline":
55
+ return [{ kind: "spline", curve: Object.assign(Object.assign({}, segment.curve), { points: segment.curve.points.map(point => pointToWorld(map, point)) }) }];
56
+ case "fit":
57
+ return [Object.assign(Object.assign({}, segment), { points: segment.points.map(point => pointToWorld(map, point)), startTangent: segment.startTangent === undefined ? undefined : vectorToWorld(map, segment.startTangent), endTangent: segment.endTangent === undefined ? undefined : vectorToWorld(map, segment.endTangent) })];
58
+ }
59
+ };
60
+ export const principalConicOf = (conic) => {
61
+ const normal = unitOf(cross3(conic.xAxis, conic.yAxis));
62
+ if (normal === undefined) {
63
+ return undefined;
64
+ }
65
+ const principal = principalArcOf({ frame: { center: conic.center, xAxis: conic.xAxis, yAxis: conic.yAxis }, start: conic.start, sweep: conic.sweep });
66
+ return { center: conic.center, normal, major: principal.frame.xAxis, minor: length3(principal.frame.yAxis), start: principal.start, end: principal.start + conic.sweep };
67
+ };
@@ -0,0 +1,9 @@
1
+ import type * as Inputs from "../../../../inputs";
2
+ import type { DxfEntityRecord, OwnSegments, ReadSegment } from "./dxf-reader-types";
3
+ type Point3 = Inputs.Base.Point3;
4
+ type Vec3 = Inputs.Base.Vector3;
5
+ export declare const segmentWork: (segment: ReadSegment) => number;
6
+ export declare const recordPointOf: (record: DxfEntityRecord, codes: readonly number[], fallback?: Point3) => Point3;
7
+ export declare const recordNormalOf: (record: DxfEntityRecord) => Vec3;
8
+ export declare const readSegmentsOf: (record: DxfEntityRecord) => OwnSegments;
9
+ export {};