Commit Graph

7070 Commits

Author SHA1 Message Date
Dmitrii Kulikov
6f6be66842 Shape Healing - Crash in ShapeConstruct_ProjectCurveOnSurface::insertAdditionalPointOrAdjust() (#1267)
To input parameters of ShapeConstruct_ProjectCurveOnSurface::insertAdditionalPointOrAdjust() new arrays were assigned. The size of new arrays are guaranteed to be 1 element larger that original array. NCollection_Array1::Assign() is guaranteed to throw exception when arrays size mismatch. So, given that assignment code is reached, function will always throw.
Fixed by calling move assignment instead - size mismatch is allowed in this case. Also it is more optimal.
2026-05-05 18:16:32 +01:00
Pasukhin Dmitry
9281002280 Documentation - Update various markdown files for clarity and consistency (#1265)
- Renames many example variables to align better with current OCCT naming/style conventions.
- Updates documentation around deprecated 2D construction APIs, build options, resource paths, and environment variables.
- Cleans up assorted wording, links, and outdated references across user guides, samples, and contributor docs.
2026-05-05 12:18:29 +01:00
Pasukhin Dmitry
6ba27a8c17 Modeling - Rework CoEdge definition to avoid misuse (#1261)
- Redesign seam detection/pairing to be connectivity-derived (`SeamPair()` walks sibling coedges on the same face with opposite orientations), with seam halves now present in wire `CoEdgeRefIds` to match TopoDS iteration.
- Move geometric continuity storage/round-trip to `BRepGraph_LayerRegularity` (including seam continuity), updating populate/reconstruct/editor APIs accordingly.
- Add/adjust GTests to cover seam ordering, seam symmetry, layer regularity behavior, and split/compact/reconstruct interactions under the new model.
2026-05-05 09:43:56 +01:00
Pasukhin Dmitry
058ec16010 Visualization - Grid shader update (#1264)
- Renamed grid terminology and command/API surface from `inf`/“infinite” to `gpu`/“GPU”, plus `viewAdaptive` for camera-relative sizing.
- Updated OpenGl grid rendering to compute adaptive bounds from the visible region and to fix axis coloring for rotated rectangular grids.
- Refreshed Draw tests, help text, and API comments to match the new behavior.
2026-05-05 09:43:14 +01:00
dpasukhi
a70427ff15 Coding - Bump version to 8.0.0.beta2 V8_0_0_beta2 2026-05-03 16:55:46 +01:00
Pasukhin Dmitry
42d9c36f10 Data Exchange - Make STEP write and STEP/IGES read pipelines thread-safe (#1259)
Concurrent STEPControl_Writer::Transfer calls crashed inside TCollection_AsciiString::Move with a libmalloc double-free, and concurrent STEP/IGES readers occasionally crashed inside Interface_FileReaderTool::RecognizeByLib. Both originated in process-shared mutable state that every per-thread reader/writer silently mutated.

STEP write actor (writer-side race):
- Pre-populate the shared STEPControl_ActorWrite parameter map and processing flags inside STEPControl_Controller::Init under the existing one-time mutex, so concurrent STEPControl_Writer::Transfer calls no longer mutate the shared actor in the default path.
- Drop the per-Transfer call to STEPControl_Writer::InitializeMissingParameters; defaults are now in place from controller construction time.
- Make XSAlgo_ShapeProcessor::SetParameter idempotent: skip the destructive Bind when the existing entry already matches the new value, eliminating the TCollection_AsciiString::Move/Free path that was the immediate double-free site under concurrent writers.
- Stop clearing the target ParameterMap in XSAlgo_ShapeProcessor::SetShapeFixParameters before refilling it; rely on the idempotent SetParameter for in-place replacement.

LibCtl_Library (reader-side race):
- Drop the file-scope "last protocol" optimization cache (theprotocol/thelast) that raced between concurrent STEP/IGES readers in Interface_FileReaderTool::RecognizeByLib.
- Treat the global registry as immutable after one-time controller initialization: writers (SetGlobal) serialize against each other, readers traverse without locking. Move internal helper logic into an anonymous namespace.
2026-05-03 16:29:51 +01:00
Pasukhin Dmitry
4674df1e24 Samples - Add samples directory (#1257)
- Added `samples/README.md` describing where OCCT sample applications/wrappers are maintained (external repository + browsable site).
- Updated root `.gitignore` whitelist to allow tracking the `/samples/` directory at repository root.
2026-05-03 12:03:28 +01:00
Pasukhin Dmitry
bec9558832 Documentation - Modernize for OCCT 8.0.0, GitHub workflow, and vcpkg build system (#1256)
- Migration from dev.opencascade.org/Mantis/Gitolite infrastructure to GitHub-native
  workflow (Pull Requests, Issues, GitHub Actions CI/CD).
- OCCT 8.0.0 upgrade guide with detailed notes on TCol* typedef deprecation, BSpline
  weight accessors, evaluation hierarchy refactoring (EvalD0/D1/D2/D3/DN), Handle
  out-parameter deprecation, Standard_Mutex → std::mutex, PLib value types, BRepGraph,
  TopoDS_TShape redesign, math wrapper deprecation, mesh factory registry, and more.
- Build system modernization: C++17 requirement, VS2022/GCC8+/Clang7+ compilers,
  vcpkg integration, CMake-driven documentation targets replacing legacy gendoc.
- Removed obsolete documentation: Mantis workflow, access levels, issue lifecycle,
  pre-7.1.0 upgrade history (archived at dev.opencascade.org/doc), in-tree Inspector
  and DFBrowser documentation, 3rd-party build guide (outsourced to vcpkg/upstream).
- INSTALL_DIR_RESOURCE directory now correctly described in the install tree layout.
- Obsolete BUILD_PATCH CMake option removed from documentation.
- Code examples modernized: occ::handle<> syntax, NCollection_*<T> templates, BRepAdaptor_Curve,
  IsDone() checks, null-handle guards, native C++ types over Standard_* typedefs,
  Append() over Appends(), correct variable names.
- Code block language tags: .php → .tcl for Tcl scripts, .glsl for shader listings.
- IGES translator: deprecated API calls updated (SetReadVisible + TransferRoots),
  IDT_ message API replaced with Message_Messenger, thread-safety warning added.
- DE_Wrapper: STEP thread-safety note (per-reader), IGES unsupported for concurrency.
- Removed Mantis tracker link from GitHub issue template config.
- Removed DFBROWSER and INSPECTOR entries from DrawPlugin resource file.
- Tcl reference URL updated (tcl.tk → tcl-lang.org).
2026-05-03 09:15:03 +01:00
Pasukhin Dmitry
076aad3fef Coding - Fix CI compilation warnings (#1253)
Refactor NULL to nullptr in OpenGL-related files
Fix some MacOS, Ubuntu warnings and disable too strict warning checks
2026-05-01 22:53:06 +01:00
Pasukhin Dmitry
3ad68cb6e7 Visualization - Restore CPU grid path alongside shader grid (#1252)
Commit a2e851b25 (#1223) replaced the classical Graphic3d_Structure-based grid rendering with a single shader path driven by Aspect_GridParams. This change brings the CPU rendering back as a coexisting backend so consumers can pick CPU or GPU per use case. Snap math on Aspect_Grid is unchanged; only the presentation layer is split.

V3d layer:
- V3d_RectangularGrid / V3d_CircularGrid restore the nested custom Graphic3d_Structure, myStructure / myGroup, DefineLines / DefinePoints and the myCur* change-detection cache. UpdateDisplay rebuilds the primitive arrays with the same SetTransformation + CalculateBoundBox flow as before #1223.
- DefineLines / DefinePoints use NCollection_LinearVector<gp_Pnt> pre-sized from XStep / YStep / Radius to avoid reallocations.
- V3d_CircularGrid emits a one-shot warning when an arc range is set (CPU cannot honor it; use the shader path for arcs).

V3d_View layer:
- V3d_View tracks myShaderGridActive. SetGrid erases the shader grid on this view before activating the CPU grid; GridDisplay erases the viewer-wide CPU rendering (snap geometry preserved) before enabling the shader grid. Remove tears both down.

Aspect / Viewer:
- Aspect_GridParams comment clarifies it is consumed only by the GPU path. V3d_Viewer.hxx grid block is annotated as the legacy CPU entry.
2026-05-01 21:57:59 +01:00
dpasukhi
344d6139b6 Coding - Bump version to 8.0.0.beta1 V8_0_0_beta1 2026-04-30 10:40:40 +01:00
Pasukhin Dmitry
04025d1cc3 Testing - Update reference data for migration to new station (#1248)
- Adjusted faulties and warnings in tests for IGES and STEP files to reflect updated results.
- Corrected tolerance values in multiple tests to ensure accuracy in shape validation.
- Updated expected label counts and properties in several test cases to align with new outputs.
- Modified error messages and expected results in HLR and offset tests for consistency.
- Refined metadata checks in GLTF and STEP tests to match revised reference sizes and values.
- Update Improvements cases with removing TODO
2026-04-30 10:38:25 +01:00
Pasukhin Dmitry
883cece8e3 Shape Healing - Refactor shape replacement logic to handle cycles (#1247)
Apply some fixes where aaa82fc4de introduce as a regressions
2026-04-30 00:01:00 +01:00
Pasukhin Dmitry
91be8c4c71 Coding - Fix MSVC warnings (#1246)
- Replace various `Size()` calls with `Extent()`/`Length()` (int-returning) when passing element counts into `Message_ProgressScope`.
- Make “unsupported id type” fallbacks explicit in `BRepGraphInc_Storage` visitors to avoid MSVC control-path warnings.
- Minor warning-focused cleanups (loop variable rename in a test, use of `BRepGraph_NodeId::Invalid()`, removal of duplicated `Standard_EXPORT`).
2026-04-29 16:31:37 +01:00
Pasukhin Dmitry
1db8025677 Coding - Apply Clang-Tidy automatic fixes (#1245)
Flags:
aChecks="modernize-deprecated-headers,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-nullptr,modernize-use-override,performance-avoid-endl,performance-move-constructor-init,readability-braces-around-statements,readability-delete-null-pointer,readability-redundant-control-flow,readability-redundant-declaration,readability-redundant-function-ptr-dereference,readability-redundant-member-init,readability-redundant-string-init,readability-static-accessed-through-instance"

clang-tidy version: 22.1.3
2026-04-29 15:04:38 +01:00
Pasukhin Dmitry
2cafd4fa58 Coding - Utilize NCollection_LinearVector instead vector (#1244)
- Replaced many `std::vector` usages with `NCollection_LinearVector`, updating call sites to use `Size()`, `Append()`, `EmplaceAppend()`, `Resize()`, `Reserve()`, `Clear()`, and `Data()`.
- Updated BVH array type plumbing to consistently use `NCollection_LinearVector`, simplifying conditional STL-vs-OCCT handling.
- Extended `NCollection_LinearVector` API (constructor with size+value, `Resize(size, value)`) and added new GTests for this behavior.
2026-04-29 11:46:00 +01:00
JIJINBEI
9255ff687a CI/Build - Enable -Werror on GCC/Clang (#1209)
- Inject `-Werror` (plus select warning toggles) into the shared GitHub Action used for configuring Linux/macOS builds.
- Replace several `0` / `CopyFromParent`-style null constants with `nullptr` to satisfy `-Wzero-as-null-pointer-constant`.
- Add defensive bounds/clamps and initialization to avoid fixed-buffer overreads/memcpy/sort issues and uninitialized reads.
2026-04-28 21:42:31 +01:00
JIJINBEI
4d64ddc666 Coding - Apply modernize-* and readability-* clang-tidy checks (#1207)
- Replaces `push_back(T(...))` with `emplace_back(...)` where applicable.
- Replaces `size() == 0` / `size() != 0` checks with `empty()` / `!empty()`.
- Simplifies trivial constructors/destructors to `= default` and removes redundant `(void)` parameter lists.
2026-04-28 20:01:47 +01:00
Pasukhin Dmitry
200d1d0b2f Moding - Update BRep Graph permission usage (#1242)
- Replaced many direct field writes in tests with `EditorView` typed setters and `GenOps::RemoveRef`, and updated mutation-gen tests to use `MarkDirty()`.
- Added incremental reverse-index bind/unbind helpers in `BRepGraphInc_ReverseIndex` and updated editor operations to maintain the reverse index without full rebuilds in many cases.
- Extended `BRepGraph_Copy`/`BRepGraph_Transform` to `CopyNode`/`TransformNode`, adding optional mesh-copy/transform support and new coverage tests.
2026-04-28 19:54:52 +01:00
Pasukhin Dmitry
39bbf2ed59 Testing - Migration QADraw tests to GTests (#1243)
- Added new GTests covering multiple historical regressions (intersection, projection, pipe shell, boolean ops, fillet, distances, gp transforms, string hashing).
- Registered new test sources in the relevant `GTests/FILES.cmake` lists.
- Removed legacy Tcl tests and removed the associated QADraw commands from `QABugs_*.cxx`.
2026-04-28 18:25:29 +01:00
Pasukhin Dmitry
051b12466a Coding - Update deprecated macros for aliases (#1241)
- Added `Standard_DEPRECATED_STD(...)` to `Standard_Macro.hxx`, expanding to the standard `[[deprecated("...")]]` attribute (or empty when `OCCT_NO_DEPRECATED` is defined).
- Replaced `Standard_DEPRECATED(...)` with `Standard_DEPRECATED_STD(...)` in multiple `GCE2d_*` alias headers to keep deprecation warnings while restoring compiler compatibility.
2026-04-28 16:24:49 +01:00
Pasukhin Dmitry
aaa82fc4de Modeling - Fix stack overflow and edge multiplication in shape healing with shared sub-shapes (#1227)
- Add replacement-chain leaf resolution (`ValueLeaf()`), cycle rejection on `Replace()`, and DFS in-flight guards to prevent recursive descent loops.
- Update ShapeFix healing routines to avoid repeated sub-shape re-expansion, add progress cancellation checkpoints, and reduce quadratic wire-fixing cost.
- Add/adjust regression coverage (new GTests; updated existing Draw tests/baselines).
2026-04-28 15:05:42 +01:00
Pasukhin Dmitry
3cf18a1452 Modeling - Implement degenerate thin solid detection (#1231)
Refactor FillSameDomainFaces to use parent solid instead of shell for Same-Domain face mapping
2026-04-28 12:54:13 +01:00
Pasukhin Dmitry
bea50c2fd8 Modeling - Tangent case with 2 cylinders (#1228)
2 cylinders are tangent along a line.
The analytical intersection returns a point which is not valid and it is a restriction of the analytical intersection algorithm.
The patch is ensured to use the implicit-implicit intersection algorithm.
2026-04-28 12:50:12 +01:00
Pasukhin Dmitry
048a2927fb Modeling - BRep Graph Builder and Editor clean up (#1237)
- Replace `BRepGraph_Builder::Perform()` with `BRepGraph_Builder::Add()` and introduce `BRepGraph::Clear()` as the rebuild boundary.
- Refactor product/occurrence editing APIs (e.g., `AddAssembly` → `CreateEmptyProduct`, `AddOccurrence` → `LinkProducts`, occurrence mutation via `Editor().Occurrences()`).
- Update a large set of GTests and inline docs to use the new lifecycle and API names.
2026-04-26 15:02:00 +01:00
Pasukhin Dmitry
0804c2b3f9 Testing - Migration QADraw tests to GTests (#1235)
- Removed multiple legacy DRAW test scripts and several QABugs DRAW command implementations.
- Added new GTest suites covering the migrated regressions in ModelingData/ModelingAlgorithms/FoundationClasses/DataExchange/ApplicationFramework.
- Updated multiple `FILES.cmake` lists to compile/link the new tests; introduced an additional `STEPControl_Writer::SetShapeFixParameters()` overload.
2026-04-26 12:22:37 +01:00
Pasukhin Dmitry
133fd8e228 Foundation - Array adding option to work with size_t (#1236)
- Added zero-based constructors (allocation + buffer-reuse wrapping) to `NCollection_Array1` and `NCollection_Array2`.
- Added `size_t`-based `Resize()` overloads (and refactored `NCollection_Array1` resize logic into a shared implementation).
- Added GTest coverage for the new zero-based construction / access / resize behaviors.
2026-04-25 21:41:35 +01:00
luzpaz
d94283c63f Documentation - Fix typos (#1234)
- Correct typo in `BSplCLib_MultDistribution` Doxygen comment (“mutiplicities” → “multiplicities”).
- Correct typo in a parallelism-related comment in `QABugs_20.cxx` (“syncronization” → “synchronization”).
- Correct typos in `QABugs_19.cxx` output strings and in STEP rendering properties comments (“applyed” → “applied”).
2026-04-25 19:31:42 +01:00
이대희
152c09a75c Visualization - Expose SelectMgr pixel tolerance via IVtk picker (#1204)
- Removes the dead `IVtkTools_ShapePicker::SetTolerance(float)` / `GetTolerance()` API and the unused stored tolerance value.
- Adds `SetPixelTolerance(int)` / `PixelTolerance() const` to `IVtkTools_ShapePicker` and `IVtkOCC_ShapePickerAlgo`, forwarding to `SelectMgr_ViewerSelector`.
- Removes `IVtkOCC_ViewerSelector`’s local cached tolerance fields and updates all `Pick()` overloads to apply `myTolerances.Tolerance()` on every pick.
2026-04-25 16:58:23 +01:00
gsdali
f99887f4e8 Modeling - Fix null context crash in ShapeUpgrade_FaceDivide::Perform() (#1203)
- Add lazy initialization of `ShapeBuild_ReShape` context in `ShapeUpgrade_FaceDivide::Perform()`.
- Add GTests covering `Perform()` without an explicit context and under parallel execution.
- Register the new GTest source in `TKShHealing` GTests CMake file list.
2026-04-25 16:30:40 +01:00
dpasukhi
7fdc69aee0 Coding - Fix missed Vector type
Fix type of triangle pairs in IntPatch_InterferencePolyhedron to use dynamic array
2026-04-25 14:53:34 +01:00
이대희
e3a34f5479 Configuration - Only link TKIVtk against RenderingGL2PSOpenGL2 when VTK provides it (#1214)
- Guard `vtkRenderingGL2PSOpenGL2` being appended to `USED_TOOLKITS_BY_CURRENT_PROJECT` behind a `TARGET` existence check for both namespaced (VTK 9) and legacy (VTK 7/8) target names.
- Add inline comments documenting why the guard is necessary (module omitted on Android/iOS and when building VTK with GLES).
2026-04-25 11:55:11 +01:00
Pasukhin Dmitry
bae76f50db Modeling - Update function handling in GeomFill_ConstrainedFilling and GeomFill_CoonsAlgPatch (#922)
- Fixed a bug in GeomFill_ConstrainedFilling::Init(): law functions were
  discarded due to erroneous use of method Func() instead of SetFunc().
- Corrected parameter usage in GeomFill_CoonsAlgPatch::Value() to ensure
  proper variable assignment for curve evaluation.
2026-04-25 11:46:46 +01:00
Pasukhin Dmitry
90f5d7b214 Coding - Deprecate NCollection_Vector (#1230)
- Updated multiple files to replace instances of NCollection_Vector with NCollection_DynamicArray
2026-04-24 21:47:27 +01:00
Pasukhin Dmitry
b91b6d48b4 Modeling - Optimize interference detection in polyhedra (#924)
- Introduced `IntPatch_PolyhedronBVH` to wrap polyhedra as BVH primitive sets
- Implemented `IntPatch_BVHTraversal` for efficient dual-tree traversal to find candidate triangle pairs
- Refactored `IntPatch_InterferencePolyhedron::Interference()` to use BVH-based detection
2026-04-24 16:15:40 +01:00
Pasukhin Dmitry
b7f849a23a Mesh - Refactor BRepMesh_BaseMeshAlgo to improve node registration logic (#940)
- Relocated used node binding from `initDataStructure()` to `registerNode()` to ensure consistent tracking of all nodes
- Added comprehensive GTest suite to validate internal vertex handling in mesh triangulation
2026-04-24 10:04:10 +01:00
Pasukhin Dmitry
7eb211cc2e Modeling - Refactor BRepGraph for uint32_t ids (#1229)
- Migrated node/ref/rep ID types and many count-returning APIs from `int` to `uint32_t`/`size_t` (history indices), updating iterators and bounds checks accordingly.
- Reworked numerous loops from raw integer indexing to typed-id iteration (`Start()`, `IsValid()`, range-for) across core code and tests.
- Expanded compaction test coverage (incl. bounding-box preservation assertion), plus clearer assertions/messages.
2026-04-23 22:09:31 +01:00
Dmitrii Kulikov
48e84c53a9 Modelling - Enhance 3D cycling detection in IntWalk_PWalking (#1226)
- Adds a 3D-distance based closure check that marks the intersection line as closed when the walker returns near the starting point.
- Forces early termination and closes the polyline by re-adding the first point when 3D cycling is detected.
2026-04-23 11:38:37 +01:00
Pasukhin Dmitry
a2e851b254 Visualization - Shader-based infinite grid for V3d (#1223)
The classical V3d_RectangularGrid / V3d_CircularGrid path generated all grid
lines on the CPU into a Graphic3d_Structure and recomputed them whenever any
parameter, the camera, or the privileged plane moved. Dense grids paid an
O(NxM) vertex rebuild per interaction and were effectively capped in extent;
there was no way to draw an infinite grid, a background (sky-plane) grid, or
a grid with sub-pixel line antialiasing.

This change promotes a shader-based grid to the single rendering path for
both rectangular and circular grids. Classical API, snap math and the vgrid
Draw command are preserved; only the presentation pipeline moves under the
shader.

Aspect layer:

- Add Aspect_GridParams: POD carrying shader-only appearance knobs (color,
  origin, Scale, ScaleY, LineThickness, RotationAngle, AngularDivisions,
  IsBackground, IsDrawAxis, IsInfinity, DrawMode, SizeX/SizeY, Radius,
  AngleStart/AngleEnd). EffectiveScaleY() returns ScaleY when non-zero and
  Scale() otherwise; IsCircular() is shorthand for AngularDivisions() > 0;
  IsBounded() / IsArc() report active clipping.
- Extend Aspect_RectangularGrid with SizeX/SizeY/ZOffset fields and
  accessors; extend Aspect_CircularGrid with Radius/ZOffset/AngleStart/
  AngleEnd and IsArc(). Snap math is unchanged.
- Add Graphic3d_CView::GridDisplay(Aspect_GridParams, gp_Ax3) and GridErase()
  virtuals with no-op defaults; include Aspect_GridParams.hxx and gp_Ax3.hxx
  from Graphic3d_CView.hxx.

Shader (Graphic3d_ShaderManager::getGridProgram):

- Full-screen triangle unprojected per-fragment to world-space Near/Far
  points, ray-plane intersection against an arbitrary plane supplied through
  uPlaneOrigin / uPlaneX / uPlaneY / uPlaneN uniforms. Per-fragment unproject
  avoids perspective-divide nonlinearity that plagues varying-based rays.
- Helper intersectPlane() uses a normalized direction for the parallel test,
  so GRID_PARALLEL_EPS = 1e-6 is a dimensionless |sin(angle)| threshold
  (~5.7e-5 deg) that stays scale-invariant under any world-depth range.
- gridLines2d / gridLines1d: fwidth-based AA plus per-axis Nyquist fade
  (smoothstep(1.0, 2.0, fwidth)). Once a grid period fits inside a single
  pixel, that axis fades to zero instead of smearing into a bright haze at
  grazing angles. Lines mode uses max() of per-axis alphas; points mode
  uses the product so only intersections light up.
- Bounded work area (rectangular SizeX/SizeY, circular Radius, optional arc
  range): hard discard and smoothstep endpoint are both extended by
  fwidth(coord), giving a single-screen-pixel AA transition instead of a
  binary staircase at the clipping edge.
- Stable-reference rebasing for the rectangular grid: CPU unprojects the
  screen center to the plane every frame and uploads the plane-local hit as
  uStableRefLocal + uHasStableRef. The shader subtracts
  floor(ref * scale) / scale before fract(), keeping the fract() argument
  bounded at far world offsets without changing the visible line pattern.
- Branch on uGridType (0 = rectangular, 1 = circular). Circular path uses
  polar coords (length, atan2) scaled by uScaleX and uAngularScale;
  plane-local X/Y axis colouring is applied uniformly in both modes so the
  red/green/blue cardinal lines stay straight.
- uDrawMode switches lines vs points (Aspect_GDM_Points); uIsBackground
  pins gl_FragDepth to 1.0 - 1e-5 for the sky-plane look. Explicit GL 3.2 /
  GLES 3.0 version headers; requires gl_VertexID and gl_FragDepth.

OpenGL plumbing:

- Add OpenGl_ShaderManager::BindGridProgram(): lazy Create + cache, routed
  through bindProgramWithState so the standard OCCT matrix uniforms
  (occProjectionMatrix, occWorldViewMatrix, occModelWorldMatrix and their
  inverses, occViewport) are pushed onto the grid program every bind.
  myGridProgram is nullified in clear() so context resets release the
  compiled program.
- Add OpenGl_View::GridDisplay / GridErase overrides and private
  renderGrid(). The renderer binds a dedicated VAO (core-profile safe) and
  saves/restores program, depth test / func / mask, blend enable,
  blend-func-separate, and depth-clamp. ProjectionState / WorldViewState are
  push/pop-guarded. Original ZNear/ZFar/ProjType are captured before any
  mutation so a mid-function ZFitAll cannot clobber user-set vzrange on
  restore.
- Background-mode pan/rotate compensation is derived from the view-matrix
  delta (currentView * refView^-1) captured at GridDisplay(); no public
  Graphic3d_Camera API change is needed.
- Compute the plane-local stable reference in renderGrid via
  Graphic3d_TransformUtils::UnProject on the viewport center; upload
  uStableRefLocal / uHasStableRef alongside the other uniforms.
- Insert renderGrid() between renderScene() and renderTrihedron() in the
  non-immediate draw pass; release myGridVao in ReleaseGlResources.

V3d layer:

- Add V3d_View::GridDisplay(params) / GridDisplay(params, plane) / GridErase
  as thin pass-throughs; the single-argument overload uses
  V3d_Viewer::PrivilegedPlane().
- Rewrite V3d_RectangularGrid and V3d_CircularGrid: drop the nested
  RectangularGridStructure / CircularGridStructure classes, myGroup,
  DefineLines, DefinePoints, and all myCur* caching flags. Display() /
  Erase() / UpdateDisplay() now call syncViews() which builds an
  Aspect_GridParams from the Aspect_{Rectangular,Circular}Grid state
  (XStep/YStep -> Scale/ScaleY, RadiusStep -> Scale, DivisionNumber ->
  AngularDivisions, XOrigin/YOrigin/OffSet -> Origin, RotationAngle ->
  RotationAngle, SizeX/SizeY/Radius/ArcRange -> bounds, DrawMode)
  and broadcasts it over V3d_Viewer::DefinedViews(). Snap math in
  Aspect_RectangularGrid / Aspect_CircularGrid is untouched.
- V3d_RectangularGrid is unbounded by default (SizeX = SizeY = 0). The grid
  renderer honours an explicit SetSizeX / SetSizeY to activate in-shader
  clipping with AA edges; applications that want the old bounded behaviour
  set the size explicitly.

Draw / tests:

- vgrid Draw command gains -type {rect|circ|inf|infinite}, -color R G B,
  -scale N, -lineThickness T, -background {0|1}, -drawAxis {0|1},
  -inf {0|1}. Existing -origin, -step, -rotAngle, -zoffset, -size, -radius,
  -mode flags are retained and now drive the shader path.
- tests/v3d/grid/ (new group) adds ortho, persp, inf_pan, inf_rotate,
  inf_plane, rect_shader, circ_shader, rect_points, inf_options,
  bounded_rect, bounded_circ Draw regressions covering background mode,
  matrix-derived pan/rotate stability, non-XY privileged planes,
  anisotropic rectangular cells, polar divisions, points draw mode, and
  in-shader bounded clipping. Registered in tests/v3d/grids.list.
- Add src/Visualization/TKService/GTests/Aspect_GridParams_Test.cxx covering
  defaults, round-trip, copy, EffectiveScaleY fallback, RotationAngle
  round-trip, AngularDivisions / IsCircular toggle, and DrawMode round-trip.
- Add src/Visualization/TKService/GTests/Aspect_Grid_Bounds_Test.cxx
  covering SizeX/SizeY/Radius/ArcRange on the base grid classes.

Behaviour notes:

- V3d_RectangularGrid and V3d_CircularGrid no longer rely on
  Graphic3d_Structure view affinity, so new views added to the viewer after
  V3d_Viewer::ActivateGrid() must trigger a re-broadcast (call
  Grid()->Display() on the viewer or re-activate) to pick up the grid.
- Aspect_GDM_Points is now rendered as dots at grid intersections through
  uDrawMode (not as the old CPU point markers). Applications that depended
  on point markers as selectable entities should present them through a
  dedicated AIS object.
- V3d_RectangularGrid is unbounded by default; the old behaviour of
  capping to 0.5 * DefaultViewSize() is available via an explicit
  SetSizeX / SetSizeY call.
- Aspect_GridParams::Origin is a plane-local offset; the plane itself is
  supplied as a gp_Ax3 (defaults to V3d_Viewer::PrivilegedPlane()).
2026-04-23 11:35:16 +01:00
Pasukhin Dmitry
b1646d7564 Visualization - complete AIS_ColorScale face-culling fix (#1225)
Complete the AIS_ColorScale rectangle winding fix by following the
upstream patch revision from Kirill Gavrilov <kirill@sview.ru>,
commit 9b8c6240d10ab709ac611503dcc40e45b83fb3d1.

Switch the rectangle helper from manual triangle edges to
Graphic3d_ArrayOfPrimitives::AddQuadTriangleEdges() while preserving
the top/bottom color layout. This keeps the quad in a consistent CCW
orientation and avoids visible seam edge or front-face loss when BACK
face culling is enabled.

Add DRAW regression test tests/v3d/colorscale/colorscale_faceculling
using the original reproduction scenario and a pixel check for the
front face.
2026-04-22 18:35:43 +01:00
Dmitrii Kulikov
9d498125ba Modelling - Crash in BRepFill_PipeShell::MakeSolid() (#1224)
- Refactors `IsSameOriented()` to iterate over face edges and select one that is present in the shell’s edge→faces map.
- Adds a guard (`Contains`) before `FindFromKey()` to prevent invalid map access.
- Updates local naming (`theFace`, `theShell`, `anEdgeFaceMap`) to match common OCCT parameter naming style.
2026-04-22 16:56:25 +01:00
Pasukhin Dmitry
c076c4ed03 Visualization - Fix polyline selection inclusion test and point-in-polyline check (#1222)
Replaces two buggy pieces of SelectMgr_TriangularFrustumSet used during
polyline (polygon rubber-band) selection:

- OverlapsBox(min, max, bool* theInside): the corner-edge isIntersectBoundary
  heuristic produced false "fully inside" answers whenever an AABB was large
  enough that its 12 edges did not cross the polyline but its interior did
  not lie inside either. Rewrite: first probe every frustum for any overlap;
  if none, return false. Otherwise, project the 8 AABB corners onto the
  frustum near plane and apply a ray-cast inside test against the original
  polyline loop. If any corner projects outside, clear theInside; else leave
  it untouched. The near-plane coplanarity assumption is guaranteed by
  Build(), which derives every near vertex from
  myBuilder->ProjectPntOnViewPlane(x, y, 0.0).

- OverlapsPoint(const gp_Pnt&): previously a stub returning false, which made
  strict-inclusion polyline selection of Select3D_SensitiveTriangle,
  SensitivePoly, SensitiveTriangulation, SensitivePrimitiveArray,
  MeshVS_CommonSensitiveEntity and MeshVS_SensitiveQuad silently impossible
  (those sensitive types call theMgr.OverlapsPoint(...) on each vertex in
  strict-inclusion mode; a blanket false meant nothing was ever picked). Now
  delegates to the same near-plane projection + ray-cast test, so strict
  inclusion works for all these sensitive types in polyline mode.

Covered by a new Draw test tests/vselect/bugs/bug_polyline_inclusion that
exercises both strict-inclusion and overlap modes for spheres inside/outside
a polygonal rubber band. No GTest is added because constructing a working
TriangularFrustumSet requires a configured Graphic3d_Camera + viewport; the
Tcl test is the regression gate.
2026-04-22 11:29:49 +01:00
Pasukhin Dmitry
0ad69de760 Visualization - Add GetVertex accessor to Select3D_SensitivePrimitiveArray (#1221)
Returns the three vertex positions of the triangle at the given index as a
std::array<NCollection_Vec3<float>, 3>. Downstream selection consumers can
now query the triangulation geometry of a picked primitive array without
re-walking the underlying Graphic3d_Buffer/Graphic3d_IndexBuffer.

Uses the existing file-local getTriIndices helper and the private getPosVec3
member, so the implementation is a pure accessor. Returning std::array keeps
the contract explicit (always three vertices, no heap allocation)
2026-04-22 08:32:37 +01:00
Pasukhin Dmitry
dc357cf4d6 Visualization - Fix AIS_ColorScale rectangle triangle winding (#1220)
Swap the last two vertex indices in the second triangle of each color-scale
rectangle so the two triangles share the same diagonal with consistent CCW
orientation. Earlier indexing (v+1, v+2, v+3) built two overlapping triangles
with opposite winding, producing visible seams and dropped vertices under
back-face culling.
2026-04-21 23:12:30 +01:00
Pasukhin Dmitry
98ca3a5a32 Visualization - Fix selection for objects with group-level flipping (#1219)
Selection was broken for presentations that used Graphic3d_Group::SetFlippingOptions
(AIS_TextLabel, PrsDim_Dimension): OpenGl_Flipper mirrors the geometry at draw time
to keep labels upright relative to the camera, but the selection pipeline computed
BVH boxes and sensitive frustums in the unflipped local coordinates. When the camera
was rotated past the flipping threshold, clicks on the on-screen label missed.

- Add Graphic3d_Flipper: a CPU-side analogue of OpenGl_Flipper carrying the reference
  plane and templated Compute()/Apply() that reproduces the render-time flip matrix.
  Each flip branch is a 180 deg rotation (involution), so the matrix is self-inverse.
- Extend Graphic3d_CStructure with HasGroupFlipping()/SetGroupFlipping() alongside
  the existing transform-persistence flag; reset it in Graphic3d_Structure::clear().
- Add Graphic3d_Group::Flipper() and a myFlipper member populated from
  OpenGl_Group::SetFlippingOptions(true,...). The render-side OpenGl_Flipper element
  is still emitted for the push/pop bracket; myFlipper persists across the matching
  SetFlippingOptions(false,...) call so the selection side can see that the group
  contains flipped geometry.
- Add Select3D_SensitiveEntity::Flipper() / SetFlippingOptions() so sensitive
  entities can carry the same flipping metadata used by the selection traversal;
  include the handle in DumpJson.
- SelectMgr_SensitiveEntitySet tracks myNbEntityWithFlipping in Append()/Remove();
  HasEntityWithFlipping() exposes it to the viewer selector.
- SelectMgr_SelectableObjectSet::appropriateSubset() routes presentations with
  HasGroupFlipping() to the 3d-persistent BVH subset (same as transform persistence).
- BVHBuilderAdaptorPersistent merges the flipping and transform-persistence loops
  into a single pass: for each group with a Flipper or TransformPersistence, build
  its local bbox, apply the flip (if any), then apply the TransformPersistence
  (if any), then add the resulting box to the object bbox; object-level
  TransformPersistence is applied once to the merged box. Note: for the rare case
  of object-level + group-level TransformPersistence the application order differs
  from the prior code (object-TP now runs after group-TP contributions are added).
  Common cases (only one or the other) are behavior-preserving.
- SelectMgr_ViewerSelector::traverseObject() bypasses the root/per-node overlap
  early-outs when the entity set contains flipped sensitives, and folds the flip
  matrix into aInvFlippingAndPers = T_flip * aInvSensTrsf before computeFrustum()
  and checkOverlap(). Using T_flip directly is valid because it is self-inverse.
  Before Compute(), the object's Transformation() is folded into aMVForFlip via
  Graphic3d_TransformUtils::Convert<double> so the isReversedX/Y/Z decision
  agrees with OpenGl_Flipper::Render() which uses WorldView * ModelWorld.
- SelectMgr_SelectableObjectSet::BVHBuilderAdaptorPersistent computes the same
  aMVForFlip once per object (hoisted outside the group loop) and passes it to
  Graphic3d_Flipper::Apply, so BVH bounds and per-sensitive overlap testing use
  the same flip matrix.
- SelectMgr::ComputeSensitivePrs() forwards the flipper to the debug presentation's
  current group so selection-mode visualization reflects the flip.

Known limitation (narrowed): the selection pipeline now folds the object's
Transformation() into the MV passed to Graphic3d_Flipper::Compute, covering the
common case of a flipping label on a rotated assembly. Group-level
Graphic3d_Group::Transformation() is still not folded in on the selection side
because the sensitive entity does not carry a reference to its host group; this
only affects consumers that give the flipping group its own non-identity gp_Trsf
(uncommon in stock OCCT). A TODO in Graphic3d_Flipper::Compute and
SelectMgr_ViewerSelector marks the deferred follow-up.
2026-04-21 21:38:38 +01:00
Pasukhin Dmitry
d75806d9bd Data Exchange - Fix PMI measurument conversion factor (#1218)
- Extend STEPCAF dimension value conversion to recognize `StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI` and `StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI`.
- Extend regression test `bug33095` to validate scaling of the nominal dimension value between `m` and `mm`.
2026-04-21 20:49:12 +01:00
Dmitrii Kulikov
75d90efe55 Data Exchange - Crash in XSControl_Reader::OneShape() (#1216)
- Allow `TransferRoots()` and `TransferList()` to append null `TopoDS_Shape` results (matching `TransferEntity()` behavior).
- Update `OneShape()` to skip null shapes when building the result compound to avoid a crash.
- Refactor transfer loops / locals (naming, progress scope sizing, `size_t` iteration).
2026-04-21 17:47:53 +01:00
Dmitrii Kulikov
2f3554f981 Data Exchange - Segfault in CheckSRRReversesNAUO (#1215)
- Add null-checks around `SDR->Definition().PropertyDefinition()` before extracting `ProductDefinition()` (both for `rep1`/`pd1` and `rep2`/`pd2`).
2026-04-21 09:56:02 +01:00
Pasukhin Dmitry
0755b6f31d Foundation, Modeling - NCollection modernization and BRepGraph overhaul (#1212)
- Migrate NCollection map/sequence/array size APIs from int to size_t; Size() returns size_t, Length() remains the int accessor; int overloads delegate through NbBucketsFromInt() with a negative-input guard.
- Add NCollection_LinearVector: contiguous flat-buffer dynamic array with Standard::Reallocate-based growth for trivial types and move-construction for non-trivial types.
- Rewrite NCollection_DynamicArray on top of LinearVector<T*>; switch to power-of-two block sizing with precomputed shift/mask.
- Rework NCollection_BaseMap iterator with a forward findFirst() helper (no negative-bucket arithmetic); unify ReSize/BeginResize/EndResize on size_t.
- Enable thread-safe fast path in NCollection_IncAllocator via std::shared_mutex + CAS bump allocation on atomic AvailableSize; exclusive lock is taken only for new-block allocation and list reordering.
- Remove NCollection_BasePointerVector (superseded by NCollection_LinearVector).
- Remove NCollection_BaseMap::Statistics (unused).
- Add <cstddef> include in NCollection_Primes.hxx so size_t resolves on clean builds.
- Document iterator invalidation contract on NCollection_LinearVector.
- Unify BRepGraph programmatic mutation behind EditorView: delete BuilderView (2648+552 lines); EditorView (3186+930 lines) and EditorView_Mut.cxx own both structural creation (Add*/Remove*) and field-level RAII-scoped mutation (Mut*()) with automatic OwnGen and SubtreeGen propagation.
- Add BRepGraph_MeshCache and BRepGraph_MeshView: two-tier mesh storage separating algorithm-derived caches from persistent (definition) triangulations; freshness is keyed on FaceDef.OwnGen; cache writes do not mutate the model.
- Document the MeshCache invalidation contract in BRepGraph_MeshCache.hxx (which mutations bump Face.OwnGen and how markRepModified closes the loop for Surface/Triangulation reps).
- Add BRepGraph_RefsIterator (generic flat ref scan with RefTraits dispatch) and BRepGraph_ReverseIterator (typed parent-traversal wrappers over reverse-index vectors).
- Rework RefId entity model: replace inline refs with typed RefId vectors; add OccurrenceRef and Kind::Occurrence=7; BRepGraphInc_WireExplorer now requires a VertexRefLookup.
- Rename layers for consistency: BRepGraph_ParamLayer to BRepGraph_LayerParam, BRepGraph_RegularityLayer to BRepGraph_LayerRegularity; rename BRepGraphInc_Usage to BRepGraphInc_Instance.
- Replace RootNodeIds() with RootProductIds() returning product roots only.
- Update BRepGraph and BRepGraphInc READMEs; fix stale RootNodeIds reference.
- Sweep Size() to Length() renames across ~200 callers in TKG2d, TKG3d, TKMath, TKMesh, TKBO, TKOffset, TKShHealing, TKTopAlgo, TKBRep, TKService, TKV3d, TKOpenGl, TKMeshVS, TKDE*, TKXCAF, TKXSBase, TKLCAF, TKStd, and Draw harness.
- Add GTest coverage for new containers and the BRepGraph overhaul: NCollection_DynamicArray_Test, NCollection_LinearVector_Test, BRepGraph_Fuzz_Test, BRepGraph_Iterator_Test, BRepGraph_LayerIterator_Test, BRepGraph_MeshCache_Test, BRepGraph_MutGuard_Test, BRepGraph_ReplaceVertex_Test, BRepGraph_ReverseIterator_Test, BRepGraph_ScenarioMatrix_Test, BRepGraph_TypedIdDispatch_Test, BRepGraph_WireExplorer_Test.
2026-04-19 18:47:54 +01:00
Pasukhin Dmitry
b3ccf20b1c Testing - Windows ARM64 master validation (#1213)
Move Windows ARM64 validation from IR to master
2026-04-19 18:46:19 +01:00