Commit Graph

3110 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
Pasukhin Dmitry
a56f2394ce Modeling - Revert changes to original version (#1187)
Refactor GeomBndLib classes for old version of bounding box calculations
Can be fixed later.
- Added new test case for BSplineCurve trimmed range comparison with BndLib.
- Enhanced GeomBndLib_BSplineCurve to handle parameter adjustments for periodic curves.
- Updated GeomBndLib_BSplineCurve2d to improve bounding box calculations.
- Refined GeomBndLib_BSplineSurface to use grid sampling for bounding box determination.
- Optimized GeomBndLib_BezierCurve and GeomBndLib_BezierCurve2d for bounding box calculations.
- Simplified GeomBndLib_SurfaceOfExtrusion and GeomBndLib_SurfaceOfRevolution by leveraging GeomBndLib_OtherSurface for bounding box computations.
- Improved GeomBndLib_Torus to utilize BndLib for bounding box calculations, including handling degenerate cases.
2026-04-05 14:57:53 +01:00
Winfried Holzapfel
1b0c828bdc Visualization - Include transform of shape in sub-owner bounding box (#1164)
- Apply `SelectMgr_SelectableObject` transformation when computing `BndBoxOfSelected()` for selected sub-owners.
- Add Draw Harness regression test for `MeshVS_Mesh` vertex selection with a transformation.
- Add Draw Harness regression test for transformed `TopoDS_Shape` face selection to ensure existing behavior remains correct.
2026-03-27 11:11:06 +00:00
Harish RS
71b50963ea Testing - Add Windows ARM64 build and test support (#1135)
- Introduces new Windows ARM64 jobs in the multi-platform workflow (build, test, retest, gtest).
- Extends composite GitHub actions with a `target-arch` input and adds ARM64 Mesa llvmpipe setup for headless rendering.
- Adjusts architecture reporting (`dversion`) and updates one mesh regression test with ARM64-specific expected values; updates a DE enum definition to avoid an MSVC ARM64 LTCG miscompile.
2026-03-24 10:24:31 +00:00
Pasukhin Dmitry
39db714224 Modeling Data - Migrate BndLib to delegate to GeomBndLib (#1137)
- Replace monolithic switch statements in BndLib_Add3dCurve, BndLib_AddSurface, and BndLib_Add2dCurve with thin wrappers delegating to GeomBndLib_Curve, GeomBndLib_Surface, and GeomBndLib_Curve2d respectively.
- Remove now-dead internal helpers AddGenCurv, AddGenSurf, and BndLib_Box2dCurve. Public BndLib API is preserved unchanged.
- Implement proper BoxOptimal() in GeomBndLib_OffsetSurface: try the analytic equivalent surface first (offset plane -> plane, offset sphere -> sphere), then fall back to OtherSurface PSO sampling for general cases.
- Refactor GeomBndLib_OffsetCurve2d to share exact fast paths for line and circle offsets between Box() and BoxOptimal(), matching the 3D OffsetCurve pattern; BoxOptimal falls back to OtherCurve2d PSO for general curves.
- Update tests to reflect tighter bounds from GeomBndLib delegation.
2026-03-07 17:55:33 +00:00
Kirill Gavrilov
be39f6f6be Visualization, Graphic3d_ShaderProgram - add mat3/mat4 types to PushVariable (#1112)
Port of commit 1e1584357 adapted to the new source layout
and modern NCollection_Mat3/NCollection_Mat4 types.

- Graphic3d_ShaderVariable: register NCollection_Mat3<float> and
  NCollection_Mat4<float> type IDs; add template instantiations
  and Graphic3d_UniformMat3/Graphic3d_UniformMat4 typedefs.
- Graphic3d_ShaderProgram: add PushVariableMat3() and PushVariableMat4()
  convenience methods.
- OpenGl_ShaderProgram: add single-value SetUniform() for mat3
  (wrapping glUniformMatrix3fv); register mat3/mat4 in
  OpenGl_VariableSetterSelector so custom uniforms are dispatched.
- ViewerTest (vshader command): add -vec2, -vec3, -vec4, -mat3, -mat4
  argument parsing for setting custom uniform variables from Draw Harness.
- Add Draw Harness test exercising the new uniform types.
2026-02-23 18:20:22 +00:00
Pasukhin Dmitry
48ebca0f70 Modeling Data - Remove std::optional from EvalD* evaluation API (#1094)
Replace std::optional return types with direct returns and exception-based
error handling in Geom/Geom2d/Surface EvalD0/D1/D2/D3/DN methods to avoid
performance overhead of std::optional wrapping on the hot evaluation path.

Changes:
- EvalD* methods now return result structs directly instead of
  std::optional<T>, throwing Geom_UndefinedValue/Geom_UndefinedDerivative
  on failure
- D0/D1/D2/D3/DN inline wrappers simplified to unpack direct returns
  instead of checking optional validity
- TryEval* helper functions in EvalRepUtils converted from
  std::optional<T> returns to bool + output parameter pattern
- Adaptor classes (Adaptor3d_Curve/Surface, Adaptor2d_Curve2d,
  GeomAdaptor_Curve/Surface, Geom2dAdaptor_Curve) simplified by
  removing try-catch wrappers around evaluation calls
- Removed dead #include <optional> from 5 header files
- Updated GTests to match new direct-return API
2026-02-15 17:41:13 +00:00
Pasukhin Dmitry
9e61627dab Testing - Remove long-running DRAW test cases with low diagnostic value (#1093)
Remove several DRAW Harness tests that consume significant CI/CD time
without providing meaningful regression coverage:

- bugs/heal/bug25712 (~307s CPU): Runs ShapeFix_Solid in a loop of 100
  iterations to check non-deterministic behavior. Pure numerical check
  with no image verification; determinism is better validated by GTests.

- v3d/anim/videorecorder (~213s CPU): Records a video file using
  ray-tracing with MSAA. Requires FFmpeg and produces no reference
  image comparison; only verifies that the file is created.

- perf/bop/boxholes (~28s CPU): Cuts 1521 cylinders from a box to
  test memory consumption. Pure performance/memory benchmark with no
  geometry validation; results vary across hardware configurations.

- perf/bspline/intersect (~20s CPU): Intersects 16 NURBS surfaces
  against each other (240 pairs). Pure computation benchmark with
  no result validation; only measures elapsed time.

- perf/de/bug23979 (~20s CPU): Exports 10000 prisms to STEP format
  to measure write performance. Pure I/O benchmark with no data
  validation; results depend on disk and system load.
2026-02-15 16:12:46 +00:00
Pasukhin Dmitry
7295facb87 Modeling Data, Algorithms - Add std::optional evaluation API to Geom/Geom2d/Surface hierarchies (#1064)
Introduce exception-safe evaluation methods (EvalD0/EvalD1/EvalD2/EvalD3/EvalDN) returning std::optional across the entire Geom_Curve, Geom2d_Curve, and Geom_Surface class hierarchies. These replace the old throwing D0/D1/D2/D3/DN as the primary virtual dispatch points. The old output-parameter methods are retained as non-virtual inline backward-compatible wrappers that throw on failure.

Key design decisions:
- std::optional<T> chosen over embedded-bool structs: identical performance (same 8-byte alignment overhead for POD types), but provides standard C++17 vocabulary, sanitizer-detectable invalid access, and natural return of gp_Pnt for D0 / gp_Vec for DN without wrapper types.
- NRVO optimization: always-succeeding classes (25 of 29) use std::optional<T>{std::in_place} as the local variable, enabling Named Return Value Optimization for zero-copy returns. Failure-path classes (Offset*, GeomPlate, Bisectors) retain early-return std::nullopt pattern.

New headers:
- Geom.hxx: POD result structs Geom_CurveD1/D2/D3, Geom_SurfD1/D2/D3 bundling point + derivative vectors for 3D curves and surfaces.
- Geom2d.hxx: POD result structs Geom2d_CurveD1/D2/D3 for 2D curves.

Base class changes (Geom_Curve, Geom_Surface, Geom2d_Curve):
- New pure virtual EvalD0/EvalD1/EvalD2/EvalD3/EvalDN returning std::optional; std::nullopt signals evaluation failure without exceptions.
- Old void D0(U,P) / void D1(U,P,V1) / gp_Vec DN(U,N) etc. become non-virtual inline wrappers that throw Geom_UndefinedValue/Geom_UndefinedDerivative on nullopt, preserving all existing call sites unchanged.

Leaf class implementations (32 classes, 87 files):
- 7 Geom_Curve leaves: Line, Circle, Ellipse, Hyperbola, Parabola, BSplineCurve, BezierCurve - always succeed, NRVO-optimized.
- 2 Geom_Curve delegators: TrimmedCurve, OffsetCurve - forward to basis curve.
- 11 Geom_Surface leaves: Plane, CylindricalSurface, ConicalSurface, SphericalSurface, ToroidalSurface, BSplineSurface, BezierSurface, SurfaceOfLinearExtrusion, SurfaceOfRevolution - always succeed, NRVO-optimized.
- 2 Geom_Surface delegators: RectangularTrimmedSurface, OffsetSurface.
- 7 Geom2d_Curve leaves: Line, Circle, Ellipse, Hyperbola, Parabola, BSplineCurve, BezierCurve - always succeed, NRVO-optimized.
- 2 Geom2d_Curve delegators: TrimmedCurve, OffsetCurve.
- 3 external subclasses: Bisector_BisecAna, Bisector_BisecCC, Bisector_BisecPC, ShapeExtend_ComplexCurve, ShapeExtend_CompositeSurface, GeomPlate_Surface.

Additional changes:
- GeomGridEval.hxx: replaced duplicated struct definitions with type aliases (using CurveD1 = Geom_CurveD1, etc.).
- GeomAdaptor_Surface.cxx: updated to use new EvalD* API.

GTests added (3 files, 15 test cases):
- Geom_CurveEval_Test.cxx: Circle D0/D1/D2/D3, Line D2, BSpline consistency with old API, EvalDN vs EvalD1 consistency, OffsetCurve nullopt/throw paths.
- Geom_SurfaceEval_Test.cxx: Plane D0/D1, Sphere D1, BSplineSurface D2 consistency with old API, OffsetSurface on regular surface.
- Geom2d_CurveEval_Test.cxx: Circle D0/D1, OffsetCurve nullopt path, BSpline consistency with old API.
2026-02-13 16:08:55 +00:00
Kirill Gavrilov
078dfc44ae Foundation Classes, Standard_ErrorHandler - use thread_local stack instead of global mutex lock (#980)
Refactored Standard_ErrorHandler to use thread_local storage for the error handler stack
instead of a global list protected by mutex. This eliminates locking overhead entirely
since each thread only accesses its own error handlers.

Changes:
- Replaced global mutex-protected stack with thread_local Top pointer
- Simplified FindHandler() to directly return the thread-local Top
- Removed Catches() and LastCaughtError() methods (no longer needed)
- Added Raise() method for re-throwing caught exceptions
- Removed obsolete member variables: myStatus, myThread
- Deleted unused headers: Standard_HandlerStatus.hxx, Standard_JmpBuf.hxx, Standard_PErrorHandler.hxx
- Updated OCC_CATCH_SIGNALS macro to use new Raise() method
2026-01-05 17:03:00 +00:00
Pasukhin Dmitry
a15fed9b86 Coding - Temporary remove samples from the repository (#960)
- Moved tcl samples to resource folder.
- Clean up cmake from samples related settings.
- Removed CSharp samples from the repository.
- Removed MFC samples from the repository.
- Removed Qt samples from the repository.
- Removed Inspector samples from the repository.
- Removed glwin samples from the repository.
- Removed webgl samples from the repository.
- Removed xaml samples from the repository.
- Removed Java samples from the repository.
2025-12-27 21:51:28 +00:00
Pasukhin Dmitry
fe2595e21a Modeling - Refactor Evaluator classes to inline Utils and variant-based Adaptors (#935)
This commit completes the refactoring of geometry evaluator classes, replacing polymorphic Handle-based evaluators with inline template utilities and std::variant-based data storage in adaptor classes.

Key changes:

1. Removed GeomEvaluator and Geom2dEvaluator packages:
   - Deleted GeomEvaluator_Curve, GeomEvaluator_Surface base classes
   - Deleted GeomEvaluator_OffsetCurve, GeomEvaluator_OffsetSurface
   - Deleted GeomEvaluator_SurfaceOfExtrusion, GeomEvaluator_SurfaceOfRevolution
   - Deleted Geom2dEvaluator_Curve, Geom2dEvaluator_OffsetCurve

2. Added private utility headers (.pxx files) with inline template functions:
   - Geom_OffsetCurveUtils.pxx - offset curve evaluation
   - Geom_OffsetSurfaceUtils.pxx - offset surface evaluation
   - Geom_ExtrusionUtils.pxx - surface of extrusion evaluation
   - Geom_RevolutionUtils.pxx - surface of revolution evaluation
   - Geom2d_OffsetCurveUtils.pxx - 2D offset curve evaluation

3. Refactored GeomAdaptor_Curve:
   - Moved BezierData and BSplineData structs inside the class
   - Added std::variant<monostate, OffsetData, BezierData, BSplineData> for type-specific evaluation data
   - Removed separate myBSplineCurve and myCurveCache members
   - Updated all evaluation methods to use variant-based access

4. Refactored GeomAdaptor_Surface:
   - Changed ExtrusionData and RevolutionData to use Handle(Adaptor3d_Curve) instead of Handle(GeomAdaptor_Curve) for flexibility
   - Changed RevolutionData to store gp_Ax1 instead of separate AxisLoc/AxisDir
   - Updated OffsetData to store Handle(Geom_OffsetSurface) for osculating surface queries instead of creating new Geom_OsculatingSurface

5. Updated Geom_OsculatingSurface:
   - Renamed UOscSurf/VOscSurf methods to UOsculatingSurface/VOsculatingSurface for consistency with Geom_OffsetSurface public API

6. Fixed specialized adaptor classes:
   - GeomAdaptor_SurfaceOfLinearExtrusion - removed evaluator, uses variant
   - GeomAdaptor_SurfaceOfRevolution - removed evaluator, uses variant
   - Geom2dAdaptor_Curve - updated to use variant-based data
   - Adaptor2d_OffsetCurve - updated to use Geom2d_OffsetCurveUtils

7. Fixed Geom_SurfaceOfRevolution:
   - Updated utility calls to use gp_Ax1 parameter instead of separate XYZ

8. Added missing includes in dependent files:
   - Adaptor3d_HSurfaceTool.cxx - added GeomAdaptor_Curve.hxx
   - GeomAdaptor.cxx - added Adaptor3d_Surface.hxx, GeomAbs_SurfaceType.hxx
   - Extrema_GenExtPS.cxx - added Adaptor3d_Curve/Surface.hxx, GeomAbs_IsoType.hxx
   - TopOpeBRepTool_GEOMETRY.cxx - added Geom2dAdaptor_Curve.hxx
   - BRepAdaptor_Curve2d.cxx - updated ShallowCopy for variant

Benefits:
- Reduced virtual function call overhead in hot evaluation paths
- Better code locality with inline template functions
- Simplified class hierarchy without abstract evaluator base classes
- More efficient memory layout with variant instead of polymorphic handles
- Consistent method naming across related classes
2025-12-21 10:28:25 +00:00
Pasukhin Dmitry
e417b0c408 Foundation Classes - Refactor math_DirectPolynomialRoots (#937)
Modernized and refactored the polynomial root-finding implementation
with improved numerical stability and modern C++ practices.

Key changes:

1. Implementation refactoring (math_DirectPolynomialRoots.cxx):
   - Extracted helper functions into anonymous namespace for better encapsulation
   - Introduced ScaledCoefficients struct for coefficient scaling operations
   - Added separate functions for cubic root cases (three real, one real, multiple)
   - Replaced deprecated OCCT math functions with std:: equivalents
     (std::abs, std::sqrt, std::pow, std::log, std::cos, std::sin, std::atan, std::max)
   - Improved code documentation with algorithm references

2. Header modernization (math_DirectPolynomialRoots.hxx):
   - Added comprehensive Doxygen documentation for all public methods
   - Renamed private members to follow OCCT conventions (myDone, myRoots, etc.)
   - Moved inline implementations from .lxx file directly into header
   - Removed math_DirectPolynomialRoots.lxx file (merged into .hxx)

3. Test improvements:
   - Added test fixture class for math_DirectPolynomialRoots with helper methods
   - Extended test coverage with numerical stability tests
   - Added regression tests for problematic quartic cases
   - Added Geom2dGcc_Circ2d3Tan tests for BUC60622 regression case

4. Minor fixes:
   - Removed unused #include <iostream> from test file
   - Updated FILES.cmake to remove deleted .lxx file
   - Fixed test case expected values in bug28626_2
2025-12-19 16:07:59 +00:00
Pasukhin Dmitry
4727f7c049 Modeling Data - Refactor offset curve and surface evaluators (#930)
Extract derivative calculation logic from GeomEvaluator and
  Geom2dEvaluator classes into dedicated utility headers:
- Geom_OffsetSurfaceUtils.pxx for 3D offset surface derivatives
- Geom_OffsetCurveUtils.pxx for 3D offset curve derivatives  
- Geom2d_OffsetCurveUtils.pxx for 2D offset curve derivatives
- Geom_ExtrusionUtils.pxx for extrusion surface calculations
- Geom_RevolutionUtils.pxx for revolution surface calculations

Utility functions provide unified handling of singular and non-singular
  cases with osculating surface support for higher-order derivatives.

Buffer management uses NCollection_LocalArray for stack-safe allocation
  with heap fallback when sizes exceed expected limits.

Test case expectations updated to reflect improved calculation accuracy.
2025-12-16 21:06:40 +00:00
Pasukhin Dmitry
cb19690573 Testing - Update Ref tests mesh and offset test cases (#895)
Update private test reports after #892 #890 #894 #889
2025-12-08 12:40:03 +00:00
Pasukhin Dmitry
3b8185bafb Shape Healing - Optimize PCurve projection (#890)
- Implemented various test cases including projections of lines, circles, and B-splines on different surface types (planes, cylinders, spheres, and toroids).
- Refactored ShapeConstruct_ProjectCurveOnSurface to improve handling of periodic surfaces and edge cases.
- Updated header files to reflect new type aliases and improved structure for better readability and maintainability.
- Added a new function `extractBSplineCurve` to streamline the extraction of B-spline curves from both trimmed and untrimmed curves.
- Refactored `isBSplineCurveInvalid` to utilize the new extraction function, improving clarity and reducing code duplication.
- Updated `generateCurvePoints` to leverage the new extraction method for better handling of B-spline curves.
- Replaced std::vector with NCollection_Vector for better memory management in isBSplineCurveInvalid.
- Enhanced rebuildBSpline function to improve knot adjustment logic while preserving curve geometry.
- Introduced a new utility class, SurfaceProjectorWithCache, to enhance the projection of points onto B-spline surfaces by caching pole positions and their UV parameters.
2025-12-08 09:08:13 +00:00
Pasukhin Dmitry
b9f46ada4c Modeling - Fix thickness operation regression on circle-to-polygon lofts (#889)
- Fixed CheckMixedContinuity to detect actual mixed concavity
  (both convex and concave regions) instead of any G1/non-G1 transitions
- Added null edge and PCurve checks in RefEdgeInter to prevent crashes
- Added GTests for BRepOffset_MakeOffset covering various loft scenarios
2025-12-07 11:12:27 +00:00
Pasukhin Dmitry
c04f5e0b4c Modeling - Optimize BndLib and add GTests (#856)
- Fix negative modulo in torus bounding box computation
- Fix hyperbola extrema loop early break condition
- Fix OpenMin/OpenMax direction sign for infinite bounds
- Remove dead code in cone bounding computation
- Replace sqrt/log with more efficient computations in hyperbola bounds
- General code cleanup and modernization
2025-11-27 09:22:44 +00:00
Pasukhin Dmitry
396b677095 Testing - Migrate QA DRAW tests to GTest (#823)
- Deletion of 20 legacy DRAW test files (.tcl format) from tests/bugs/ directories
- Addition of 15 new GTest C++ test files across multiple modules
- Removal of corresponding QA command implementations from TKQADraw
2025-11-13 09:28:07 +00:00
luzpaz
ed1d0c88cc Documentation - Fix whitespaces and typos (#819)
- Fixed inconsistent whitespace and line breaks in comments
- Corrected spelling errors ("witch" → "which", "sprcified" → "specified", "nul" → "null", etc.)
- Improved formatting consistency in documentation comments
2025-11-12 18:06:11 +00:00
Pasukhin Dmitry
d166ff70e7 Testing - Migrate QA DRAW tests to GTest (#818)
- Removed 37 DRAW test scripts from `tests/bugs/` directories
- Added 31 new GTest C++ test files in appropriate `GTests/` directories
- Removed corresponding QAcommands implementations from QABugs source files
- Updated CMake FILES.cmake files to include new test files
2025-11-10 21:17:50 +00:00
Pasukhin Dmitry
27e61c089c Foundation Classes - ElSLib, ElCLib Angle normalization refactor (#813)
- Introduced a centralized `normalizeAngle()` function in both ElSLib.cxx and ElCLib.cxx with special handling for values near zero and the 2π seam
- Replaced multiple instances of inline angle normalization code with calls to the new function
- Migrated the OCC24945 bug test from Draw Harness to GTest framework
- Updated expected test values to reflect the improved normalization behavior
2025-11-09 14:13:24 +00:00
luzpaz
7ef4b0f2a6 Documentation - Fix whitespaces (#809)
- Corrected spelling errors in comments (e.g., "od" to "of", "thr" to "the")
- Removed unnecessary `<br>` HTML tags from comment formatting
- Normalized whitespace in comments for consistency
- Fixed terminology (e.g., "3-d" to "3D")
2025-11-08 14:11:10 +00:00
Pasukhin Dmitry
2cc2bfdd27 Foundation Classes, gp - Add constexpr/noexcept constructors and standard direction enums (#803)
- Addition of `gp_Dir::D` and `gp_Dir2d::D` enums for standard directions (X, Y, Z, NX, NY, NZ)
- Constexpr/noexcept constructors for geometric primitives (circles, cones, cylinders, etc.)
- Enhanced axis placement classes with enum-based constructors
- Replacement of hardcoded direction values throughout the codebase
2025-11-04 16:21:59 +00:00
ikochetkova
c640cafb8b Data Exchange, Step Import - Add import of coordinate system connection points for dimensions (#779)
Add possibility to retrieve and save the whole coordinate system as a connection point for dimensions.
Refactor reading of connection points from STEP.
Refactor Set and Get methods of Dimension XCAF object.
Add new exporting data to the test method XDumpDGTs and update the test cases respectively.
2025-10-31 10:45:32 +00:00
Pasukhin Dmitry
8da5219913 Shape Healing - Regression after #584 (#769)
Second iteration of fixing regressions.
Fixed issue with loops and incorrect shell created.
#584 affected some tests which were not updated on time.
Now all test cases are passed.
2025-10-27 21:27:16 +00:00
Pasukhin Dmitry
1c0bb24479 Shape Healing - Regression after #584 (#753)
Fixed issue with unstable shape order after fixing.
Fixed reference data which was changed
2025-10-21 11:14:33 +01:00
Dmitrii Kulikov
de1fcc2018 Mesh - Import of STEP file crashes at the very end when visualizing the boundary curves (#745)
When an edge (BRepMeshData_Edge) has multiple PCurve curves (IMeshData_PCurve) with different orientations, the index array is filled for only one PCurve curve.
This would cause problems later, so a fix was made to fill index arrays for curves with another orientation.
2025-10-16 18:46:10 +01:00
Pasukhin Dmitry
515e112564 Testing - Migrate QA NCollection to GTests (#709)
- Complete removal of old Draw Harness test infrastructure for NCollection classes
- Addition of new GTest files testing STL algorithm compatibility (min, max, replace, sort, reverse)
- Migration of OSD_Path and Handle operation tests to GTest format
2025-09-08 15:59:34 +01:00
Pasukhin Dmitry
86caa2d513 Testing - Add unit tests for Standard_ArrayStreamBuffer (#708)
- Replaces legacy DRAW command-based tests with modern GTest framework
- Removes the `OCC28887` DRAW command and associated test files
- Adds comprehensive unit test coverage for `Standard_ArrayStreamBuffer` functionality
2025-09-08 09:50:35 +01:00
ikochetkova
0d30b42cb1 Shape Healing, STP Import - Revolved shape in STEP file is imported inverted (#699)
Make the degenerated torus bounded in two values of parameters processed as a regular to insert a seam edge properly.
2025-09-04 17:05:44 +01:00
Petras Vestartas
91000c49c5 Data Exchange, STEP Export - General Attributes (#634)
- Adds metadata writing capability through new `MetadataMode` flag and `writeMetadata` method
- Exports string metadata as STEP `property_definition` entities linked to product definitions
- Integrates metadata writing into the main transfer workflow alongside existing property writing
2025-08-12 09:29:47 +01:00
Sander Adamson
599869329c Modeling - Fix null surface crash in fixshape (#623)
- Added null surface validation in ShapeAnalysis_Surface constructor and Init method
- Added null surface checks throughout ShapeFix_Face methods to prevent crashes
- Enhanced robustness by validating surface availability before performing surface-dependent operations
2025-08-01 18:10:21 +01:00
Sander Adamson
65742e7375 Modeling - Fix null surface crash in UnifySameDomain (#624)
- Added null safety checks in the ClearRts function and IntUnifyFaces method
- Refactored ClearRts to use a more concise implementation with null handling
- Added a test case to verify the fix works with tessellated geometry
2025-08-01 09:47:28 +01:00
Pasukhin Dmitry
9f761b12ec Modeling - Implement new Helix Toolkit (#648)
- Adds a complete TKHelix toolkit with geometric helix curve adaptor and topological builders
- Implements advanced B-spline approximation algorithms for high-quality helix representation
- Provides comprehensive TCL command interface for interactive helix creation and testing
2025-07-28 12:51:16 +01:00
Kirill Gavrilov
468bcd0c27 Data Exchange, RWObj_Reader - Facets with empty normals like 'f 1// 2// 3//' (#520)
Removing an obsolete header comment in the PPM writer
Correcting the handling of facet indices when normals or texture coordinates are empty in the OBJ reader.
- In Image_AlienPixMap.cxx, the unused header comment is removed.
- In Graphic3d_Aspects.hxx, the default viewer settings comment is updated.
- In RWObj_Reader.cxx, additional checks are added
    to correctly parse OBJ face definitions with empty texture and normal indices.
2025-07-16 15:24:48 +01:00
Dmitrii Kulikov
413c08272b Data Exchange, STP Import - Fixing missing GDT values (#617)
- Changes type declarations from specific measure types to `Handle(Standard_Transient)` for broader compatibility
- Adds runtime type checking and conversion logic to extract measure values from both supported types
- Includes comprehensive unit tests to validate the new functionality
2025-07-15 11:09:36 +01:00
Pasukhin Dmitry
29616ca8ff Testing - Draw testing clear up (#595)
- Deleted slow V3D and performance tests under `tests/v3d` and `tests/perf`.
- Updated `de_before_script` in DE/IGES tests to set `new_resource_path` to a subfolder per file.
- Added cleanup logic in `de_after_script` to delete the temporary resource directories.
2025-07-06 22:44:42 +01:00