@ifc-lite/drawing-2d 2.0.0 → 2.1.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.
- package/dist/color-raster.d.ts +95 -0
- package/dist/color-raster.d.ts.map +1 -0
- package/dist/color-raster.js +225 -0
- package/dist/color-raster.js.map +1 -0
- package/dist/drawing-generator.d.ts +12 -0
- package/dist/drawing-generator.d.ts.map +1 -1
- package/dist/drawing-generator.js +13 -4
- package/dist/drawing-generator.js.map +1 -1
- package/dist/edge-extractor.d.ts +17 -0
- package/dist/edge-extractor.d.ts.map +1 -1
- package/dist/edge-extractor.js +95 -0
- package/dist/edge-extractor.js.map +1 -1
- package/dist/half-space-clip.d.ts +77 -0
- package/dist/half-space-clip.d.ts.map +1 -0
- package/dist/half-space-clip.js +257 -0
- package/dist/half-space-clip.js.map +1 -0
- package/dist/hidden-line-raster.d.ts +11 -2
- package/dist/hidden-line-raster.d.ts.map +1 -1
- package/dist/hidden-line-raster.js +7 -58
- package/dist/hidden-line-raster.js.map +1 -1
- package/dist/index.d.ts +11 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -1
- package/dist/index.js.map +1 -1
- package/dist/pdf-scale.d.ts +17 -0
- package/dist/pdf-scale.d.ts.map +1 -1
- package/dist/pdf-scale.js +38 -0
- package/dist/pdf-scale.js.map +1 -1
- package/dist/raster-core.d.ts +71 -0
- package/dist/raster-core.d.ts.map +1 -0
- package/dist/raster-core.js +89 -0
- package/dist/raster-core.js.map +1 -0
- package/dist/sheet/index.d.ts +2 -0
- package/dist/sheet/index.d.ts.map +1 -1
- package/dist/sheet/index.js +1 -0
- package/dist/sheet/index.js.map +1 -1
- package/dist/sheet/scale-stamp.d.ts +130 -0
- package/dist/sheet/scale-stamp.d.ts.map +1 -0
- package/dist/sheet/scale-stamp.js +277 -0
- package/dist/sheet/scale-stamp.js.map +1 -0
- package/dist/view-plane.d.ts +99 -0
- package/dist/view-plane.d.ts.map +1 -0
- package/dist/view-plane.js +183 -0
- package/dist/view-plane.js.map +1 -0
- package/dist/world-line-seeds.d.ts +41 -0
- package/dist/world-line-seeds.d.ts.map +1 -0
- package/dist/world-line-seeds.js +43 -0
- package/dist/world-line-seeds.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* The scale record a to-scale sheet carries on the paper itself: a drawn scale
|
|
6
|
+
* bar plus the "1:N" text, laid out in millimetres in a band below the drawing
|
|
7
|
+
* (issue #2042).
|
|
8
|
+
*
|
|
9
|
+
* WHY A SHEET WITHOUT THIS IS DANGEROUS. A to-scale PDF whose only record of
|
|
10
|
+
* its scale is its filename says nothing once it is printed. The whole promise
|
|
11
|
+
* of the export is "measurements taken off the print are correct", and a sheet
|
|
12
|
+
* that carries no scale invites someone to measure it at an assumed one. The
|
|
13
|
+
* printed ratio fixes that for the original; the BAR fixes it for every copy
|
|
14
|
+
* after, because a photocopier that shrinks a sheet to 94% shrinks the bar with
|
|
15
|
+
* it while the text "1:100" keeps claiming a scale the paper no longer has.
|
|
16
|
+
* Those are two different failures, so the sheet carries both.
|
|
17
|
+
*
|
|
18
|
+
* WHAT THIS FILE MUST NEVER DO — the reason it exists as layout maths and not
|
|
19
|
+
* as a sheet template. `sheet-types.ts`'s `calculateDrawingTransform` fits a
|
|
20
|
+
* drawing into a fixed viewport (`fitScale = min(scaleX, scaleY, 1)`), which
|
|
21
|
+
* silently shrinks it. Adding furniture through anything that re-fits would
|
|
22
|
+
* turn an exact sheet into a plausible-looking wrong one, which is the single
|
|
23
|
+
* defect this whole feature exists to prevent. So the band is added by GROWING
|
|
24
|
+
* the page down (and right, only if the stamp is wider than the drawing) and
|
|
25
|
+
* the drawing's `PdfScaleTransform` is passed through untouched — same
|
|
26
|
+
* `worldToMm`, same offsets, same object. Adding a scale bar cannot move a
|
|
27
|
+
* single millimetre of the drawing, by construction rather than by care.
|
|
28
|
+
*
|
|
29
|
+
* The emission is deliberately not here: these are plain rectangles and text
|
|
30
|
+
* runs in page millimetres, so the viewer can write them with jsPDF while the
|
|
31
|
+
* sibling renderers in this folder keep emitting SVG strings.
|
|
32
|
+
*/
|
|
33
|
+
import { formatScaleFactorLabel, formatSheetScaleLabel, } from '../pdf-scale.js';
|
|
34
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
35
|
+
// LAYOUT CONSTANTS (millimetres on paper, at any scale)
|
|
36
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
37
|
+
const BAR_TOP_GAP_MM = 4;
|
|
38
|
+
const BAR_HEIGHT_MM = 2.5;
|
|
39
|
+
const TICK_LABEL_GAP_MM = 1;
|
|
40
|
+
const TICK_LABEL_HEIGHT_MM = 2.5;
|
|
41
|
+
const RATIO_TEXT_GAP_MM = 1.5;
|
|
42
|
+
const RATIO_TEXT_HEIGHT_MM = 3.5;
|
|
43
|
+
const BOTTOM_PAD_MM = 2;
|
|
44
|
+
/** Height of the whole band. Independent of scale, bar length and page size. */
|
|
45
|
+
export const SCALE_STAMP_HEIGHT_MM = BAR_TOP_GAP_MM +
|
|
46
|
+
BAR_HEIGHT_MM +
|
|
47
|
+
TICK_LABEL_GAP_MM +
|
|
48
|
+
TICK_LABEL_HEIGHT_MM +
|
|
49
|
+
RATIO_TEXT_GAP_MM +
|
|
50
|
+
RATIO_TEXT_HEIGHT_MM +
|
|
51
|
+
BOTTOM_PAD_MM;
|
|
52
|
+
/** Shortest bar worth printing: below this the divisions stop being readable. */
|
|
53
|
+
const MIN_BAR_WIDTH_MM = 20;
|
|
54
|
+
/** What a bar is aimed at when there is room, mm. */
|
|
55
|
+
const TARGET_BAR_WIDTH_MM = 60;
|
|
56
|
+
/**
|
|
57
|
+
* Division lengths a surveyor would recognise, in metres. The 1-2-5 sequence
|
|
58
|
+
* is what keeps the labels round ("0 1 2 3 4 m") instead of "0 1.27 2.54"; a
|
|
59
|
+
* bar whose ticks fall on arbitrary numbers is measurable but unreadable.
|
|
60
|
+
*/
|
|
61
|
+
const DIVISION_STEPS_M = [
|
|
62
|
+
0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000,
|
|
63
|
+
];
|
|
64
|
+
/** Division counts, most preferred first. */
|
|
65
|
+
const DIVISION_COUNTS = [4, 2];
|
|
66
|
+
/**
|
|
67
|
+
* Width of one character as a fraction of the text height. Helvetica averages
|
|
68
|
+
* about 0.5 em, so this OVER-estimates on purpose: the only thing it decides
|
|
69
|
+
* is whether the page has to grow to hold the band, and over-estimating leaves
|
|
70
|
+
* blank paper while under-estimating would run a label off the sheet.
|
|
71
|
+
*/
|
|
72
|
+
const TEXT_WIDTH_PER_HEIGHT = 0.62;
|
|
73
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
74
|
+
// BUILD
|
|
75
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
76
|
+
/**
|
|
77
|
+
* Lay out a scale bar and its ratio text with their top-left corner at
|
|
78
|
+
* (`originXMm`, `originYMm`).
|
|
79
|
+
*
|
|
80
|
+
* Throws on a non-finite or non-positive `worldToMm` and on non-finite
|
|
81
|
+
* placement: a stamp is the sheet's statement about its own scale, so emitting
|
|
82
|
+
* one from numbers that do not describe a scale would be worse than emitting
|
|
83
|
+
* none at all.
|
|
84
|
+
*/
|
|
85
|
+
export function buildScaleStamp(options) {
|
|
86
|
+
const { worldToMm, availableWidthMm, originXMm, originYMm } = options;
|
|
87
|
+
if (!Number.isFinite(worldToMm) || worldToMm <= 0) {
|
|
88
|
+
throw new Error(`Invalid scale for a scale bar: ${worldToMm} mm per metre. Expected a positive finite number.`);
|
|
89
|
+
}
|
|
90
|
+
if (!Number.isFinite(availableWidthMm) ||
|
|
91
|
+
!Number.isFinite(originXMm) ||
|
|
92
|
+
!Number.isFinite(originYMm)) {
|
|
93
|
+
throw new Error('Invalid scale bar placement: origin and available width must be finite.');
|
|
94
|
+
}
|
|
95
|
+
const { divisions, divisionMetres } = chooseBarDivisions(worldToMm, availableWidthMm);
|
|
96
|
+
const divisionWidthMm = divisionMetres * worldToMm;
|
|
97
|
+
const barWidthMm = divisions * divisionWidthMm;
|
|
98
|
+
const barTopMm = originYMm + BAR_TOP_GAP_MM;
|
|
99
|
+
// Alternating filled and hollow divisions: the classic bar, and the one that
|
|
100
|
+
// still reads at a glance after a photocopy has washed out the tick labels.
|
|
101
|
+
const rects = [];
|
|
102
|
+
for (let i = 0; i < divisions; i++) {
|
|
103
|
+
rects.push({
|
|
104
|
+
xMm: originXMm + i * divisionWidthMm,
|
|
105
|
+
yMm: barTopMm,
|
|
106
|
+
widthMm: divisionWidthMm,
|
|
107
|
+
heightMm: BAR_HEIGHT_MM,
|
|
108
|
+
filled: i % 2 === 0,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
const tickBaselineMm = barTopMm + BAR_HEIGHT_MM + TICK_LABEL_GAP_MM + TICK_LABEL_HEIGHT_MM;
|
|
112
|
+
const texts = [];
|
|
113
|
+
for (let i = 0; i <= divisions; i++) {
|
|
114
|
+
const metres = i * divisionMetres;
|
|
115
|
+
// Same rounding rule as the ratio below (2 dp, trailing zeros trimmed):
|
|
116
|
+
// one rule for every number this package prints on a sheet, rather than a
|
|
117
|
+
// second one here that could disagree about, say, 0.30000000000000004.
|
|
118
|
+
const value = formatScaleFactorLabel(metres);
|
|
119
|
+
texts.push({
|
|
120
|
+
// The unit rides on the last label only: repeating "m" under every tick
|
|
121
|
+
// is clutter, and omitting it everywhere leaves the bar unitless.
|
|
122
|
+
text: i === divisions ? `${value} m` : value,
|
|
123
|
+
xMm: originXMm + i * divisionWidthMm,
|
|
124
|
+
yMm: tickBaselineMm,
|
|
125
|
+
align: 'center',
|
|
126
|
+
heightMm: TICK_LABEL_HEIGHT_MM,
|
|
127
|
+
metres,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
// The ratio goes through the shared formatter, so a 1:99.5 sheet prints
|
|
131
|
+
// "1:99.5" and never the materially different "1:100" (#2119). `worldToMm`
|
|
132
|
+
// IS the scale the drawing was laid out at, so deriving the label from it
|
|
133
|
+
// rather than from a separately passed factor removes the whole class of
|
|
134
|
+
// sheet-says-one-thing-drawn-at-another defects.
|
|
135
|
+
//
|
|
136
|
+
// And when 2 decimals cannot hold the factor — "as displayed" delivers
|
|
137
|
+
// 1:87.3456 — the label says "about", because a bare "1:87.35" would be a
|
|
138
|
+
// number an engineer trusts and should not. The bar below it stays exact.
|
|
139
|
+
const scaleLabel = formatSheetScaleLabel(1000 / worldToMm);
|
|
140
|
+
const ratioBaselineMm = tickBaselineMm + RATIO_TEXT_GAP_MM + RATIO_TEXT_HEIGHT_MM;
|
|
141
|
+
texts.push({
|
|
142
|
+
text: `Scale ${scaleLabel}`,
|
|
143
|
+
xMm: originXMm,
|
|
144
|
+
yMm: ratioBaselineMm,
|
|
145
|
+
align: 'left',
|
|
146
|
+
heightMm: RATIO_TEXT_HEIGHT_MM,
|
|
147
|
+
metres: null,
|
|
148
|
+
});
|
|
149
|
+
return {
|
|
150
|
+
bar: {
|
|
151
|
+
xMm: originXMm,
|
|
152
|
+
yMm: barTopMm,
|
|
153
|
+
widthMm: barWidthMm,
|
|
154
|
+
heightMm: BAR_HEIGHT_MM,
|
|
155
|
+
divisions,
|
|
156
|
+
divisionMetres,
|
|
157
|
+
divisionWidthMm,
|
|
158
|
+
},
|
|
159
|
+
rects,
|
|
160
|
+
texts,
|
|
161
|
+
widthMm: stampWidthMm(originXMm, barWidthMm, texts),
|
|
162
|
+
heightMm: SCALE_STAMP_HEIGHT_MM,
|
|
163
|
+
scaleLabel,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Grow `base` by a scale band under the drawing.
|
|
168
|
+
*
|
|
169
|
+
* The page gains exactly `SCALE_STAMP_HEIGHT_MM` of height, and width only if
|
|
170
|
+
* the band is wider than the drawing. The transform is returned as it came in
|
|
171
|
+
* — see {@link StampedSheetLayout.transform}.
|
|
172
|
+
*
|
|
173
|
+
* PRECONDITION on `marginMm`: the bar's end tick labels are centred on their
|
|
174
|
+
* ticks, so roughly half a label hangs past each end of the bar. The margin has
|
|
175
|
+
* to absorb that. Zero (or a very small) margin is accepted by the guard below
|
|
176
|
+
* and lays the band out correctly, but the outermost label can then sit partly
|
|
177
|
+
* off the page. The export path passes `VIEW_PDF_MARGIN_MM` (10 mm), which is
|
|
178
|
+
* comfortably more than any label produced by the 1-2-5 division sequence.
|
|
179
|
+
* This is a cosmetic bound only: it does not move the bar, so a division still
|
|
180
|
+
* measures exactly its labelled world length whatever the margin.
|
|
181
|
+
*/
|
|
182
|
+
export function addScaleStamp(base, options) {
|
|
183
|
+
const { marginMm } = options;
|
|
184
|
+
if (!Number.isFinite(marginMm) || marginMm < 0) {
|
|
185
|
+
throw new Error(`Invalid sheet margin: ${marginMm}mm. Expected a non-negative finite number.`);
|
|
186
|
+
}
|
|
187
|
+
if (!Number.isFinite(base.page.widthMm) || !Number.isFinite(base.page.heightMm) ||
|
|
188
|
+
base.page.widthMm <= 0 || base.page.heightMm <= 0) {
|
|
189
|
+
throw new Error('Cannot add a scale bar to a page that has no usable size.');
|
|
190
|
+
}
|
|
191
|
+
const stamp = buildScaleStamp({
|
|
192
|
+
worldToMm: base.transform.worldToMm,
|
|
193
|
+
availableWidthMm: Math.max(0, base.page.widthMm - marginMm * 2),
|
|
194
|
+
originXMm: marginMm,
|
|
195
|
+
// The drawing's bottom edge: `computePdfScaleLayout` puts it exactly one
|
|
196
|
+
// margin above the page bottom, so the band starts where the ink stops.
|
|
197
|
+
originYMm: base.page.heightMm - marginMm,
|
|
198
|
+
});
|
|
199
|
+
const page = {
|
|
200
|
+
widthMm: Math.max(base.page.widthMm, marginMm * 2 + stamp.widthMm),
|
|
201
|
+
heightMm: base.page.heightMm + stamp.heightMm,
|
|
202
|
+
};
|
|
203
|
+
if (!Number.isFinite(page.widthMm) || !Number.isFinite(page.heightMm)) {
|
|
204
|
+
throw new Error(`Adding a scale bar produced a non-finite page (${page.widthMm}x${page.heightMm}mm).`);
|
|
205
|
+
}
|
|
206
|
+
return { page, transform: base.transform, stamp };
|
|
207
|
+
}
|
|
208
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
209
|
+
// INTERNALS
|
|
210
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
211
|
+
/**
|
|
212
|
+
* Pick the division count and length whose bar comes closest to
|
|
213
|
+
* `TARGET_BAR_WIDTH_MM` without exceeding the space available.
|
|
214
|
+
*
|
|
215
|
+
* When nothing readable fits — a drawing narrower than the shortest useful bar
|
|
216
|
+
* — the shortest readable bar wins anyway and the caller's page grows to hold
|
|
217
|
+
* it. A bar squeezed to 3 mm would be present, in scale, and useless, which is
|
|
218
|
+
* the one outcome worse than a slightly wider sheet.
|
|
219
|
+
*/
|
|
220
|
+
function chooseBarDivisions(worldToMm, availableWidthMm) {
|
|
221
|
+
let fitting = null;
|
|
222
|
+
let fittingScore = Infinity;
|
|
223
|
+
let smallest = null;
|
|
224
|
+
let smallestWidth = Infinity;
|
|
225
|
+
let largest = null;
|
|
226
|
+
let largestWidth = -Infinity;
|
|
227
|
+
for (const divisions of DIVISION_COUNTS) {
|
|
228
|
+
for (const divisionMetres of DIVISION_STEPS_M) {
|
|
229
|
+
const widthMm = divisions * divisionMetres * worldToMm;
|
|
230
|
+
if (!Number.isFinite(widthMm) || widthMm <= 0)
|
|
231
|
+
continue;
|
|
232
|
+
const candidate = { divisions, divisionMetres };
|
|
233
|
+
if (widthMm > largestWidth) {
|
|
234
|
+
largest = candidate;
|
|
235
|
+
largestWidth = widthMm;
|
|
236
|
+
}
|
|
237
|
+
if (widthMm >= MIN_BAR_WIDTH_MM && widthMm < smallestWidth) {
|
|
238
|
+
smallest = candidate;
|
|
239
|
+
smallestWidth = widthMm;
|
|
240
|
+
}
|
|
241
|
+
if (widthMm >= MIN_BAR_WIDTH_MM && widthMm <= availableWidthMm) {
|
|
242
|
+
const score = Math.abs(widthMm - TARGET_BAR_WIDTH_MM);
|
|
243
|
+
if (score < fittingScore) {
|
|
244
|
+
fitting = candidate;
|
|
245
|
+
fittingScore = score;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
const chosen = fitting ?? smallest ?? largest;
|
|
251
|
+
if (!chosen) {
|
|
252
|
+
throw new Error(`No scale bar length is expressible at ${worldToMm} mm per metre. Choose a less extreme scale.`);
|
|
253
|
+
}
|
|
254
|
+
return chosen;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* How far right of `originXMm` the band reaches — the number that decides
|
|
258
|
+
* whether the page has to grow.
|
|
259
|
+
*
|
|
260
|
+
* Tick labels are deliberately NOT counted. Each is centred on its tick, so the
|
|
261
|
+
* last one overhangs the bar's end by half its width: about 2 mm of a 10 mm
|
|
262
|
+
* margin, on blank paper, and counting it would widen every sheet by that much
|
|
263
|
+
* for nothing. Only the bar and the left-aligned runs can actually reach past
|
|
264
|
+
* the drawing.
|
|
265
|
+
*/
|
|
266
|
+
function stampWidthMm(originXMm, barWidthMm, texts) {
|
|
267
|
+
let right = originXMm + barWidthMm;
|
|
268
|
+
for (const text of texts) {
|
|
269
|
+
if (text.align !== 'left')
|
|
270
|
+
continue;
|
|
271
|
+
const textRight = text.xMm + text.text.length * text.heightMm * TEXT_WIDTH_PER_HEIGHT;
|
|
272
|
+
if (textRight > right)
|
|
273
|
+
right = textRight;
|
|
274
|
+
}
|
|
275
|
+
return right - originXMm;
|
|
276
|
+
}
|
|
277
|
+
//# sourceMappingURL=scale-stamp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scale-stamp.js","sourceRoot":"","sources":["../../src/sheet/scale-stamp.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;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YACD,IAAI,OAAO,IAAI,gBAAgB,IAAI,OAAO,IAAI,gBAAgB,EAAE,CAAC;gBAC/D,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,mBAAmB,CAAC,CAAC;gBACtD,IAAI,KAAK,GAAG,YAAY,EAAE,CAAC;oBACzB,OAAO,GAAG,SAAS,CAAC;oBACpB,YAAY,GAAG,KAAK,CAAC;gBACvB,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,IAAI,QAAQ,IAAI,OAAO,CAAC;IAC9C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,yCAAyC,SAAS,6CAA6C,CAChG,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,YAAY,CACnB,SAAiB,EACjB,UAAkB,EAClB,KAAgC;IAEhC,IAAI,KAAK,GAAG,SAAS,GAAG,UAAU,CAAC;IACnC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,KAAK,KAAK,MAAM;YAAE,SAAS;QACpC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,GAAG,qBAAqB,CAAC;QACtF,IAAI,SAAS,GAAG,KAAK;YAAE,KAAK,GAAG,SAAS,CAAC;IAC3C,CAAC;IACD,OAAO,KAAK,GAAG,SAAS,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Camera-derived section plane for exporting the 3D viewport as a to-scale
|
|
3
|
+
* vector PDF (issue #2042).
|
|
4
|
+
*
|
|
5
|
+
* # Defect class this module guards against
|
|
6
|
+
* A "1:100" page that is dimensionally plausible but geometrically wrong —
|
|
7
|
+
* **mirrored, skewed, or off-page**. Every one of those comes from the same
|
|
8
|
+
* root cause: the drawing basis and the page transform disagreeing.
|
|
9
|
+
*
|
|
10
|
+
* - **Skew / wrong scale.** `projectTo2DBasis` is a plain pair of dot
|
|
11
|
+
* products; it is a *rigid* projection only when `tangent`/`bitangent`
|
|
12
|
+
* are unit-length AND mutually orthogonal AND perpendicular to the view
|
|
13
|
+
* normal. An `up` vector taken verbatim from an orbiting camera is
|
|
14
|
+
* generally NOT perpendicular to the view direction, so using it raw
|
|
15
|
+
* stretches one screen axis: a wall measured on the print then reads
|
|
16
|
+
* (say) 0.97 m instead of 1.00 m — a defect an engineer only discovers
|
|
17
|
+
* with a ruler. The basis built here is re-orthogonalised, so
|
|
18
|
+
* `|projected(a) − projected(b)| == |a − b|` exactly for any two points
|
|
19
|
+
* lying in a plane parallel to the drawing plane.
|
|
20
|
+
* - **Mirroring** (the #2119 defect class). The basis is fixed as
|
|
21
|
+
* `cross(tangent, bitangent) === normal`, with `tangent` = screen-right
|
|
22
|
+
* and `bitangent` = screen-up, so a point to the right of the camera
|
|
23
|
+
* target lands to the right of the page centre after `worldPointToPdfMm`
|
|
24
|
+
* (which applies the paper Y flip, and only that).
|
|
25
|
+
* - **Off-page geometry.** The plane is placed strictly IN FRONT of all
|
|
26
|
+
* eight world-bounds corners along the view direction, so every point of
|
|
27
|
+
* the model has a positive view depth inside `[0, viewDepth]` — the
|
|
28
|
+
* window the depth raster and the projection bands both key off. A plane
|
|
29
|
+
* placed inside the model would silently cut away half the drawing.
|
|
30
|
+
*
|
|
31
|
+
* The camera is treated as an ORTHOGRAPHIC (parallel) projection along
|
|
32
|
+
* `position → target`. That is the only scale-truthful reading of "print
|
|
33
|
+
* what I see at 1:N": a perspective image has no single scale.
|
|
34
|
+
*
|
|
35
|
+
* All world coordinates are in the same metric, RTC-shifted world space as
|
|
36
|
+
* `MeshData.positions` + `MeshData.origin` (WebGL Y-up, metres).
|
|
37
|
+
*/
|
|
38
|
+
import type { MeshData } from '@ifc-lite/geometry';
|
|
39
|
+
import type { SectionPlaneConfig, Vec3 } from './types.js';
|
|
40
|
+
/** The subset of a 3D camera the parallel projection actually needs. */
|
|
41
|
+
export interface CameraFrame {
|
|
42
|
+
/** Eye position (world, metres). */
|
|
43
|
+
position: Vec3;
|
|
44
|
+
/** Orbit target / look-at point (world, metres). */
|
|
45
|
+
target: Vec3;
|
|
46
|
+
/** Camera up hint. Need NOT be perpendicular to the view direction — it is
|
|
47
|
+
* re-orthogonalised here — but must not be the zero vector. */
|
|
48
|
+
up: Vec3;
|
|
49
|
+
}
|
|
50
|
+
/** An axis-aligned world-space box (absolute world coords, metres). */
|
|
51
|
+
export interface WorldBounds3D {
|
|
52
|
+
min: Vec3;
|
|
53
|
+
max: Vec3;
|
|
54
|
+
}
|
|
55
|
+
/** A synthetic section plane standing in for the camera. */
|
|
56
|
+
export interface CameraSectionPlane {
|
|
57
|
+
/**
|
|
58
|
+
* Plane config whose `customPlane` carries the orthonormal camera basis.
|
|
59
|
+
* `flipped` is always `false` and `normal = −viewDir`, so the whole model
|
|
60
|
+
* sits on the KEPT (negative signed-depth) side and every point's VIEW
|
|
61
|
+
* depth `−signedDepth(p, plane)` is in `(0, viewDepth)`.
|
|
62
|
+
*/
|
|
63
|
+
plane: SectionPlaneConfig;
|
|
64
|
+
/**
|
|
65
|
+
* Depth of the kept window along the view direction — the model's full
|
|
66
|
+
* extent plus padding on both ends. Feed it to `SectionConfig`'s
|
|
67
|
+
* `projectionBelowDepth` (with a tiny `projectionAboveDepth`) so the whole
|
|
68
|
+
* model projects as solid, and to the hidden-line occluder depth.
|
|
69
|
+
*/
|
|
70
|
+
viewDepth: number;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* World-space AABB of `meshes`, folding each mesh's local frame:
|
|
74
|
+
* `world = origin + positions[3i..3i+3]`.
|
|
75
|
+
*
|
|
76
|
+
* Reading `positions` without adding `origin` is the standing local-frame
|
|
77
|
+
* defect in this codebase (see `MeshData.origin`): it reports a box around
|
|
78
|
+
* the model ORIGIN instead of around the model, which would place the
|
|
79
|
+
* synthetic camera plane in the wrong place entirely.
|
|
80
|
+
*
|
|
81
|
+
* Returns `null` when no mesh contributes a vertex — the caller must decide
|
|
82
|
+
* what an empty view means rather than receive an inverted/infinite box.
|
|
83
|
+
*/
|
|
84
|
+
export declare function worldBoundsOfMeshes(meshes: readonly MeshData[]): WorldBounds3D | null;
|
|
85
|
+
/** The eight corners of a world AABB, in a fixed order. */
|
|
86
|
+
export declare function worldBoundsCorners(bounds: WorldBounds3D): Vec3[];
|
|
87
|
+
/**
|
|
88
|
+
* Build the synthetic section plane that represents the current camera view.
|
|
89
|
+
*
|
|
90
|
+
* @param camera World-space eye/target/up.
|
|
91
|
+
* @param worldBounds World AABB of everything that will be drawn (see
|
|
92
|
+
* {@link worldBoundsOfMeshes}).
|
|
93
|
+
*
|
|
94
|
+
* @throws when the camera degenerates (eye == target) or the bounds are
|
|
95
|
+
* non-finite — both would otherwise yield a NaN transform and a
|
|
96
|
+
* blank-but-plausible PDF page.
|
|
97
|
+
*/
|
|
98
|
+
export declare function buildCameraSectionPlane(camera: CameraFrame, worldBounds: WorldBounds3D): CameraSectionPlane;
|
|
99
|
+
//# sourceMappingURL=view-plane.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-plane.d.ts","sourceRoot":"","sources":["../src/view-plane.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAe,kBAAkB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAOxE,wEAAwE;AACxE,MAAM,WAAW,WAAW;IAC1B,oCAAoC;IACpC,QAAQ,EAAE,IAAI,CAAC;IACf,oDAAoD;IACpD,MAAM,EAAE,IAAI,CAAC;IACb;oEACgE;IAChE,EAAE,EAAE,IAAI,CAAC;CACV;AAED,uEAAuE;AACvE,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,IAAI,CAAC;IACV,GAAG,EAAE,IAAI,CAAC;CACX;AAED,4DAA4D;AAC5D,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,KAAK,EAAE,kBAAkB,CAAC;IAC1B;;;;;OAKG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,GAAG,aAAa,GAAG,IAAI,CA4BrF;AAED,2DAA2D;AAC3D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,EAAE,CAWhE;AAoBD;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,WAAW,EACnB,WAAW,EAAE,aAAa,GACzB,kBAAkB,CA6FpB"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
import { vec3, vec3Cross, vec3Dot, vec3Length, vec3Normalize, vec3Sub } from './math.js';
|
|
5
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
6
|
+
// WORLD BOUNDS
|
|
7
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
8
|
+
/**
|
|
9
|
+
* World-space AABB of `meshes`, folding each mesh's local frame:
|
|
10
|
+
* `world = origin + positions[3i..3i+3]`.
|
|
11
|
+
*
|
|
12
|
+
* Reading `positions` without adding `origin` is the standing local-frame
|
|
13
|
+
* defect in this codebase (see `MeshData.origin`): it reports a box around
|
|
14
|
+
* the model ORIGIN instead of around the model, which would place the
|
|
15
|
+
* synthetic camera plane in the wrong place entirely.
|
|
16
|
+
*
|
|
17
|
+
* Returns `null` when no mesh contributes a vertex — the caller must decide
|
|
18
|
+
* what an empty view means rather than receive an inverted/infinite box.
|
|
19
|
+
*/
|
|
20
|
+
export function worldBoundsOfMeshes(meshes) {
|
|
21
|
+
let minX = Infinity, minY = Infinity, minZ = Infinity;
|
|
22
|
+
let maxX = -Infinity, maxY = -Infinity, maxZ = -Infinity;
|
|
23
|
+
let any = false;
|
|
24
|
+
for (const mesh of meshes) {
|
|
25
|
+
const { positions, origin } = mesh;
|
|
26
|
+
const ox = origin ? origin[0] : 0;
|
|
27
|
+
const oy = origin ? origin[1] : 0;
|
|
28
|
+
const oz = origin ? origin[2] : 0;
|
|
29
|
+
const vertexCount = Math.floor(positions.length / 3);
|
|
30
|
+
for (let i = 0; i < vertexCount; i++) {
|
|
31
|
+
const x = positions[i * 3] + ox;
|
|
32
|
+
const y = positions[i * 3 + 1] + oy;
|
|
33
|
+
const z = positions[i * 3 + 2] + oz;
|
|
34
|
+
if (!Number.isFinite(x) || !Number.isFinite(y) || !Number.isFinite(z))
|
|
35
|
+
continue;
|
|
36
|
+
if (x < minX)
|
|
37
|
+
minX = x;
|
|
38
|
+
if (y < minY)
|
|
39
|
+
minY = y;
|
|
40
|
+
if (z < minZ)
|
|
41
|
+
minZ = z;
|
|
42
|
+
if (x > maxX)
|
|
43
|
+
maxX = x;
|
|
44
|
+
if (y > maxY)
|
|
45
|
+
maxY = y;
|
|
46
|
+
if (z > maxZ)
|
|
47
|
+
maxZ = z;
|
|
48
|
+
any = true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (!any)
|
|
52
|
+
return null;
|
|
53
|
+
return { min: vec3(minX, minY, minZ), max: vec3(maxX, maxY, maxZ) };
|
|
54
|
+
}
|
|
55
|
+
/** The eight corners of a world AABB, in a fixed order. */
|
|
56
|
+
export function worldBoundsCorners(bounds) {
|
|
57
|
+
const { min, max } = bounds;
|
|
58
|
+
const corners = [];
|
|
59
|
+
for (const x of [min.x, max.x]) {
|
|
60
|
+
for (const y of [min.y, max.y]) {
|
|
61
|
+
for (const z of [min.z, max.z]) {
|
|
62
|
+
corners.push(vec3(x, y, z));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return corners;
|
|
67
|
+
}
|
|
68
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
69
|
+
// CAMERA PLANE
|
|
70
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
71
|
+
/** Smallest cross-product length treated as "up is parallel to the view". */
|
|
72
|
+
const PARALLEL_EPSILON = 1e-6;
|
|
73
|
+
/**
|
|
74
|
+
* A reference up that is guaranteed not to be parallel to `viewDir`: world
|
|
75
|
+
* +Y unless the camera looks (near-)straight up or down, in which case world
|
|
76
|
+
* +Z. Without this, a top-down / bottom-up view — the single most common
|
|
77
|
+
* plan-drawing camera — produces a zero-length right vector and a basis full
|
|
78
|
+
* of NaN, i.e. a blank PDF.
|
|
79
|
+
*/
|
|
80
|
+
function fallbackUp(viewDir) {
|
|
81
|
+
return Math.abs(viewDir.y) < 0.9 ? vec3(0, 1, 0) : vec3(0, 0, 1);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Build the synthetic section plane that represents the current camera view.
|
|
85
|
+
*
|
|
86
|
+
* @param camera World-space eye/target/up.
|
|
87
|
+
* @param worldBounds World AABB of everything that will be drawn (see
|
|
88
|
+
* {@link worldBoundsOfMeshes}).
|
|
89
|
+
*
|
|
90
|
+
* @throws when the camera degenerates (eye == target) or the bounds are
|
|
91
|
+
* non-finite — both would otherwise yield a NaN transform and a
|
|
92
|
+
* blank-but-plausible PDF page.
|
|
93
|
+
*/
|
|
94
|
+
export function buildCameraSectionPlane(camera, worldBounds) {
|
|
95
|
+
const rawView = vec3Sub(camera.target, camera.position);
|
|
96
|
+
if (vec3Length(rawView) < PARALLEL_EPSILON) {
|
|
97
|
+
throw new Error('Cannot build a camera section plane: the camera position and target coincide, ' +
|
|
98
|
+
'so the view direction is undefined.');
|
|
99
|
+
}
|
|
100
|
+
const viewDir = vec3Normalize(rawView);
|
|
101
|
+
for (const v of [worldBounds.min, worldBounds.max]) {
|
|
102
|
+
if (!Number.isFinite(v.x) || !Number.isFinite(v.y) || !Number.isFinite(v.z)) {
|
|
103
|
+
throw new Error('Cannot build a camera section plane: world bounds must be finite.');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// ── Orthonormal basis ───────────────────────────────────────────────────
|
|
107
|
+
// tangent = screen right
|
|
108
|
+
// bitangent = screen up, RE-ORTHOGONALISED against the view direction
|
|
109
|
+
// normal = −viewDir (points back at the viewer)
|
|
110
|
+
//
|
|
111
|
+
// `cross(tangent, bitangent) === normal` holds by construction, which is
|
|
112
|
+
// what keeps the page from coming out mirrored (#2119 defect class).
|
|
113
|
+
// NORMALISED before the parallel test below. `|cross(viewDir, up)|` is
|
|
114
|
+
// `|up| * sin(angle)`, so testing it against a fixed epsilon without
|
|
115
|
+
// normalising makes the threshold depend on the LENGTH of `up`: a long up
|
|
116
|
+
// vector that is genuinely almost parallel to the view still clears the
|
|
117
|
+
// epsilon, and the basis is then built from a direction that is numerically
|
|
118
|
+
// noise. Normalising first makes PARALLEL_EPSILON a pure angle tolerance.
|
|
119
|
+
const upHint = vec3Length(camera.up) < PARALLEL_EPSILON ? fallbackUp(viewDir) : vec3Normalize(camera.up);
|
|
120
|
+
let right = vec3Cross(viewDir, upHint);
|
|
121
|
+
if (vec3Length(right) < PARALLEL_EPSILON) {
|
|
122
|
+
right = vec3Cross(viewDir, fallbackUp(viewDir));
|
|
123
|
+
}
|
|
124
|
+
const tangent = vec3Normalize(right);
|
|
125
|
+
const bitangent = vec3Normalize(vec3Cross(tangent, viewDir));
|
|
126
|
+
const normal = vec3(-viewDir.x, -viewDir.y, -viewDir.z);
|
|
127
|
+
// ── Plane placement: strictly in front of every bounds corner ───────────
|
|
128
|
+
// `s = dot(corner, viewDir)` grows AWAY from the viewer, so the nearest
|
|
129
|
+
// corner is at `sMin`. Putting the plane a pad before `sMin` guarantees
|
|
130
|
+
// every corner has a strictly positive view depth.
|
|
131
|
+
const corners = worldBoundsCorners(worldBounds);
|
|
132
|
+
let sMin = Infinity;
|
|
133
|
+
let sMax = -Infinity;
|
|
134
|
+
for (const c of corners) {
|
|
135
|
+
const s = vec3Dot(c, viewDir);
|
|
136
|
+
if (s < sMin)
|
|
137
|
+
sMin = s;
|
|
138
|
+
if (s > sMax)
|
|
139
|
+
sMax = s;
|
|
140
|
+
}
|
|
141
|
+
const span = sMax - sMin;
|
|
142
|
+
// Relative pad so it stays meaningful from a door handle to a city block,
|
|
143
|
+
// with an absolute floor for a degenerate (flat) box.
|
|
144
|
+
const pad = Math.max(span * 1e-3, 1e-4);
|
|
145
|
+
const planeS = sMin - pad;
|
|
146
|
+
// A genuine point ON the plane, used as the 2D basis origin so drawing
|
|
147
|
+
// coordinates stay centred on the model instead of on the world origin.
|
|
148
|
+
const center = vec3((worldBounds.min.x + worldBounds.max.x) / 2, (worldBounds.min.y + worldBounds.max.y) / 2, (worldBounds.min.z + worldBounds.max.z) / 2);
|
|
149
|
+
const shift = planeS - vec3Dot(center, viewDir);
|
|
150
|
+
const origin = vec3(center.x + viewDir.x * shift, center.y + viewDir.y * shift, center.z + viewDir.z * shift);
|
|
151
|
+
// dot(origin, normal) = −dot(origin, viewDir) = −planeS, computed in closed
|
|
152
|
+
// form rather than re-derived from `origin` so the offset carries no extra
|
|
153
|
+
// rounding from the point reconstruction above.
|
|
154
|
+
const distance = -planeS;
|
|
155
|
+
// Legacy cardinal fields. Every plane-aware helper (`signedDepth`,
|
|
156
|
+
// `projectPointForPlane`, `SectionCutter`, the depth raster) checks
|
|
157
|
+
// `customPlane` FIRST, so these only feed code that predates arbitrary
|
|
158
|
+
// planes. They are set to the closest cardinal reading of this plane
|
|
159
|
+
// rather than to a lie like `position: 0`.
|
|
160
|
+
const axis = dominantAxis(normal);
|
|
161
|
+
const position = origin[axis];
|
|
162
|
+
return {
|
|
163
|
+
plane: {
|
|
164
|
+
axis,
|
|
165
|
+
position,
|
|
166
|
+
flipped: false,
|
|
167
|
+
customPlane: { normal, distance, origin, tangent, bitangent },
|
|
168
|
+
},
|
|
169
|
+
viewDepth: span + pad * 2,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
/** The cardinal axis the plane normal is most aligned with. */
|
|
173
|
+
function dominantAxis(normal) {
|
|
174
|
+
const ax = Math.abs(normal.x);
|
|
175
|
+
const ay = Math.abs(normal.y);
|
|
176
|
+
const az = Math.abs(normal.z);
|
|
177
|
+
if (ax >= ay && ax >= az)
|
|
178
|
+
return 'x';
|
|
179
|
+
if (ay >= az)
|
|
180
|
+
return 'y';
|
|
181
|
+
return 'z';
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=view-plane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-plane.js","sourceRoot":"","sources":["../src/view-plane.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA0C/D,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAyCzF,8EAA8E;AAC9E,eAAe;AACf,8EAA8E;AAE9E;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAA2B;IAC7D,IAAI,IAAI,GAAG,QAAQ,EAAE,IAAI,GAAG,QAAQ,EAAE,IAAI,GAAG,QAAQ,CAAC;IACtD,IAAI,IAAI,GAAG,CAAC,QAAQ,EAAE,IAAI,GAAG,CAAC,QAAQ,EAAE,IAAI,GAAG,CAAC,QAAQ,CAAC;IACzD,IAAI,GAAG,GAAG,KAAK,CAAC;IAEhB,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;QAC1B,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACnC,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClC,MAAM,EAAE,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I,EAAE;QAAE,OAAO,GAAG,CAAC;IACrC,IAAI,EAAE,IAAI,EAAE;QAAE,OAAO,GAAG,CAAC;IACzB,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project world-space 3D segments (the section rim produced by
|
|
3
|
+
* `half-space-clip.ts`) into classified `DrawingLine`s (issue #2042).
|
|
4
|
+
*
|
|
5
|
+
* # Defect class this module guards against
|
|
6
|
+
* **A line producer that invents its own projection or its own depth
|
|
7
|
+
* convention.** Everything else in this pipeline — the section cutter, the
|
|
8
|
+
* edge extractor, the projection bands, and the hidden-line depth raster —
|
|
9
|
+
* derives 2D coordinates from `projectPointForPlane` and view depths from
|
|
10
|
+
* `−signedDepth`. A producer that re-implements either (a hand-rolled dot
|
|
11
|
+
* product, a forgotten sign, a `depth` measured from the wrong side) emits
|
|
12
|
+
* lines that look right on their own but sit in a *different frame* from the
|
|
13
|
+
* depth buffer they are sampled against — so hidden-line removal silently
|
|
14
|
+
* dashes visible edges, or leaves occluded ones solid, with no error
|
|
15
|
+
* anywhere. This module does nothing but call those two shared helpers.
|
|
16
|
+
*
|
|
17
|
+
* The rim of a section cut is, by definition, geometry lying IN the cut
|
|
18
|
+
* plane, so it is emitted as `category: 'cut'` (heavy line weight). It is
|
|
19
|
+
* still handed to the hidden-line stage rather than drawn unconditionally:
|
|
20
|
+
* on an oblique 3D view the far side of a cut object is genuinely behind
|
|
21
|
+
* other geometry and must print dashed.
|
|
22
|
+
*/
|
|
23
|
+
import type { DrawingLine, SectionPlaneConfig, Vec3 } from './types.js';
|
|
24
|
+
/** A world-space segment to be drawn, with its source element metadata. */
|
|
25
|
+
export interface WorldLineSeed {
|
|
26
|
+
start: Vec3;
|
|
27
|
+
end: Vec3;
|
|
28
|
+
entityId: number;
|
|
29
|
+
ifcType: string;
|
|
30
|
+
modelIndex: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Project `seeds` into drawing lines against `plane`.
|
|
34
|
+
*
|
|
35
|
+
* Segments whose 2D projection collapses to a point (an edge parallel to the
|
|
36
|
+
* view direction) are dropped: they carry no information on the page and
|
|
37
|
+
* would only add zero-length strokes for the line merger and the PDF writer
|
|
38
|
+
* to trip over.
|
|
39
|
+
*/
|
|
40
|
+
export declare function projectWorldLineSeeds(seeds: readonly WorldLineSeed[], plane: SectionPlaneConfig): DrawingLine[];
|
|
41
|
+
//# sourceMappingURL=world-line-seeds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"world-line-seeds.d.ts","sourceRoot":"","sources":["../src/world-line-seeds.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAW,kBAAkB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAIjF,2EAA2E;AAC3E,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,IAAI,CAAC;IACZ,GAAG,EAAE,IAAI,CAAC;IACV,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,SAAS,aAAa,EAAE,EAC/B,KAAK,EAAE,kBAAkB,GACxB,WAAW,EAAE,CA8Bf"}
|