[T2][106][G3][100][T4] Bogenwand-Restpunkte: Schichteinzug, Formöffnungen im Schnitt/IFC, 3D-Ansichtsschraffur, polare Schraffur, IFC-Bogenprofil, Band-Vorschau, Bogenmass; Import-Meshes glatt mit Knickwinkel
This commit is contained in:
38 files changed
+1215
-143
No files matched your search
@@ -8,6 +8,7 @@ export {
|
||||
bulgePolylinePoints,
|
||||
bulgeFromSagittaPoint,
|
||||
bulgePointAt,
|
||||
wallArcBand,
|
||||
hasRealBulge,
|
||||
pointOnCircle,
|
||||
} from "../geometry/bulge";
|
||||
|
||||
@@ -9,9 +9,22 @@ import {
|
||||
bulgeArcPoints,
|
||||
bulgePolylinePoints,
|
||||
bulgeFromSagittaPoint,
|
||||
wallArcBand,
|
||||
} from "./bulge";
|
||||
import type { Vec2 } from "../model/types";
|
||||
|
||||
describe("wallArcBand ([T2] Griff-Vorschau)", () => {
|
||||
it("Band im Kreisring um die Achse, gerade Wand = null", () => {
|
||||
expect(wallArcBand({ x: 0, y: 0 }, { x: 4, y: 0 }, undefined, 0.2)).toBeNull();
|
||||
const r = wallArcBand({ x: 0, y: 0 }, { x: 4, y: 0 }, 1, 0.2);
|
||||
expect(r).not.toBeNull();
|
||||
const d = (q: Vec2) => Math.hypot(q.x - 2, q.y);
|
||||
expect(r!.band.length).toBeGreaterThan(8);
|
||||
for (const q of r!.band) expect(Math.abs(d(q) - 2)).toBeCloseTo(0.1, 9);
|
||||
for (const q of r!.axis) expect(d(q)).toBeCloseTo(2, 9);
|
||||
});
|
||||
});
|
||||
|
||||
describe("bulgeArc / bulgeArcPoints", () => {
|
||||
it("bulge 0 (oder fehlend) → Gerade, keine Bogen-Tessellation", () => {
|
||||
const a = { x: 0, y: 0 }, b = { x: 4, y: 2 };
|
||||
|
||||
@@ -58,6 +58,19 @@ export function bulgeArcPoints(a: Vec2, b: Vec2, bulge: number | undefined): Vec
|
||||
return toPoints(core().bulge_arc_points(a.x, a.y, b.x, b.y, bulge));
|
||||
}
|
||||
|
||||
/**
|
||||
* [T2] Band einer Bogenwand (Dicke `t` mittig zur Achse) und Achse als Punktzüge — für Vorschauen
|
||||
* (Griffe). `null` = gerade oder entartet.
|
||||
*/
|
||||
export function wallArcBand(a: Vec2, b: Vec2, bulge: number | undefined, t: number): { band: Vec2[]; axis: Vec2[] } | null {
|
||||
if (bulge === undefined || bulge === 0) return null;
|
||||
const f = core().wall_arc_band(a.x, a.y, b.x, b.y, bulge, t);
|
||||
if (f.length < 1) return null;
|
||||
const n = f[0];
|
||||
const pts = toPoints(f.subarray(1));
|
||||
return { band: pts.slice(0, n), axis: pts.slice(n) };
|
||||
}
|
||||
|
||||
/**
|
||||
* Ganze Polylinie tessellieren (`bulge[i]` krümmt die Kante pts[i]→pts[i+1], geschlossen zusätzlich
|
||||
* die Schlusskante). Kantenpunkte verkettet ohne doppelte Stösse; bei `closed` wird der Startpunkt
|
||||
|
||||
@@ -1983,6 +1983,8 @@ export const de = {
|
||||
"site.excavation.hint": "Umriss der Sohle zeichnen; Böschungen schneiden das Gelände",
|
||||
"site.contourInterval": "Äquidistanz [m]",
|
||||
"site.contourIndexEvery": "Zähllinie jede",
|
||||
"site.smoothShading": "Glatt schattieren",
|
||||
"site.creaseAngle": "Knickwinkel °",
|
||||
"site.excavation.bottom": "Sohle [m]",
|
||||
"site.excavation.slope": "Böschung [°]",
|
||||
"site.excavation.fillSlope": "Schüttung [°]",
|
||||
|
||||
@@ -1971,6 +1971,8 @@ export const en: Record<TranslationKey, string> = {
|
||||
"site.excavation.hint": "Draw the outline of the pit bottom; slopes cut the terrain",
|
||||
"site.contourInterval": "Contour interval [m]",
|
||||
"site.contourIndexEvery": "Index contour every",
|
||||
"site.smoothShading": "Smooth shading",
|
||||
"site.creaseAngle": "Crease angle °",
|
||||
"site.excavation.bottom": "Bottom [m]",
|
||||
"site.excavation.slope": "Slope [°]",
|
||||
"site.excavation.fillSlope": "Fill slope [°]",
|
||||
|
||||
@@ -887,6 +887,13 @@ export type Drawing2DGeom =
|
||||
* wenn ein Bezug ungültig wird. Fehlt das Feld, ist die Bemassung frei wie bisher.
|
||||
*/
|
||||
refs?: Array<DimRef | null>;
|
||||
/**
|
||||
* [T2] Bogenmass: Mittelpunkt des Kreises, auf dem `pts` liegen (z. B. Aussenfläche einer
|
||||
* Bogenwand). Dann ist die Masslinie der Kreisbogen im Radius |pts − arcCenter| + `offset`
|
||||
* (positiv = vom Mittelpunkt weg), die Masshilfslinien laufen radial, und jedes Segment misst
|
||||
* die Bogenlänge auf dem Radius seiner Punkte (kürzerer Bogen). Fehlt es: lineare Bemassung.
|
||||
*/
|
||||
arcCenter?: Vec2;
|
||||
}
|
||||
| {
|
||||
shape: "kote";
|
||||
@@ -1441,6 +1448,10 @@ export type ImportedMesh = {
|
||||
color?: string;
|
||||
/** IFC-GlobalId des Quell-Bauteils (IFC-Import je Bauteil). */
|
||||
ifcGlobalId?: string;
|
||||
/** [T4] Glatt schattieren (geteilte Normalen an Kanten über dem Knickwinkel); fehlt = kantig. */
|
||||
smoothShading?: boolean;
|
||||
/** [T4] Knickwinkel in Grad für das glatte Schattieren (Default 30°). */
|
||||
creaseAngle?: number;
|
||||
positions: Array<number>;
|
||||
indices: Array<number>;
|
||||
};
|
||||
|
||||
@@ -276,6 +276,31 @@ export function SitePanel() {
|
||||
>
|
||||
×
|
||||
</button>
|
||||
{obj.type === "importedMesh" && (
|
||||
// [T4] Glatt oder kantig schattieren, Knickwinkel je Mesh (Vorgabe 30°).
|
||||
<div className="site-props">
|
||||
<label className="site-check">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={obj.smoothShading === true}
|
||||
onChange={(e) =>
|
||||
host.onPatchContextObject(obj.id, { smoothShading: e.target.checked }, `site-${obj.id}-smoothShading`)
|
||||
}
|
||||
/>
|
||||
{t("site.smoothShading")}
|
||||
</label>
|
||||
{obj.smoothShading === true && (
|
||||
<NumField
|
||||
label={t("site.creaseAngle")}
|
||||
value={obj.creaseAngle}
|
||||
step={5}
|
||||
min={1}
|
||||
placeholder="30"
|
||||
onChange={patch(obj.id, "creaseAngle")}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{obj.type === "terrainMesh" && (
|
||||
<div className="site-props">
|
||||
<NumField
|
||||
|
||||
@@ -71,6 +71,9 @@ export interface HatchRender {
|
||||
* (s. `hatchLineFamily`). Gesetzt wird er über `Drawing2D.hatchOrigin`.
|
||||
*/
|
||||
origin?: Vec2;
|
||||
/** [T2] Polare Schraffur (Bogenwand-Schicht): `[Mitte x, Mitte y, Bezugsradius]` — das Muster folgt
|
||||
* der Krümmung (Kern `hatch::Hatch::polar`). */
|
||||
polar?: [number, number, number];
|
||||
/** Linienstärke der Musterlinien in mm. */
|
||||
lineWeight: number;
|
||||
/** Strichmuster der Musterlinien in mm; null = durchgezogen. */
|
||||
|
||||
@@ -130,6 +130,7 @@ function writeHatch(w: F64Writer, h: HatchRender, colorIdx: number): void {
|
||||
if (h.lengthMin != null) flags |= 16;
|
||||
if (h.lengthMax != null) flags |= 32;
|
||||
if (h.motif) flags |= 64;
|
||||
if (h.polar) flags |= 128;
|
||||
const o = w.reserve(13);
|
||||
const b = w.buf;
|
||||
b[o] = PATTERN_CODE[h.pattern] ?? 2;
|
||||
@@ -150,6 +151,7 @@ function writeHatch(w: F64Writer, h: HatchRender, colorIdx: number): void {
|
||||
w.push(h.motif.length);
|
||||
w.pts(h.motif.points);
|
||||
}
|
||||
if (h.polar) for (const v of h.polar) w.push(v);
|
||||
}
|
||||
|
||||
/** Einzelne Schraffur kodieren (Farbe −1) — Eingabe der Schraffur-Bindungen des Kerns. */
|
||||
@@ -550,6 +552,7 @@ export function decodePlanBuf(input: Uint8Array): DecodedPlanBuf {
|
||||
const hf = f[k + 3];
|
||||
k += 15 + f[k + 14];
|
||||
if (hf & 64) k += 2 + 2 * f[k + 1];
|
||||
if (hf & 128) k += 3; // [T2] polare Schraffur: Mitte, Bezugsradius
|
||||
if (!(k <= groupAt)) bad("Schraffuren");
|
||||
}
|
||||
if (k !== groupAt) bad("Schraffuren");
|
||||
|
||||
@@ -209,6 +209,9 @@ export interface RMesh {
|
||||
* zeigt render3d das Fallback-Schachbrett. Matcht
|
||||
* `render3d::types::MeshInput.materialIndex`. */
|
||||
materialIndex?: number;
|
||||
/** [T4] Glatt schattieren mit Knickwinkel (Grad); fehlt = kantig. Matcht
|
||||
* `render3d::types::MeshInput.creaseAngle`. */
|
||||
creaseAngle?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,7 +9,7 @@ import { useRef, useState, type RefObject } from "react";
|
||||
import { add, dot, leftNormal, normalize, scale, sub, wallCorners } from "../model/geometry";
|
||||
import type { Ceiling, Drawing2D, EdgeGrip, Project, Room, Stair, Vec2 } from "../model/types";
|
||||
import { wallTypeThickness } from "../model/types";
|
||||
import { bulgeArcPoints, drawingVertices, surfaceOpeningGripPatch, surfaceOpeningGrips, surfaceOpeningInfo } from "../core";
|
||||
import { bulgeArcPoints, drawingVertices, surfaceOpeningGripPatch, surfaceOpeningGrips, surfaceOpeningInfo, wallArcBand } from "../core";
|
||||
import { gripDrawingIdsFor } from "./gripLimits";
|
||||
import { openEdges, polylineEdgeGrips, ringEdges } from "../core";
|
||||
import { areaMovePreview, drawingMovePreview } from "../tools/transform";
|
||||
@@ -962,8 +962,12 @@ export function useGripEditing(opts: {
|
||||
const th = wt ? wallTypeThickness(wt) : 0.2;
|
||||
const a = pw.localIndex === 0 ? pw.pt : w.start;
|
||||
const b = pw.localIndex === 0 ? w.end : pw.pt;
|
||||
// Bogenwand: der Bogen behält seinen Öffnungswinkel (Bulge), Vorschau als Achse.
|
||||
if (w.bulge) return [{ kind: "poly", pts: bulgeArcPoints(a, b, w.bulge), closed: false }];
|
||||
// Bogenwand: der Bogen behält seinen Öffnungswinkel (Bulge), Vorschau als Band samt Achse.
|
||||
if (w.bulge) {
|
||||
const arc = wallArcBand(a, b, w.bulge, th);
|
||||
if (arc) return [{ kind: "poly", pts: arc.band, closed: true }, { kind: "poly", pts: arc.axis, closed: false }];
|
||||
return [{ kind: "poly", pts: bulgeArcPoints(a, b, w.bulge), closed: false }];
|
||||
}
|
||||
return [
|
||||
{ kind: "poly", pts: wallCorners(a, b, th), closed: true },
|
||||
{ kind: "line", a, b },
|
||||
|
||||
Reference in new issue
Block a user