Random-Schraffur modellraum-verankert + Motiv-Editor fuer Custom-Linien
Random-Verankerung (Bugfix): die Streu-Striche haengen nicht mehr an der Polygon-Bounding-Box, sondern an einem absoluten Modellraum-Gitter (hashCell aus absoluten Zell-Indizes + hatch.seed). Beim Vergroessern der Flaeche bleiben bestehende Striche stehen, am Rand kommen neue dazu, die Dichte bleibt konstant, Verschieben wandert nicht; 'Neu wuerfeln' (neuer Seed) verschiebt das ganze Feld. Alle Renderpfade ziehen aus derselben Funktion. Verankerungs- und Verschiebe-Dichte-Test ergaenzt. Motiv-Editor: neuer wiederverwendbarer MotifEditor (Punkte setzen/ziehen in einer Einheitszelle, Live-Loop-Vorschau). LineStyle.kind 'custom' + motif (points/length), additiv durchgereicht (analog zigzag) und in allen Renderpfaden gekachelt (motifPoints, Verallgemeinerung von zigzagPoints). ResourceManager-Umschalter Vollinie/Strich/Zickzack/Motiv, LineSwatch- Vorschau. Insgesamt 5 neue Tests, 113 gruen.
This commit is contained in:
@@ -12,7 +12,7 @@ import type { Plan, Primitive } from "../plan/generatePlan";
|
||||
import type { LayerCategory, Project, Vec2 } from "../model/types";
|
||||
import { flattenCategories } from "../model/types";
|
||||
import { DxfWriter } from "./dxfWriter";
|
||||
import { buildRandomHatchRuns, zigzagPoints } from "../plan/glPlan/glPlanHatch";
|
||||
import { buildRandomHatchRuns, zigzagPoints, motifPoints } from "../plan/glPlan/glPlanHatch";
|
||||
|
||||
export interface ExportDxfOptions {
|
||||
/** Titel/Geschossname (nur als Kommentar-freundlicher Dateiname genutzt). */
|
||||
@@ -113,6 +113,9 @@ function emitPrimitive(
|
||||
const amp = p.zigzag.amplitude * DASH_MM_TO_M;
|
||||
const wav = p.zigzag.wavelength * DASH_MM_TO_M;
|
||||
dxf.addPolyline(layer, zigzagPoints(p.a, p.b, amp, wav), false);
|
||||
} else if (p.motif) {
|
||||
// Custom-Motiv → offene Polylinie (Papier-mm → Modell-Meter, wie oben).
|
||||
dxf.addPolyline(layer, motifPoints(p.a, p.b, p.motif, DASH_MM_TO_M), false);
|
||||
} else {
|
||||
dxf.addLine(layer, p.a, p.b);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
import type { HatchRender, Plan, Primitive } from "../plan/generatePlan";
|
||||
import type { Vec2 } from "../model/types";
|
||||
import { buildRandomHatchRuns, zigzagPoints } from "../plan/glPlan/glPlanHatch";
|
||||
import { buildRandomHatchRuns, zigzagPoints, motifPoints } from "../plan/glPlan/glPlanHatch";
|
||||
|
||||
/** SVG-Namespace für die programmatisch erzeugten Knoten. */
|
||||
const SVG_NS = "http://www.w3.org/2000/svg";
|
||||
@@ -227,6 +227,7 @@ function appendPrimitive(
|
||||
const b = map(p.b);
|
||||
// Zickzack-Linie (amplitude/wavelength sind Papier-mm = mm-Zielraum) →
|
||||
// Polylinie; sonst gerade (ggf. gestrichelte) Linie wie bisher.
|
||||
// Zickzack/Custom-Motiv sind in Papier-mm definiert = mm-Zielraum (scale 1).
|
||||
const ln = p.zigzag
|
||||
? polylineNode(
|
||||
zigzagPoints(a, b, p.zigzag.amplitude, p.zigzag.wavelength),
|
||||
@@ -234,7 +235,14 @@ function appendPrimitive(
|
||||
quantizePen(p.weightMm),
|
||||
p.dash,
|
||||
)
|
||||
: lineNode(a, b, p.color ?? "#111111", quantizePen(p.weightMm), p.dash, mmPerM);
|
||||
: p.motif
|
||||
? polylineNode(
|
||||
motifPoints(a, b, p.motif),
|
||||
p.color ?? "#111111",
|
||||
quantizePen(p.weightMm),
|
||||
p.dash,
|
||||
)
|
||||
: lineNode(a, b, p.color ?? "#111111", quantizePen(p.weightMm), p.dash, mmPerM);
|
||||
if (opacity) ln.setAttribute("opacity", opacity);
|
||||
svg.appendChild(ln);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user