Compare commits

...
131 Commits
Author SHA1 Message Date
Clifford Yapp bc130e1e7a Merge branch 'RELEASE' 2026-10-12 10:39:22 -04:00
Clifford Yapp de83ba5d30 Bump to dev revision after tagging 7.46.0. We already have enough changes pending for another minor - if 7.46 needs a patch release it will come from the rel-7-46 branch. 2026-10-12 10:37:59 -04:00
Clifford Yapp 31470287a1 Update ChangeLog, set release date 2026-10-12 10:28:55 -04:00
Clifford Yapp dc3b4abaa1 Improve distcheck bext path handling 2026-10-10 20:17:12 -04:00
Clifford Yapp 3f1eb8f584 Update bext logic to make URL modular 2026-10-10 20:17:06 -04:00
Clifford Yapp 561b3c3aab move extern definition 2026-10-10 20:16:56 -04:00
Clifford Yapp d03b9838a1 no-tk and goto adjustments for FreeBSD building 2026-10-10 20:16:50 -04:00
Clifford Yapp 48cd318a6d Make github.com bext sha1 query non-interactive
This is an optional check, so we never want it to go interactive if
anything is weird with upstream.

`credential.helper=` prevents credential-manager/browser prompts,
`credential.interactive=false` disables Git credential interaction, and
the `GIT_TERMINAL_PROMPT=0` environment variable blocks terminal
prompting and helps with older Git versions
2026-10-10 20:16:44 -04:00
Clifford Yapp 1f0193dbaf Isolate GCV regression outputs
Give each GCV regression target a distinct output path so parallel
tests cannot remove one another's results. Validate and clean every
input immediately, and update companion-file cleanup paths.
2026-10-10 20:16:33 -04:00
Clifford Yapp 2e7e827ba0 Fix conditional datetime conversion constant
Derive nanoseconds per microsecond from the existing unit constants.

This avoids an unused file-scope constant in clock_gettime builds.
2026-10-10 20:16:17 -04:00
Clifford Yapp 342d8a9152 Improve distcheck bext path handling 2026-10-10 20:03:02 -04:00
Clifford Yapp 9e030edd60 Update bext logic to make URL modular 2026-10-10 11:39:21 -04:00
Clifford Yapp b5bf1683a2 move extern definition 2026-10-08 16:34:31 -04:00
Clifford Yapp eb7e9cb38c no-tk and goto adjustments for FreeBSD building 2026-10-08 16:31:46 -04:00
Clifford Yapp 84be85a74d Make github.com bext sha1 query non-interactive
This is an optional check, so we never want it to go interactive if
anything is weird with upstream.

`credential.helper=` prevents credential-manager/browser prompts,
`credential.interactive=false` disables Git credential interaction, and
the `GIT_TERMINAL_PROMPT=0` environment variable blocks terminal
prompting and helps with older Git versions
2026-10-07 11:05:52 -04:00
Clifford Yapp 3fd9ec8f4b Isolate GCV regression outputs
Give each GCV regression target a distinct output path so parallel
tests cannot remove one another's results. Validate and clean every
input immediately, and update companion-file cleanup paths.
2026-10-06 18:21:05 +00:00
Clifford Yapp 7d2392d754 Fix conditional datetime conversion constant
Derive nanoseconds per microsecond from the existing unit constants.

This avoids an unused file-scope constant in clock_gettime builds.
2026-10-06 18:20:41 +00:00
Christopher Sean Morrison e7c61497df new doc on representations 2026-10-06 10:51:33 -04:00
Christopher Sean Morrison 08da151a6e add new documentation explaining the differences between geometry representation schemes with examples 2026-10-06 10:50:13 -04:00
Clifford Yapp 757bb76203 Update log with commits being incorporated into rel-7-46-0 2026-10-06 01:47:38 -04:00
Clifford Yapp c70bab52c4 Update version numbers 2026-10-06 01:45:41 -04:00
Clifford Yapp 7929a747ad Fix Archer saving window sizes before they're ready 2026-10-06 01:42:31 -04:00
Clifford Yapp eac0f4d265 Adjustments for Archer/Itcl 2026-10-06 00:57:13 -04:00
Clifford Yapp d6ae424de0 Correct Archer plugin setup 2026-10-06 00:47:05 -04:00
Clifford Yapp 27ba3c4880 Be more aggressive about making sure the install rpath setup is our standard one. 2026-10-05 21:29:34 +00:00
Clifford Yapp 7ade8db130 Got the test backwards 2026-10-05 15:30:29 -04:00
Clifford Yapp e91023f354 Disable rtcmp tests for a BRLCAD_ENABLE_RUNTIME_DEBUG=OFF build
rtcmp logging in librt is in the hot loop for rt_shootray, so
even the enabled/disabled conditional check imposes about 1.5%
performance overhead in an optimized build configuration.  Since
that isn't acceptable when we're disabling debugging support for
maximum performance, disable the tests in that particular case.
2026-10-05 13:50:34 -04:00
Clifford Yapp 303b90f7f1 librt: handle empty and instanced trees during bounds traversal
rt_gettree can succeed for an empty combination with no primitives,
leaving its imported tree null.  The old traversal reached
RT_CK_TREE.  With runtime checks enabled, that bombs and facetize's
setjmp catches it.  Builds with runtime checks disabled compile out
the magic check and dereference null instead.  This explains the
different outcomes across build configurations.

Return an error for null or NOP trees at every recursion level, so
nested empty combinations also fail without a bomb.  Carry each
member's accumulated transform when selecting a prepared solid;
matching only the name chose the wrong instance when one primitive
appeared at multiple locations.  Release imported combinations
after recursion, use a stack tree for direct primitives, and return
lookup errors instead of exiting the process.

Cover empty and nested combinations, direct primitives, repeated
transformed instances, and transforms through nested combinations.
2026-10-05 16:45:33 +00:00
Clifford Yapp 875091f78a Check for null tree before doing rt_traverse_tree 2026-10-05 11:49:40 -04:00
Christopher Sean Morrison 0716e4c842 Revert "add a test to get regions"
This reverts commit d3e037a760.
2026-10-05 10:22:25 -04:00
Christopher Sean Morrison ee6e1bebdc write up a preamble for 7.46 2026-10-05 03:31:45 -04:00
Christopher Sean Morrison 9d4f5bb124 consolidate the list a little bit combining related changes and being a little more user-vis critical 2026-10-05 03:21:22 -04:00
Christopher Sean Morrison 21f442a4ad upper on cmd names outside summaries is jarring and inconsistent 2026-10-05 02:11:21 -04:00
Christopher Sean Morrison 24d6f6f4cb add data dir to the doc search paths also 2026-10-05 01:44:15 -04:00
Christopher Sean Morrison d3e037a760 add a test to get regions 2026-10-05 01:27:54 -04:00
Christopher Sean Morrison 5a38423677 release prep for 7.46.0 2026-10-04 23:34:49 -04:00
Christopher Sean Morrison 38113b1de7 nearly ready 2026-10-04 23:34:12 -04:00
Clifford Yapp fec9d07d43 See if we can update CI to macos-15 2026-10-04 15:32:50 -04:00
Clifford Yapp 4b09d6227f Try to shorten some of the NEWS lines 2026-10-02 19:22:07 -04:00
Clifford Yapp eab1e82de2 Update NEWS for post-7.44 user-visible changes
Add missing user-visible release notes from the 7.44-to-7.46
development range.  Remove Itcl 4-only migration fixes, narrow the
MGED editing claim to the ARB5 bug present in 7.44, and correct the
historical PNTS attribution.

Added item to source commit mapping:

- shared OpenGL display-list state: 85de3929e5
- MGED fallback manual viewer: 0a8c6d8bc2, a00efd15c6
- GIST subprocess diagnostics: 0d6cc34a13, 06c8ab6204
- GQA density validation and exit status: 6d142b62e7, cd55562c46
- ARBN inside support: 7b1898d9fd
- HYP edit label: e4d297893e
- MGED BoT face selection: 0173dd8c40
- MGED view-mode panning and edit queries: 5e873e5081
- MGED middle-click rotation behavior: 3beed70eb8
- transactional rejected primitive edits: 13b0699349, 58ab0d5496
- MGED startup prompt focus: 03b36c1b61
- Windows binary temporary files: 7358e90b54
- DSP, PNTS, and BoT ray intersections:
  8f81f27d92, 5c8092b4e6, de09372b73
- submodel transforms: c45fb38aea, 5c6563e2e2
- VOL data lookup and prep handling:
  641a1fea5e, 259e20ac56, e2cdfa3a6a
- MGED NIRT output and subprocess cleanup: 0d6cc34a13
- Windows subprocess argument preservation: bcaebb24e1
- Windows drive-letter paths: d4b902c599, c523397c03
- MGED gqa and rtcheck overlap plots: 75ef43ac37
- procedural tree use-after-free: fa687de934
- gaia Earth generator and textures:
  2f5be2c414, 9e10743773, fee67ac743
- redirected Windows fbcolor input: 01c4a39932
- bwstat median and input errors: 2307575ef1
- NIRT trailing whitespace: b5e03710eb, 730b448973
- GIST hierarchy overflow rendering: 58b3c9c9c0
- MGED gqa option parsing: da430b14d8
- rtxray grayscale output: 4608347774, f9055f240e
- submodel empty-file ASCII conversion: c0059383e0
- PNTS get/adjust/form and ASCII conversion: 71cbe6ed71
- annotation get/adjust and ASCII conversion: 604be9f454

Corrections to existing items:

- remove Itcl 4-only application-fix claims: e78d0530f3
- retain the baseline ARB5 fix but drop pipe and sketch claims:
  df19156341, 6c092182a6, be97d86e4e
- move PNTS conversion support from 7.44 to 7.46: 71cbe6ed71

Reorder the existing facetize and pnts export entries to retain the
newest-first organization of the release section.
2026-10-02 19:10:21 -04:00
Clifford Yapp f7a8d5b406 Fix Edit->Reset menu entry - uses reinit_edit_state() 2026-10-02 13:42:36 -04:00
Clifford Yapp 85de3929e5 Make sure zbuffer and lighting are set up when using share_dlist 2026-10-02 13:09:25 -04:00
Clifford Yapp 0a8c6d8bc2 Update Manual viewer in MGED to use tkhtml3 2026-10-01 15:43:07 -04:00
Clifford Yapp a00efd15c6 Fixes for man page viewer 2026-10-01 15:43:07 -04:00
f4alt 06c8ab6204 more uniform exiting
consolidate the call sites where we end up in bu_exit due to a failure.
Have a simple wrapper so we flush any results buffers that may be useful
for error context, and then call the bu_exit.
2026-10-01 14:34:31 -04:00
f4alt cd55562c46 bubble gqa return code 2026-10-01 14:34:31 -04:00
f4alt 6d142b62e7 validate material IDs are present in density table
previously, positive but not defined in the table values would silently
corrupt the calculation with a -1.0 for the density value and no
warning.
2026-10-01 14:34:31 -04:00
f4alt da2f503367 handle cache compression failures safely
ensure we can compress with bounds checks. If we got something failing
or unsupported, log and return instead of BU_ASSERT (bombing). This
allows the caller to appropriately free the external.
2026-10-01 14:34:31 -04:00
f4alt a9ac66788a guard logging behind debug flag 2026-10-01 14:34:31 -04:00
Clifford Yapp 4cc9f9cf01 Be more nuanced about what ARB edit ops we can support. 2026-10-01 12:10:33 -04:00
Clifford Yapp 7b1898d9fd Add ARBN inside logic. 2026-10-01 12:06:29 -04:00
Clifford Yapp e4d297893e label hyp neck-to-base ratio 2026-10-01 12:00:03 -04:00
Clifford Yapp 0173dd8c40 Correct bot face selection logic 2026-10-01 11:55:30 -04:00
Clifford Yapp cf344d773e Print result in mged (just assigning to interp isn't enough) 2026-10-01 11:14:39 -04:00
Clifford Yapp 8c51c1d527 Mention facetize improvements in NEWS 2026-10-01 08:55:26 -04:00
Clifford Yapp 6e48ea9ddd Center README toplevel text 2026-09-30 06:44:36 -04:00
Clifford Yapp 488f538040 Update bext SHA1 to latest 2026-09-28 08:46:34 -04:00
Clifford Yapp 17cc9f3a5a List file for distcheck 2026-09-25 17:31:09 -04:00
Clifford Yapp bf2c508826 List cases.inc for distclean 2026-09-25 15:55:30 -04:00
Clifford Yapp f2e68b1a2a Initialize 2026-09-25 15:42:29 -04:00
Clifford Yapp 5e873e5081 Fix MGED live view panning and solid edit lookup
View-mode mouse panning now honors view coordinates even when MGED is
set to object coordinates. Correct the solid-edit lookup so live
geometry queries work during dragging.

Exercise numeric live and saved geometry for primitive, combination,
ARB, pipe, BoT, BREP, ARBN, and raster edits. Cover menu selection,
mode switching, repeated mouse edits, and BoT triangle picking under
Xmin.
2026-09-25 14:17:01 -04:00
Clifford Yapp 3beed70eb8 Fix MGED mouse edit modes and interactive feedback
Middle-click rotation and some Edit menu choices could move the view
or leave solid editing in a stale mode. Keep edit flags and modes
aligned so mouse actions change geometry, including snapped drags.

Defer button release while a pick is running to avoid a background
command-busy error. Extend MGED and Xmin regressions to verify
primitive mouse edits, live redraw, menu modes, and picking.
2026-09-25 17:00:00 +00:00
Clifford Yapp 73258d4264 Fix MGED interactive edit redraw and mouse routing
Object-edit transforms now update cached display matrices and mark
views dirty, so geometry moves visibly without a manual refresh.
Synchronize transient solid-edit flags with librt edit mode so mouse
and rate controls manipulate the solid instead of the view.

Add an Xmin mouse regression covering object and solid pan/spin,
direct transforms, redraws, and unchanged view state.
2026-09-25 17:00:00 +00:00
Clifford Yapp 8ae7482918 Gate librt rtcmp capture with runtime toggle 2026-09-25 12:25:44 -04:00
Clifford Yapp 917ce5554c Preserve primitive edits across failed saves and restores
A failed checkpoint could discard the last saved state, and a
failed revert could discard the current primitive. Restoring
selected pipe or NMG geometry could also leave stale handles.

Stage exports and imports before replacing live state, clear
selections and refresh the keypoint after restore, and preserve
SPH and REC types. Consume rejected edit input so a later command
cannot reuse it, and prevent view-update counts from accumulating.

Cover failed saves and restores, repeated revert, selected geometry,
and default and non-default database units.
2026-09-24 14:52:59 -04:00
Clifford Yapp 58ab0d5496 Prevent rejected primitive edits from changing geometry
Rejected height moves in TGC, CLINE, and EXTRUDE could replace
valid geometry; NMG edge moves could partly change faces while
reporting success. BOT edge splits could leave unused vertices, and
malformed parameter text could partly overwrite seven primitives.

Stage edits before applying them. Reject invalid REC and uniform
scale inputs without changing geometry, and report scale failures.
Cover these paths in default and non-default units, including CRLF
parameter text and NMG selection remapping.
2026-09-24 14:52:59 -04:00
Clifford Yapp 13b0699349 Prevent rejected ARB edits from corrupting geometry
Mouse face drags and several ARB edit helpers could change points or
planes before detecting invalid geometry. Subsequent edits then began
from inconsistent state and could produce unexpected shape changes.

Validate candidate geometry before committing it, restore state on
rejected edits, and cover repeated mouse drags with non-default units.
2026-09-24 14:52:59 -04:00
Clifford Yapp acd3a9800d Use bu_vls for capture records 2026-09-24 18:51:55 +00:00
Clifford Yapp 03b36c1b61 Restore MGED command prompt focus on GUI startup 2026-09-24 18:48:57 +00:00
Clifford Yapp b714d88185 See if we can optionally also write out pre-boolweave segment data for comparison. 2026-09-24 17:45:40 +00:00
Clifford Yapp eff3fea479 Add LIBRT level rtcmp debug printing option 2026-09-24 16:25:34 +00:00
Clifford Yapp 7358e90b54 Keep temporary files binary on Windows
Set binary mode on the temporary file descriptor before wrapping it
in a stream. This prevents newline translation from enlarging DSP
sample files, which otherwise makes DSP edits and raster operation
tests fail on Windows.

Add a byte-for-byte temporary-file regression test covering newline
and DOS EOF bytes.
2026-09-24 14:30:55 +00:00
Clifford Yapp 3c2b0de9d2 Fix unit-sensitive primitive edits and invalid edit reporting
Keep numeric edit values in database-local units while applying
geometry changes in base units. Correct parameter readers and edit
paths that could misplace solids or silently accept invalid changes,
including ARB, ARBN, BOT, pipe, sketch, metaball, and NMG.

Add mm/in operation matrices with exact-result checks across
primitive edits, parameter parsing, and repair paths.
2026-09-24 11:08:20 +00:00
Clifford Yapp a384f838fb Reject invalid BREP control-vertex edits and verify units
Propagate selection and CV edit errors through librt so callers do not
report rejected edits as successful. Validate indices and coordinates
before changing geometry, and mark selection indices as unitless.

Exercise persisted CV moves and sets in an inch-unit GED database,
and verify rejected commands leave stored geometry unchanged.
2026-09-24 02:03:12 +00:00
Clifford Yapp 1053594e9a Fix cursor state and BREP control-vertex mouse edits
Preserve cursor-relative translation knobs for ARB, BOT, CLINE,
extrusion, NMG, and TGC mouse edits, including in non-mm
databases. Prevent BREP control-vertex drags from moving the
whole solid. Report invalid ARB edit indices and geometry
failures to callers.

Add mouse and error-path regressions for the affected primitives.
2026-09-24 01:36:28 +00:00
Clifford Yapp 72cde263cc Fix ARB face rotation errors and endpoint drag state
ARB face rotation changed geometry but reported failure, causing GED
to reject the edit. Return success and let the shared edit path replot.

CLINE and extrusion mouse endpoint drags also reset translation
knob state. Keep endpoint moves separate from translation handling
and cover these workflows in primitive and GED edit tests.
2026-09-24 01:00:50 +00:00
Clifford Yapp b670a19aba Preserve local-unit inputs during primitive editing
Repeated edits in non-mm databases could compound unit conversions,
moving points and faces or resizing primitives unexpectedly. Mouse
coordinates could also be converted a second time.

Convert numeric values into temporary base-unit targets in librt
without rewriting the supplied parameters. Cover translation,
dimension changes, vertex and face moves, picks, and NMG extrusion
with non-mm and repeated-input tests.
2026-09-24 00:37:03 +00:00
Clifford Yapp 2d9fa5c033 Fix non-mm primitive edits and invalid scale handling
Numeric scale lengths now convert once in librt, so edits in
non-mm databases produce the requested geometry and repeated
inputs do not compound conversions. Cover torus, ellipsoid,
superellipsoid, particle, RPC, RHC, ETO, and TGC scaling,
plus TGC endpoint moves.

Reject impossible torus, ETO, and coupled TGC edits without
changing the solid. Add inch-unit, repeat-input, and rejection
coverage in librt and libged.
2026-09-23 23:59:19 +00:00
Clifford Yapp 8be0f0ae85 Fix EPA/EHY length edits and lock in ARB edit behavior
EPA and EHY length edits now convert local units without changing the
input, so repeating an edit cannot apply the conversion again. Invalid
semiaxis requests now fail visibly and leave the primitive unchanged;
empty parameter edits remain no-ops.

Add inch-unit MGED extrusion checks for both direct and interactive
editing, exercise ARB geometry helpers, and run multiline MGED tests
as sourced scripts so failures cannot be skipped.
2026-09-23 23:04:29 +00:00
Clifford Yapp 00ffa4bd80 Fix VOL edits with non-default database units
Convert voxel cell sizes to base units without modifying input
parameters, so repeated edits use the requested size. Keep file
sizes and density thresholds unitless, validate invalid dimensions,
and prevent threshold underflow and file-size overflow.

Cover direct librt edits and persisted GED edits in inch databases.
2026-09-23 22:27:58 +00:00
Clifford Yapp e5e0905d03 Fix pipe editing units, zero dimensions, and failures
Pipe point coordinates and dimensions entered in non-mm databases were
not consistently converted to base units. Some commands reconverted
their input on repeat, while invalid point operations could report
success without changing the pipe.

Convert numeric input once in librt, preserve base-unit mouse points,
and propagate operation failures. Reuse shared pipe point helpers and
allow all-zero pipe dimensions to receive an absolute value. Add
direct and GED tests for inch units, repeated edits, failures, and
database persistence.
2026-09-23 21:55:41 +00:00
Clifford Yapp 10d13793b0 Fix revolve sketch edits, error reporting, and ownership
Changing a revolve's sketch now loads the new geometry and rejects
missing or non-sketch references without persisting a broken object.
Invalid numeric edits report errors instead of appearing to succeed.

Transforms retain the start vector, angle, and sketch. Imported and
prepared objects own independent sketches and names, avoiding stale
geometry, leaks, and dangling references.

Cover inch-database edits, sketch replacement, transform ownership,
and prep/free lifecycles in edit tests.
2026-09-23 21:26:37 +00:00
Clifford Yapp 70d5180438 Fix sketch and extrusion edits and report invalid operations
Honor indexed sketch descriptor inputs and convert vertex and radius
lengths in non-mm databases. Replace extrusion sketch references only
after the new sketch is validated, so failed selections leave the
existing extrusion intact.

Return descriptor edit failures to GED instead of reporting success.
Remove two unimplemented TGC moves from advertised operations and
strengthen persisted sketch, extrusion, HRT, and pipe tests.
2026-09-23 20:55:57 +00:00
Clifford Yapp 50fe626694 Fix NMG edge deletion and strengthen edit operation checks
Deleting an NMG edge could also split another edge when stale edit
parameters were present. Stop after deletion and release temporary
extrusion loops on mode changes and reset.

Exercise NMG selection, traversal, edge edits, and extrusion using
non-mm input. Check that DSP file selection and sample counts are
independent of length units, sharing the filename test callback.
2026-09-23 20:11:14 +00:00
Clifford Yapp ca403c92ed Correct native primitive edits and broaden result coverage
Keep combination edit sessions valid after database writes, move BOT
plate thickness edits into librt, and repair ARS topology changes.
Correct unit-sensitive edits, malformed-input handling, and NMG
imports on unaligned data so geometry edits remain reliable.

Add primitive-operation inventory, outcome and inch-unit tests, and
bounded edit-sequence coverage. Use portable temporary data files
so DSP and EBM tests no longer require /tmp.
2026-09-23 19:49:07 +00:00
Clifford Yapp bab959474f Add Clang version of coverage tracking compilation flags 2026-09-23 19:49:07 +00:00
Clifford Yapp 27b522c155 Updates for OpenCV v5 2026-09-23 16:50:52 +00:00
Clifford Yapp 875231c335 Consolidate librt primitive edit tests into one executable
Run all 34 edit cases through a selectable rt_edit_test binary.
Register each case independently with CTest so failures remain
isolated and previously unregistered tests run routinely.
2026-09-23 16:01:04 +00:00
Clifford Yapp 89810b06ca Correct non-mm primitive edits and expand regression coverage
Keep MGED and gsh edits consistent in non-mm databases by fixing
length and dimensionless parameter handling in librt and libbrep.
Correct DSP absolute cell sizing and inverse transforms, preserve
rational BREP control-vertex weights, and retain NMG session units.

Add non-mm tests for affected primitives and update stale ARB8
descriptor and HRT translation assertions.
2026-09-23 16:01:04 +00:00
Clifford Yapp 90e512b5d6 Fix non-mm units across primitive edit commands
MGED tra moved primitives too far by passing a base-unit target
to handlers expecting local units. The libged edit commands used
by GSH mixed local numeric positions with base-unit keypoints.
This affected tra, absolute and relative translate, and rotation
and scale centers in non-mm databases.

Convert translation targets at the librt edit boundary and parse
numeric positions in base units. Keep scale reference factors
dimensionless and add inch-database regression coverage.
2026-09-23 16:01:04 +00:00
Clifford Yapp 19fe382208 Revert "Add opt-in forward parity shots for solid BoTs"
This was just an experiment - remove.

This reverts commit 90e5ede2b3.
2026-09-23 10:00:05 -04:00
Clifford Yapp 994c56b05f typo, ws 2026-09-23 09:34:21 -04:00
Christopher Sean Morrison db76164ea8 update docs with restored behavior and comparison with bwdiff 2026-09-23 07:36:04 -04:00
Christopher Sean Morrison 58c5ed3681 pixscale and bwscale improved 2026-09-23 07:35:28 -04:00
Christopher Sean Morrison 05bd5c7470 restored pixdiff 2026-09-23 07:34:02 -04:00
Christopher Sean Morrison 2276f4ef8c replaces seek-based scanline loading with a forward rolling buffer so large piped inputs behave like regular files. 2026-09-23 07:32:55 -04:00
Christopher Sean Morrison 188e72eb32 maps the first and last output pixels exactly onto source edges and clamps interpolation neighbors so enlargements retain every corner 2026-09-23 07:32:55 -04:00
Christopher Sean Morrison 03306043ea scaling test 2026-09-23 07:32:55 -04:00
Christopher Sean Morrison 28038fe0ea isolated pixdiff pix test 2026-09-23 07:32:55 -04:00
Christopher Sean Morrison 5b5cb8c538 now bw mode need -b option 2026-09-23 07:32:55 -04:00
Christopher Sean Morrison 1c20d18156 restore previous pixdiff behavior where we apply an ntsc-grayscaling damper on same pixels so differences are accentuated with color 2026-09-23 07:32:55 -04:00
Clifford Yapp 97920fbc90 license info 2026-09-21 22:07:58 -04:00
Clifford Yapp 37fb7d928a Not flipping these to const yet. 2026-09-21 22:06:05 -04:00
Clifford Yapp 2056b359bd Use EQUAL/ZERO 2026-09-21 22:05:39 -04:00
Clifford Yapp b4cf00292a ged_cmd_valid is deprecated, so don't need a test for it. 2026-09-21 20:08:03 -04:00
Clifford Yapp 6748dd37ab libged: restore ged_cmd_valid compatibility wrapper
The 2024 command API migration replaced its implementation with
ged_cmd_exists and ged_cmd_same, but retained the deprecated exported
ged_cmd_valid declaration.  This left source callers compiling against a
symbol that libged did not provide.

Restore the wrapper with its established status mapping and add regression
coverage for valid, alias, mismatch, invalid, and NULL command inputs.
2026-09-21 20:06:52 -04:00
Clifford Yapp ef35c1dca1 fix bu_scan_fastf_t delimiter parsing
Replace dynamically constructed scanf formats with direct numeric and
delimiter parsing.  The old implementation accepted only one literal
delimiter sequence, mishandled percent delimiters, and used an
uninitialized length when scans failed.

Define empty delimiter strings as invalid, reset optional consumed-count
outputs for invalid configurations, and document the delimiter and
destination-pointer contract.  Add regression coverage for repeated,
mixed, and percent delimiters, deterministic prefix counts, null
destinations, and invalid configurations.
2026-09-21 20:06:30 -04:00
Clifford Yapp 8cdedd8752 libbn: correct polynomial edge cases
Correct descending-order polynomial API documentation and make basic
arithmetic helpers safe when their output aliases an input.  Preserve
the output when multiplication exceeds the fixed degree limit.

Handle constant and higher-degree divisors without unsigned degree
underflow.  Normalize small nonzero leading coefficients before the
direct quadratic, cubic, and quartic solvers.

Repair the unreferenced bivariate polynomial implementation: expose its
API, add release support, preserve both dimensions while growing, and
correct its addition and convolution.  Add focused regressions for all
corrected cases.
2026-09-21 18:40:54 -04:00
Clifford Yapp e4ba0b166c libbn: correct matrix and quaternion edge cases
Use bn_tol's angular predicate in bn_mat_fromto instead of the
duplicated line-segment ratio test, which compared dimensionless
slopes against a distance tolerance.  Normalize inputs and return an
identity matrix when either cannot be normalized.

Make bn_mat_lookat support non-unit and Z-axis directions.  Correct
bn_wrt_point_direc's translation-back sign and replace its shared
scratch storage with local temporaries.

Define quaternion behavior for antipodal bisection and identity
logarithms.  Document related angle and input contracts, and add
regressions for the corrected cases.
2026-09-21 18:28:12 -04:00
Clifford Yapp 586ac06c7e libbg: correct geometry query contracts
Normalize point/normal planes without mutating caller input, and
correct coordinate frames for non-unit plane equations.

Support rank-deficient PCA input, correct 3D polygon centroids and
CCW ordering, honor polygon holes in view bounds, and gather every
mesh diagnostic while preserving the no-diagnostics fast path.

Fix Creo's inverted solidity result, make segment clipping reentrant,
and clarify geometry API contracts.  Add focused plane, PCA, polygon,
and trimesh regressions.
2026-09-21 18:17:12 -04:00
Clifford Yapp 0d745fca35 Use bu_vls for VFONT paths
The VFONT loader used a 128-byte buffer when constructing the bundled
font path. Odd-pathname distcheck directories exceeded that limit in CI
environments, causing fblabel to reject the default font and all
dependent rtwizard tests to fail. Use a bu_vls path so the installed
font can be opened regardless of build prefix length, and release it on
all loader exits.
2026-09-18 16:39:52 -04:00
Clifford Yapp 5270e67abe List files for distcheck 2026-09-18 15:47:02 -04:00
Clifford Yapp 14051845a3 facetize: add source-guided adaptive SPSR
Fixed-size point dumps make Poisson reconstruction unreliable as a
last-resort facetization method.  They can miss thin partitions while
oversampling surfaces that are already well resolved, and an arbitrary
point count does not show whether source characterization is complete.

Seed reconstruction with stabilized Crofton samples.  Retain paired
entry and exit normals, partition thickness, and ray identities so thin
geometry contributes explicit local information instead of unrelated
points.

Add a bounded adaptive libbg driver around the existing upstream
Poisson solver.  Each solve reports residual, density, normal, and
surface-variation hints to a caller callback.  Facetize responds with
exact source rays and validates partitions, endpoints, chord length,
area, volume, and closed-manifold topology before accepting a result.

Bound refinement by time, point, pass, and convergence limits.  Relax
only chord and thin-partition thresholds when the source BoT is already
known to be non-manifold.  Deprecate the fixed-array API, remove the
intermediate point-sampling path, adapt pnts callers, and add focused
coverage.  The vendored SPSR implementation remains unchanged.

Use configured method priority for perturbation variants so an MDC-only
run never invokes NMG.  Report finalization progress and retry counts
while the fallback hierarchy is evaluated.
2026-09-18 16:14:16 +00:00
Clifford Yapp d6fa937212 libanalyze: replace marching cubes with adaptive MDC
The legacy marching-cubes polygonizer sampled a uniform grid and could
miss thin or high-aspect features, merge undersampled tunnels, and emit
surfaces whose shared-edge winding was inconsistent.  Increasing the
global resolution made those failures prohibitively expensive rather
than addressing their local causes.

Add a ray-driven manifold dual contouring API built on an adaptive
octree.  Cache exact signs and Hermite edge crossings from librt
partitions, place feature-preserving vertices with bounded QEF solves,
and refine locally for thin walls, multiple crossings, interior
surfaces, and ambiguous topology.  Build faces from shared crossings
with deterministic winding and require closed manifold output.

Back analyze_polygonize with the new implementation, expose MDC as a
facetize method, and remove the obsolete polygonizer code, licensing,
continuation sampler, and CM default.  Keep NMG available when polygon
preservation is more important and it can successfully process the
input.

Document the Ju, Schaefer, and Warren algorithmic basis and the
bottom-up Euler-characteristic escalation path.  Add coverage for thin
walls, tunnels, overlapping CSG, toroidal cases, winding, resource
limits, and the compatibility polygonalize entry point.
2026-09-18 16:14:16 +00:00
Clifford Yapp 37aee260c1 facetize: retire the legacy pipeline and harden region results
The compatibility implementation duplicated command behavior and
retained unreliable paths that had been superseded by the planned
worker pipeline.  Keeping both implementations made option handling and
failure behavior needlessly difficult to reason about.

Remove the old facetize sources and MGED registration so all command
modes use the maintained orchestrator.  Preserve implicitly selected
region roots in the output database and keep region retries scoped to
validated perturbation inputs.

Tighten source and result validation, reject empty preparation results,
and suppress expected import or preparation diagnostics only inside a
scoped log hook.  Keep routine details out of the terminal summary and
write complete detail logs when concise reporting is not possible.

Extend regression and validation coverage for implicit roots, tolerated
failures, and malformed or unsupported inputs.
2026-09-18 16:14:16 +00:00
Clifford Yapp 56d64428ae facetize: separate orchestration and isolate NMG evaluation
The command implementation mixed option handling, mode selection,
database setup, scheduling, and result publication.  NMG Boolean work
also ran in the parent process, allowing known NMG failures to terminate
the overall conversion.

Introduce an explicit planning and orchestration layer so each command
mode follows one visible execution path.  Replace positional worker
arguments with typed request and result messages that are validated
before they can alter the working database.

Move NMG Boolean evaluation into the supervised subprocess framework.
Transfer trees and BoTs through the existing transaction protocol,
report failures without killing the parent, and reject primitives that
do not provide the required tessellation callback.

Update facetize regression and worker-protocol coverage for the new
boundaries and failure semantics.
2026-09-18 16:14:16 +00:00
Clifford Yapp 0f6db7016d facetize: add supervised parallel primitive workers
Primitive tessellation previously paid process and database setup
costs per object and left the parent with limited visibility into work
that timed out or died.  Large models consequently spent substantial
time outside the tessellation algorithms themselves.

Add long-lived supervised workers and a bounded scheduler for
independent objects.  Divide CPUs between worker processes and each
worker internal parallelism, reuse opened databases, and retain cache
state across requests.

Make result publication transactional.  A WRITE_STARTED acknowledgment
closes the READY and PROCEED race, while the parent detects timeouts and
abnormal exits, restarts workers, and records only completed object
results.  Reuse temporary result databases without leaking state between
requests.

Add process and database-transfer helpers together with worker,
recovery, and validation tests.  Document the parallel job control and
its resource behavior.
2026-09-18 16:14:15 +00:00
Clifford Yapp cbffc1171b libbu: support resource-aware worker processes
Large subprocess pools need to divide machine resources without allowing
each worker internal parallelism to consume every CPU.  Add a
process-local limit to bu_avail_cpus() and bu_parallel(), with atomic
updates and coverage for applying and removing the limit.

Make BU_MEM_AVAIL count FreeBSD reclaimable inactive and cache queues
in addition to immediately free pages.  This prevents idle systems from
appearing memory-starved to resource-aware algorithms and adds native
sysctl checks for the reported values.

Rename the private process.h to process_private.h.  This prevents the
source header from shadowing the MSVC CRT header used by std::thread,
which otherwise leaves _beginthreadex undeclared.
2026-09-18 16:14:15 +00:00
Clifford Yapp 21e034ee34 Rename so we don't end up conflicting with an MSVC header 2026-09-18 16:13:27 +00:00
Clifford Yapp 8f81f27d92 librt: correct winding for explicit DSP B-C cell cuts
The explicit ULlr permutation inverted both terrain triangle normals.
The cell intersection state machine uses normal direction to classify
entry and exit, so top-to-side rays could disappear.

An independent triangle mesh and the DSP received the same 500,000
Crofton chords. The mesh returned 3,689 hit rays, while DSP returned
3,463; the DSP surface estimate was 10.35% below the exact area.
Using the adaptive B-C permutation for explicit cuts preserves the
selected diagonal and restores outward top normals. DSP then returned
3,688 hit rays and the area error fell to 4.53%.

Add a fixed top-to-side ray that checks entry and exit distances plus
the top normal.
2026-09-18 15:45:52 +00:00
Clifford Yapp d729a7d3f2 librt: make Crofton sampling deterministic and reusable
Retain ordinary Monte Carlo chord sampling while making its stream
explicit and portable. Draw independent sphere endpoints from a
fixed-seed mt19937_64 generator so every setup is reproducible
without changing the estimator's statistical convergence model.

Convert the generator's high 53 bits explicitly to avoid library-
specific real-number conversions. Consume four values per ray so
ray offsets reproduce disjoint continuations of the same stream.

Reuse a bounded C++ worker pool and stop only after windowed area
estimates remain stable. This avoids repeated thread construction
while retaining the existing stopping criteria.

Add optional collection of ray identifiers, paired entry and exit
hit points, normals, and partition thickness. This gives
reconstruction callers structured source evidence while preserving
lightweight area and volume estimation. Link librt to the thread
target and extend the Crofton tests to verify that offset calls
exactly reproduce the uninterrupted stream.
2026-09-18 14:48:05 +00:00
Clifford Yapp 17601916f4 Use static diagonal transformation in IGES test 2026-09-18 14:02:22 +00:00
Clifford Yapp 90e5ede2b3 Add opt-in forward parity shots for solid BoTs
When LIBRT_BOT_PARITY_SHOT is enabled at prep, solid
BoTs and ARS conversions traverse from the current shot
origin. Discard hits behind that origin and use an odd
forward hit count to construct an interior entry at the
origin. Mark the entry with a dedicated surface number
and a normal opposite the ray. The option assumes a
closed mesh without self intersections; box backout
remains the default because stray exits on bad meshes
can become long segments and origin entries can change
rendering behavior.

Exercise scalar and packet shots for ARS and BoT, plus
composite scene shots, in both modes. With cameras
inside Generic_Twin meshes, median shot time fell 10.6%
for an isolated solid, 1.4% for the full scene from the
same view, and 6.0% for another full-scene inside view.
The isolated render matched, while the full-scene views
changed 173 of 1048576 and 507 of 65536 pixels,
respectively.
2026-09-18 00:30:10 +00:00
Clifford Yapp 72454757ec Add accelerated triangle mesh self-intersection check
Expose an early-exit libbg query for mesh self intersections
and use a BVH to keep candidate pair checks practical on large
meshes. Distinguish contact at shared indexed features from
crossing or overlap, and handle near-contact cases observed
in thin wing meshes.

Make strict hole-fill validation reject self intersections
when requested while preserving the permissive repair default.
Cover shared features, overlapping meshes, malformed input,
and thin wing fixtures. A clean 32768-face grid takes about
58 ms with the BVH, versus about 4 s with the prior pairwise
check.
2026-09-18 00:30:10 +00:00
Clifford Yapp 6e9e1975b8 Distcheck fixes 2026-09-17 19:52:47 -04:00
Clifford Yapp afedaa95bd Enable RPP tests for seven bounded primitives
Particle entered the function table with ft_use_rpp=0 in 1990
(b85ddfc9ff); RPC, RHC, EPA, and EHY did so in 1992
(16dc889cfb).  CLINE arrived with zero in 2000 (4a69d5ab3c).
ANNOT was a zero-flagged stub in 2012 (f31b27d992) and retained the
value when its callbacks arrived in 2017 (cb83958bf5).  The later
table moves and callback rewrites preserved these values.  The
inspected commits record no per-primitive correctness or performance
reason for choosing zero.

The finite shot geometry is enclosed by the prepared boxes: particle
uses its two end radii, CLINE includes its radius and beam expansion,
and RPC, RHC, EPA, and EHY use conservative profile envelopes.
Model-space ANNOT prep produces a BoT and uses its bounds; screen-space
ANNOT has no shot geometry.  Enable the solid RPP check for these seven.

Leave HALF at zero because it is infinite and SKETCH because it never
shoots.  HF computes its box from the maximum height but omits a
negative minimum, so its box can be too small.  ARB8 and ARBN already
clip rays against their faces or planes, and SPH has a cheap quadratic
shot; an added box test needs its own tolerance and performance case.
BoT uses a BVH and origin backout, so changing its RPP behavior needs
separate validation.  The remaining zero entries do not shoot rays.

Five deterministic 1024-square primitives.g renders averaged 1.222
seconds of shot time before and 1.166 after, with 178,709 fewer solid
shot calls and identical pixels.  Two other camera views also matched,
as did NIRT results for rays starting inside each of the six finite
solid types.  The annotation raytrace regression passes.
2026-09-17 21:35:11 +00:00
Clifford Yapp 5c8092b4e6 Use accurate PNTS bounds for ray box tests
PNTS shot uses each point's scale when the point type carries one,
but its bounding box used only the collection scale.  A larger point
could therefore lie outside the reported box and be missed by the RPP
test.  Share the effective scale calculation with prep and include
each rendered sphere in the box.  Reject empty or invalid point sets
instead of returning an unusable box.

Enable ft_use_rpp for PNTS once its box encloses the shot geometry.
Test a ray that hits a point larger than the collection scale and
check that empty point sets do not report usable bounds.
2026-09-17 21:21:43 +00:00
Clifford Yapp de09372b73 Fix BoT shots with origins inside mesh bounds
Commit 7376385fd2 backed the HLBVH traversal origin by twice the
soltab bounding radius to preserve entrance triangles.  Commit
1d75918492 replaced that conservative distance with max(0, -r_min),
assuming r_min reaches the solid boundary.  During rt_shootray,
however, r_min can describe the current spatial partition cell.  A
ray starting inside a BoT can enter that cell after entering the mesh.
BVH culling then drops the entrance triangles, and segment assembly
discards the exit hit without an entrance.  In an overlapping scene,
ARS and native BoT differ because the ARS RPP test refreshes r_min.

For origins inside the BoT BVH root box, move the traversal origin
just beyond the box's entry face.  This retains the entrance facets
without the excess traversal from a bounding radius backout.  Rays
originating outside the box need no backout.  Share the calculation
between scalar and vector shots, while keeping triangle intersections
relative to the original ray origin.

Five deterministic, single processor Generic_Twin.g renders per view
had identical pixels with both backout methods.  The box method cut
shot time by 3.5% from inside the flight deck console, 24.5% from
inside a main strut, and 5.9% from inside a tire.  An exterior view
differed by about 0.2% from the radius method.  Avoiding unnecessary BVH
traversal more than offsets the extra box backout arithmetic for
these interior views.

Test direct ARS and BoT shots whose origins are inside the mesh,
including vector shots, and an overlapping composite scene that
reproduces the failure through rt_shootray without setting r_min
manually.
2026-09-17 21:20:03 +00:00
Clifford Yapp bcfb8669c1 Revert "Add Windows GUI session probe"
This reverts commit 066ec0bc8e.
2026-09-17 20:59:30 +00:00
Clifford Yapp 066ec0bc8e Add Windows GUI session probe
Testing whether we can actually do GUI applcation testing on a
Github CI runner.
2026-09-17 16:48:59 +00:00
Clifford Yapp fa3822b8f8 Modularize GUI regression helpers and isolate Xmin backend 2026-09-17 16:35:48 +00:00
376 changed files with 47366 additions and 26330 deletions
+2 -2
View File
@@ -384,7 +384,7 @@ jobs:
osx:
name: macOS Clang
needs: [linux]
runs-on: macos-14
runs-on: macos-15
strategy:
fail-fast: true
steps:
@@ -403,7 +403,7 @@ jobs:
- name: Prepare bext dependencies
uses: ./brlcad/.github/actions/prepare-bext
with:
platform-channel: macos-14-${{ runner.arch }}-release
platform-channel: macos-15-${{ runner.arch }}-release
source-dir: ${{ github.workspace }}/brlcad
output-dir: ${{ runner.temp }}/bext_output
build-type: Release
+1 -1
View File
@@ -177,7 +177,7 @@ jobs:
osx_bext:
name: macOS - BRL-CAD bext build
needs: [linux_bext]
runs-on: macos-14
runs-on: macos-15
strategy:
fail-fast: true
if: ${{ !cancelled() }}
+36 -20
View File
@@ -231,7 +231,7 @@ set(CMAKE_FIND_USE_PACKAGE_REGISTRY FALSE)
# Prepare to manage and build BRL-CAD's external dependencies. Specifies a
# specific commit hash to use in the 'bext' repository.
include(BRLCAD_ExternalDeps)
brlcad_bext_init(12115e6c5922e2db27a9b88e00dd714af5315f69)
brlcad_bext_init(42d8d7ca57f9d2f61192b41f0b41a731f1ba6c47)
#---------------------------------------------------------------------
# Define various utilities.
@@ -352,9 +352,10 @@ set(CMAKE_SKIP_BUILD_RPATH FALSE)
# it should only be set to the installation value when actually installed.
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
# Add the automatically determined parts of the RPATH which point to
# directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# Installed runtime paths are defined explicitly below. Do not append
# directories discovered on the build host, since those paths may not exist
# or may resolve to unrelated libraries on the installed system.
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
# The following logic is what allows binaries to run successfully in the build
# directory AND install directory.
@@ -678,8 +679,13 @@ endif(MSVC)
# before use so platforms without GNU/LLVM-style linker options are skipped.
brlcad_check_linker_flag(C "LINKER:--no-undefined" BRLCAD_LINKER_NO_UNDEFINED_C_FLAG_FOUND)
brlcad_check_linker_flag(CXX "LINKER:--no-undefined" BRLCAD_LINKER_NO_UNDEFINED_CXX_FLAG_FOUND)
if(BRLCAD_LINKER_NO_UNDEFINED_C_FLAG_FOUND AND BRLCAD_LINKER_NO_UNDEFINED_CXX_FLAG_FOUND)
if(BRLCAD_LINKER_NO_UNDEFINED_C_FLAG_FOUND AND BRLCAD_LINKER_NO_UNDEFINED_CXX_FLAG_FOUND
AND NOT BRLCAD_ENABLE_ADDRESS_SANITIZER)
set(BRLCAD_LINKER_NO_UNDEFINED_FLAG "LINKER:--no-undefined" CACHE STRING "Linker flag requiring resolved shared library symbols" FORCE)
else()
# Clang links the AddressSanitizer runtime into executables, leaving its
# shared-library instrumentation symbols unresolved until then.
set(BRLCAD_LINKER_NO_UNDEFINED_FLAG "" CACHE STRING "Linker flag requiring resolved shared library symbols" FORCE)
endif()
brlcad_check_linker_flags(C BRLCAD_LINKER_WHOLE_ARCHIVE_GROUP_C_FLAG_FOUND "LINKER:--whole-archive" "LINKER:--no-whole-archive")
brlcad_check_linker_flags(CXX BRLCAD_LINKER_WHOLE_ARCHIVE_GROUP_CXX_FLAG_FOUND "LINKER:--whole-archive" "LINKER:--no-whole-archive")
@@ -1642,21 +1648,31 @@ if(NOT MSVC)
endif(BRLCAD_WARNINGS OR BRLCAD_ENABLE_STRICT)
if(BRLCAD_ENABLE_COVERAGE)
# TODO: These seem to GCC specific flags - should probably set up for clang
# as well if that's our compiler...
# https://clang.llvm.org/docs/SourceBasedCodeCoverage.html
# If we need different settings for different tools, should
# encapsulate each tool's setup in a function
check_c_flag(ftest-coverage)
check_cxx_flag(ftest-coverage)
if(FTEST_COVERAGE_C_FLAG_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftest-coverage -fprofile-arcs -fprofile-update=atomic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs -fprofile-update=atomic")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lgcov -ftest-coverage -fprofile-arcs -fprofile-update=atomic")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov -ftest-coverage -fprofile-arcs -fprofile-update=atomic")
else(FTEST_COVERAGE_C_FLAG_FOUND)
message(SEND_ERROR "Building with coverage is not supported by BRL-CAD on this platform.")
endif(FTEST_COVERAGE_C_FLAG_FOUND)
if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
check_c_flag(fprofile-instr-generate)
check_cxx_flag(fprofile-instr-generate)
check_c_flag(fcoverage-mapping)
check_cxx_flag(fcoverage-mapping)
if(NOT FPROFILE_INSTR_GENERATE_C_FLAG_FOUND OR
NOT FPROFILE_INSTR_GENERATE_CXX_FLAG_FOUND OR
NOT FCOVERAGE_MAPPING_C_FLAG_FOUND OR
NOT FCOVERAGE_MAPPING_CXX_FLAG_FOUND)
message(FATAL_ERROR "Clang source-based coverage is not supported by this toolchain.")
endif()
add_compile_options(-fprofile-instr-generate -fcoverage-mapping)
add_link_options(-fprofile-instr-generate)
else()
check_c_flag(ftest-coverage)
check_cxx_flag(ftest-coverage)
if(FTEST_COVERAGE_C_FLAG_FOUND AND FTEST_COVERAGE_CXX_FLAG_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftest-coverage -fprofile-arcs -fprofile-update=atomic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs -fprofile-update=atomic")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lgcov -ftest-coverage -fprofile-arcs -fprofile-update=atomic")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov -ftest-coverage -fprofile-arcs -fprofile-update=atomic")
else()
message(FATAL_ERROR "GCC coverage is not supported by this toolchain.")
endif()
endif()
endif(BRLCAD_ENABLE_COVERAGE)
if(BRLCAD_ENABLE_STRICT)
+8737 -10014
View File
File diff suppressed because it is too large Load Diff
+39 -5
View File
@@ -151,10 +151,13 @@ recommended for serious developers.
Various useful configurations for working with bext:
* Get a git clone that has everything which might be needed (large,
but useful for offline building)
* Acquire bext and its dependencies from another repository host
git clone --recurse-submodules https://github.com/BRL-CAD/brlcad
cmake .. -DBRLCAD_REPOSITORY_ROOT=https://git.example.org/brlcad
* Acquire bext and its dependencies from local bare Git mirrors
cmake .. "-DBRLCAD_REPOSITORY_ROOT=/path/to/mirror/BRL-CAD"
* Have prebuilt bext outputs to reuse - BRL-CAD will simply copy and prepare
the pre-existing files
@@ -398,10 +401,40 @@ Aliases: ENABLE_RUNTIME_DEBUG, ENABLE_RUN_TIME_DEBUG, ENABLE_RUNTIME_DEBUGGING
ENABLE_RUN_TIME_DEBUGGING
--- BRLCAD_REPOSITORY_ROOT ---
Repository URL or local directory containing bext and its dependency
repositories. Defaults to https://github.com/BRL-CAD. The root directly
contains repositories such as bext.git and astyle.git; BRL-CAD does not
append BRL-CAD to the root.
Remote Git URLs (including SSH), native paths, and file:// URLs are supported.
Relative native paths are resolved against the BRL-CAD source directory.
Quote the entire -D argument for paths containing spaces. The setting is
cached and is also passed as BEXT_REPOSITORY_ROOT when BRL-CAD configures
bext, including when BRLCAD_EXT_SOURCE_DIR supplies an existing checkout.
Alternate roots require bext sources with BEXT_REPOSITORY_ROOT support.
Local roots restrict CMake-driven Git acquisition and queries to file
transport, with no online fallback. Mirrors must contain all required pinned
commits and recursive submodules. Dependencies outside bext's canonical URL
prefix require their own Git URL mappings. This setting does not restrict
network access by dependency build scripts or change persistent Git settings.
BRLCAD_EXT_DIR still selects prebuilt outputs, and changing the repository
root alone does not force those outputs to be rebuilt.
To return to the default source:
cmake .. -DBRLCAD_REPOSITORY_ROOT=https://github.com/BRL-CAD
--- BRLCAD_EXT_DIR ---
If specified, BRL-CAD will look in this directory for bext compiled outputs to
bundle and use during the build.
bundle and use during the build. Relative paths are resolved against the
BRL-CAD source directory. Distcheck subconfigures reuse this resolved output
directory and preserve BRLCAD_REPOSITORY_ROOT, BRLCAD_EXT_SOURCE_DIR, and
BRLCAD_EXT_PARALLEL when specified.
--- BRLCAD_EXT_SOURCE_DIR ---
@@ -409,7 +442,8 @@ bundle and use during the build.
If specified, BRL-CAD will look in this directory for bext source files. Use
this when you have a pre-existing bext clone and don't want BRL-CAD's configure
process to pull down another copy, but are still looking to have the BRL-CAD
configure process manage producing bext build outputs.
configure process manage producing bext build outputs. Relative paths are
resolved against the BRL-CAD source directory.
--- BRLCAD_EXT_PARALLEL ---
+92 -46
View File
@@ -10,78 +10,113 @@ descriptive text that emphasizes or further describes significant
changes made. See document footer for additional details.
----------------------------------------------------------------------
--- 20XX-XX-XX Release 7.46.0 ---
--- 202X-XX-XX Release 7.48.0 ---
----------------------------------------------------------------------
* updated MGED and Archer for Tcl 8.6.18 and Itcl/Itk 4 - Cliff Yapp
----------------------------------------------------------------------
--- 2026-10-12 Release 7.46.0 ---
----------------------------------------------------------------------
This release expands geometry conversion and improves modeling
reliability. STEP support adds AP203e2, AP214, and AP242
import/export, native CSG round trips, and AP242 product and
manufacturing information (PMI) import. IGES and JT conversion is
expanded, and new OpenSCAD CSG import/export tools are available.
Facetization is more reliable, NMG solid ray tracing is 10-20 times
faster, CSG ray tracing is faster, and BoT, DSP, and point-cloud ray
intersections are corrected. MGED gains numerous fixes to primitive,
sketch, and combination editing, drawing, dialogs, and preferences.
New tools support object nesting with arrange, building generation
with mkbuilding, annotation editing, and primitive repair. Geometry
analysis, image utilities, Windows support, documentation, and bundled
dependencies also receive substantial updates.
* corrected Archer logic for saving window size - Cliff Yapp
* fixed inside BoT rays, DSP surface normals, PNTS bounds - Cliff Yapp
* improved mged fallback HTML manual viewer - Cliff Yapp
* fixed gqa undefined densities and exit status - Chris McGregor
* added ARBN support to the mged inside command - Cliff Yapp
* improved HYP neck-ratio labels and BoT face selection - Cliff Yapp
* fixed mged view panning, edit rotation, & ray queries - Cliff Yapp
* preserved ARB, CLINE, TGC, & extrusion geometry edits - Cliff Yapp
* restored mged command prompt focus at GUI startup - Cliff Yapp
* new documentation on geometry representation schemes - Sean Morrison
* improved pixscale & bwscale scaling and image piping - Sean Morrison
* restored pixdiff behavior on .pix, added -b for .bw - Sean Morrison
* improved facetize fallback methods and reliability - Cliff Yapp
* updated mged and Archer for Tcl 8.6.18 and Itcl/Itk 4 - Cliff Yapp
* fixed writes to fileless geometry databases - Cliff Yapp
* fixed nastran-g handling of large property IDs - Rupesh, Cliff Yapp
* fixed dxf-g invalid polyface index crashes - Meghna45-code, Cliff Yapp
* fixed Archer primitive editors under Itcl 4 - Cliff Yapp
* fixed Archer shutdown menu cleanup errors - Cliff Yapp
* fixed MGED Build Pattern dialog under Itcl 4 - Cliff Yapp
* fixed dxf-g invalid polyface idx crash - Meghna45-code, Cliff Yapp
* fixed TclCAD framebuffer listing and deletion - Cliff Yapp
* fixed MGED Build Pattern progress updates - Cliff Yapp
* fixed MGED search -exec reentry and Ctrl-C crashes - Cliff Yapp
* fixed MGED asynchronous commands and clone progress - Cliff Yapp
* accelerated large and repeated MGED path drawing - Cliff Yapp
* fixed mged Build Pattern progress updates - Cliff Yapp
* fixed mged search -exec reentry and Ctrl-C crashes - Cliff Yapp
* fixed mged asynchronous commands and clone progress - Cliff Yapp
* accelerated large and repeated mged path drawing - Cliff Yapp
* fixed ARB7 inside solid construction - Cliff Yapp
* fixed direct ARB face and edge-direction editing - Cliff Yapp
* fixed rtwizard startup with framebuffer contention - Cliff Yapp
* fixed Archer annotation line display updates - Cliff Yapp
* fixed Archer sketch scale drift in non-mm databases - Cliff Yapp
* fixed toggle arrow callbacks during setup - Cliff Yapp
* fixed Tcl dialogs with multi-word titles and messages - Cliff Yapp
* fixed Tcl dialogs with multi-word titles and msgs - Cliff Yapp
* fixed Archer Tank Wizard gun generation - Cliff Yapp
* fixed MGED and Archer sketch arc tangency editing - Cliff Yapp
* fixed mged and Archer sketch arc tangency editing - Cliff Yapp
* fixed Archer ARB4 point 3 editing - Cliff Yapp
* fixed ARB4 storage from make and mk_arb4 - Cliff Yapp
* fixed ARB4 and ARB6 center point calculations - Cliff Yapp
* fixed concurrent MGED and rtwizard framebuffer use - Cliff Yapp
* fixed MGED ShotVis editing and reload failures - Cliff Yapp
* fixed concurrent mged and rtwizard framebuffer use - Cliff Yapp
* fixed mged ShotVis editing and reload failures - Cliff Yapp
* fixed Tcl widget geometry and selection defects - Cliff Yapp
* fixed MGED BoT editor property handling - Cliff Yapp
* fixed MGED LOD dialog and adaptive BoT wireframes - Cliff Yapp
* fixed MGED Plot, PostScript, and manual launch tools - Cliff Yapp
* fixed MGED Overlap Tool multi-object result handling - Cliff Yapp
* fixed mged BoT editor property handling - Cliff Yapp
* fixed mged LOD dialog and adaptive BoT wireframes - Cliff Yapp
* fixed mged Plot, PostScript, and manual launch tools - Cliff Yapp
* fixed mged Overlap Tool multi-object result handling - Cliff Yapp
* eliminated 16-fold redundant gchecker grid analysis - Cliff Yapp
* fixed Archer tree handling for object names with spaces - Cliff Yapp
* fixed submodel transforms & relative database paths - Sean Morrison
* fixed Archer tree handling for names with spaces - Cliff Yapp
* fixed RtWizard multi-object edge occlusion handling - Cliff Yapp
* fixed RtWizard title, About, and preference handling - Cliff Yapp
* fixed MGED startup file false legacy-syntax warnings - Cliff Yapp
* fixed MGED saved-view deletion and collaboration sync - Cliff Yapp
* fixed MGED font preferences apply and persistence - Cliff Yapp
* fixed mged startup file false legacy-syntax warnings - Cliff Yapp
* fixed mged saved-view deletion and collaboration sync - Cliff Yapp
* fixed mged font preferences apply and persistence - Cliff Yapp
* fixed Archer combination edits changing Boolean trees - Cliff Yapp
* fixed Archer command-line help startup crash - Cliff Yapp
* fixed MGED Geometry Browser menu and close behavior - Cliff Yapp
* fixed MGED collaboration view unshare crash - Cliff Yapp
* added an override for Archer's preference file location - Cliff Yapp
* fixed mged Geometry Browser menu and close behavior - Cliff Yapp
* fixed mged collaboration view unshare crash - Cliff Yapp
* added override for Archer's preference file location - Cliff Yapp
* fixed embedded Archer display and mode menus - Cliff Yapp
* added Archer -h and --help command-line options - Cliff Yapp
* fixed Archer Help opening the documentation menu - Sean Morrison
* added arrange nest command for packing database objects - Sean Morrison
* new mkbuilding tool for parametric/OSM/CityJSON models - Sean Morrison
* added arrange nest command for packing db objects - Sean Morrison
* added mkbuilding for parametric/OSM/CityJSON models - Sean Morrison
* cross-platform BINUNIF and DSP byte-order handling - Sean Morrison
* improved several cv default behaviors (s, 32, 64, n) - Sean Morrison
* improved several cv default behaviors (s,32,64,n) - Sean Morrison
* fixed invalid bot handling bug applying matrices - Sean Morrison
* improved glTF import robustness via gcv - Sean Morrison
* fixed bot dump glTF/GLB export; -F is now rejected - Cliff Yapp
* faster NMG solid ray tracing (10-20x faster) - Sean Morrison
* preserved primitive colors in shaded BoT and B-Rep drawing - Cliff Yapp
* preserved B-Rep attributes through in-place geometry edits - Cliff Yapp
* fixed gcv filter arguments containing one-character values - Cliff Yapp
* preserved prim colors in shaded BoT and B-Rep drawing - Cliff Yapp
* preserved B-Rep attrs through in-place geometry edits - Cliff Yapp
* fixed gcv filter arguments w/ one-character values - Cliff Yapp
* improved iges-g importer robustness - Cliff Yapp
* expanded g-iges native CSG and B-Rep export support - Cliff Yapp
* added IGES import and export support to gcv - Cliff Yapp
* rt -b query option now supports a single value index - Sean Morrison
* rt -b query option now supports a single value idx - Sean Morrison
* fixed .dpix file format portability and icv support - Sean Morrison
* expanded pixscale support for piped image data - Sean Morrison
* fixed HYP volume and ARBN totals reported by analyze - Cliff Yapp
* corrected rtarea sampling and exposed-area calculations - Cliff Yapp
* fixed VOL data-file lookup and missing-data errors - Chris McGregor
* corrected rtarea sampling/exposed-area calculations - Cliff Yapp
* bot split now groups results and preserves mesh data - Cliff Yapp
* bot decimate now preserves normals, UVs, and plate data - Cliff Yapp
* bot decimate now preserves nrmls, UVs, and plate data - Cliff Yapp
* added raytracing support for annotation objects - Cliff Yapp
* fixed MGED X embedded framebuffer display manager crash - Cliff Yapp
* fixed Windows subprocess quoting and empty arguments - Cliff Yapp
* fixed mged X embedded framebuffer display manager crash - Cliff Yapp
* fixed Windows drive-letter path handling - Cliff Yapp
* added annotate command for managing annotation objects - Cliff Yapp
* added repair command for supported invalid primitives - Cliff Yapp
* changed default new-region material code from 1 to 0 - Keith Bowman
@@ -103,26 +138,34 @@ changes made. See document footer for additional details.
* added option validation to image & framebuffer tools - Sean Morrison
* added contributor, API, command, & raytracing guides - Sean Morrison
* added and updated command and library manual pages - Sean Morrison
* added pnts write -f xyz export option - Chris McGregor
* fixed mged ARB5 point editing - Cliff Yapp
* fixed mged gqa and rtcheck stale overlap plots - Cliff Yapp
* fixed procedural tree generator crashes - Sean Morrison, Cliff Yapp
* added gaia Earth models with day/dusk/night textures - Sean Morrison
* fixed fbcolor ramps & Windows input - Cliff Yapp, Sean Morrison
* added parashot gravity trajectory path generator - Sean Morrison
* added metaball point scaling (via metaball_move_pnt) - Sean Morrison
* added metaball pnt scaling (via metaball_move_pnt) - Sean Morrison
* all raytracing apps now report object prep failures - Sean Morrison
* improved fast4-g robustness and error reporting - Cliff Yapp
* improved robustness of g-vrml plate mode handling - Cliff Yapp
* fixed MGED ARB5 point, pipe, and sketch editing - Cliff Yapp
* added pnts write -f xyz export option - Chris McGregor
* added support for tick drawing on MGED model axis - Cliff Yapp
* added support for tick drawing on mged model axis - Cliff Yapp
* added naca456 left and paired wing generation - Cliff Yapp
* added patch-g -j option, specify object thicknesses - Sean Morrison
* fixed fbcolor color ramp bug drawing the last color - Sean Morrison
* corrected bwstat median and input error handling - Sean Morrison
* fixed gist -Q quick preview option - Sean Morrison
* rt preserves eye_pt setting in command scripts - Sean Morrison
* removed trailing whitespace from nirt output - Sean Morrison
* rt -l8 heat graphs now measure CPU time - Sean Morrison
* documented gqa centroid & moments of inertia options - Sean Morrison
* pixdiff now calculates pixel differences on bw files - Sean Morrison
* fixed bwcrop single-axis crops and pixembed edge fill - Sean Morrison
* fixed bwcrop single-axis crops & pixembed edge fill - Sean Morrison
* fixed isize in non-mm databases - Josh Baker
* fixed metaball adjust clearing points on errors - Sean Morrison
* fixed benchmark+pixcmp correctness validation bug - Sean Morrison
* fixed mged gqa option and value parsing - Sean Morrison
* improved gist hierarchy overflow rendering - Chris McGregor
* fixed rtxray -o grayscale/BW output - Sean Morrison
* fbhelp writes help to stdout and rest to stderr - Sean Morrison
* FB now supports /dev/stdout and /dev/stderr devices - Sean Morrison
* fixed mged rt -C + -o background color to file bug - Sean Morrison
@@ -131,7 +174,7 @@ changes made. See document footer for additional details.
* added rtsil -o support for bw output - Sean Morrison
* added cutting plane animation generation to rtwizard - Cliff Yapp
* fixed pixdiff bug on Windows - Sean Morrison
* fixed MGED startup window placement on Windows - Chris McGregor
* fixed mged startup window placement on Windows - Chris McGregor
* fixed pixborder utility right-side edge bug - Sean Morrison
* fixed 'wavelet' image processing tool on Windows - Sean Morrison
* quieted mged killtree spurious lookup failure output - Sean Morrison
@@ -142,14 +185,16 @@ changes made. See document footer for additional details.
* new doc guide, a visual overview of BRL-CAD objects - Sean Morrison
* improved triangle quality produced by bot remesh - Cliff Yapp
* updated numerous manpage command references - Josh Baker
* fixed submodel paths relative to parent databases - Sean Morrison
* improved performance making huge combinations - Sean Morrison
* added PNTS get, adjust, form, & g2asc/asc2g support - Chris McGregor
* fixed ANNOT get, adjust, & g2asc/asc2g support - Chris McGregor
* added make -t primitive type listing - Chris McGregor
* added gcv import conversion support for vrml/wrl 1.0 - Sean Morrison
* fixed gcv appending to existing geometry databases - Sean Morrison
* added CSS names, hex, HSL/HSV to libbu color parsing - Sean Morrison
* improved OpenNURBS B-Rep import and adjustment safety - Cliff Yapp
* improved Debian application menus and MIME associations - Jordi Sayol
* improved Debian application menus/MIME associations - Jordi Sayol
* updated Tcl/Tk dependency to v8.6.18 using bundled Itcl - Cliff Yapp
* updated Clipper2 dependency to v1.5.4 - Cliff Yapp
* updated Eigen dependency to v5.0.1 - Cliff Yapp
* updated GDAL dependency to v3.13.3 - Cliff Yapp
@@ -161,7 +206,6 @@ changes made. See document footer for additional details.
* updated OpenNURBS dependency to v8.34.26223.11001 - Cliff Yapp
* updated PROJ dependency to v9.8.1 - Cliff Yapp
* updated PoissonRecon dependency to v18.75 - Cliff Yapp
* updated Tcl/Tk dependency to v8.6.18, using bundled Itcl - Cliff Yapp
* updated libjpeg-turbo dependency to v3.2.0 - Cliff Yapp
* updated libosmesa dependency to SHA1 bfa90de - Cliff Yapp
* updated libpng dependency to v1.6.58 - Cliff Yapp
@@ -270,7 +314,7 @@ and extensively improving existing docs.
* added metadata-aware image diff & nirt analysis - Cliff Yapp
* added basic PNTS point-cloud ray tracing - Sean Morrison
* improved nirt behavior in Windows bash consoles - Cliff Yapp
* added g2asc/asc2g support for PNTS, DSP, and EBM - Sean Morrison
* added g2asc/asc2g support for DSP and EBM - Sean Morrison
* updated gct mesh decimation dependency to mmesh - Cliff Yapp
* added procedural wing, propeller & tree generators - Cliff Yapp
* added ISO tire dimensions & named tread presets - Cliff Yapp
@@ -542,6 +586,7 @@ for more information.
----------------------------------------------------------------------
--- 2023-11-06 Release 7.38.0 ---
----------------------------------------------------------------------
This major release of BRL-CAD introduces significant improvements to
the robustness of the facetize command by leveraging the Manifold
library for boolean evaluation of meshes. Facetization is an operation
@@ -580,6 +625,7 @@ processing high level assemblies in BRL-CAD's example geometry files:
----------------------------------------------------------------------
--- 2023-07-26 Release 7.36.0 ---
----------------------------------------------------------------------
This major release of BRL-CAD introduces significant updates to
geometry conversion support. The update includes modernization for
NURBS importing and interaction, BoT manipulation, and incorporates
+3 -3
View File
@@ -1,6 +1,6 @@
BRL-CAD
Release 7.44.2
http://brlcad.org/
BRL-CAD
Release 7.46.0
http://brlcad.org/
BRL-CAD is a powerful cross-platform open source combinatorial
solid modeling system that includes an interactive 3D solid geometry
-9
View File
@@ -2668,15 +2668,6 @@ DOCUMENTATION
Comparison of how BRL-CAD overlaps feature-wise with various
major commercial CAD systems.
* Solid Geometry Representation Comparisons
Describe the implications, tradeoffs, and conversion issues
involved when converting between different geometry
representations. Includes describing implicit geometry,
explicit polygonal boundary representations, explicit spline
surface representations, volumetric models, wireframes,
boolean operations, feature edit operations, and parametric
modeling.
* BRL-CAD Open Source
An overview of how BRL-CAD is organized as an open source
project and community describing the developer meritocracy,
+62
View File
@@ -20,6 +20,7 @@ set(
procedural_geometry.adoc
projection_shader.adoc
renderer_showcase.adoc
solid_geometry_comparison.adoc
taxonomy.adoc
tire.adoc
)
@@ -227,6 +228,17 @@ set(
images/renderer_gallery_rthide.png
images/renderer_gallery_rtdepth.png
images/renderer_gallery_rtxray.png
images/solid_rep_csg.png
images/solid_rep_brep_boolean.png
images/solid_rep_brep_evaluated.png
images/solid_rep_polygonal_boolean.png
images/solid_rep_nmg.png
images/solid_rep_bot.png
images/solid_rep_revolve.png
images/solid_rep_voxel_cells.png
images/solid_rep_volume.png
images/solid_rep_point_cloud.png
images/solid_rep_wireframe.png
images/adrt_castle_path.png
images/adrt_castle_rt.png
images/adrt_castle_rt_ao.png
@@ -409,6 +421,54 @@ if(
set_target_properties(renderer-gallery-snapshot PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD 1)
endif()
# Solid geometry comparison -- opt-in regeneration of committed snapshots.
#
# The article and solid_rep_*.png images are normal committed documentation.
# This target rebuilds the common pawn, derives each representation with the
# built tools, and refreshes the images for review.
option(
BRLCAD_GENERATE_SOLID_REPRESENTATION_COMPARISON
"Regenerate the solid geometry representation comparison snapshots"
OFF
)
if(
BRLCAD_GENERATE_SOLID_REPRESENTATION_COMPARISON
AND TARGET mged
AND TARGET rt
AND TARGET g-voxel
AND TARGET asc2pix
AND TARGET fbclear
AND TARGET plot3-fb
AND TARGET fb-png
)
add_custom_target(
solid-representation-comparison-snapshot
COMMAND
${CMAKE_COMMAND}
-DMGED=$<TARGET_FILE:mged>
-DRT=$<TARGET_FILE:rt>
-DGVOXEL=$<TARGET_FILE:g-voxel>
-DASC2PIX=$<TARGET_FILE:asc2pix>
-DFBCLEAR=$<TARGET_FILE:fbclear>
-DPLOT3FB=$<TARGET_FILE:plot3-fb>
-DFBPNG=$<TARGET_FILE:fb-png>
-DMODEL_SCRIPT=${CMAKE_CURRENT_SOURCE_DIR}/solid_geometry_comparison/create_pawn.tcl
-DIMGDIR=${CMAKE_CURRENT_SOURCE_DIR}/images
-DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/solid_representation_comparison_work
-DSIZE=512
-P ${CMAKE_CURRENT_SOURCE_DIR}/solid_geometry_comparison/generate_comparison.cmake
DEPENDS mged rt g-voxel asc2pix fbclear plot3-fb fb-png
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Regenerating solid geometry representation comparison snapshots"
VERBATIM
USES_TERMINAL
)
set_target_properties(
solid-representation-comparison-snapshot
PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD 1
)
endif()
# ADRT path-tracing gallery -- opt-in regeneration of the committed snapshot.
#
# Like the galleries above, the adrt_pathtrace.adoc article is hand-written and
@@ -464,6 +524,8 @@ cmakefiles(
gallery/generate_gallery.cmake
renderer_gallery/renderer_gallery_manifest.cmake
renderer_gallery/generate_renderer_gallery.cmake
solid_geometry_comparison/create_pawn.tcl
solid_geometry_comparison/generate_comparison.cmake
adrt_gallery/generate_adrt_gallery.cmake
gallery/inputs/pipe.stdin
gallery/inputs/wire.stdin
Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

@@ -0,0 +1,294 @@
= Solid Geometry Representation Comparisons
:doctype: article
:toc:
:toclevels: 2
The same shape can be stored in very different ways. This comparison uses a
purpose-built chess pawn to show which information BRL-CAD retains, evaluates,
or samples when moving among its principal geometry representations. It is a
guide to semantics and conversion choices, not a claim that one representation
is universally best.
== Common model and method
The reference pawn is a region containing seven overlapping ellipsoids. Their
union is non-trivial enough to exercise curved surfaces, overlapping interiors,
and several component boundaries while remaining reliable across the
conversions shown here. The sketch-and-revolve version independently follows
the same nominal profile; it is not an exact conversion of the seven-piece CSG
model.
Every shaded image uses the same orthographic view, 512x512 image size,
material, and single-threaded renderer. The wireframe uses the same view and
image size. The faceting and sampling settings are intentionally coarse enough
to remain visible. A similar silhouette therefore does not mean that two
database objects have the same structure or numerical boundary.
NOTE: This article and its images are a committed snapshot. Developers can
regenerate the figures from built BRL-CAD tools by configuring with
`-DBRLCAD_GENERATE_SOLID_REPRESENTATION_COMPARISON=ON` and building the
`solid-representation-comparison-snapshot` target.
== At a glance
[cols="2,2,1,2,4",options="header"]
|===
|Form
|BRL-CAD storage
|Solid?
|Boolean state
|Editing and conversion consequences
|Analytic CSG
|Seven `ell` leaves in a combination
|Yes
|Retained
|Compact primitive parameters and tree edits preserve construction intent.
|B-rep tree
|Closed `brep` leaves in a combination
|Yes
|Retained
|NURBS surfaces and trims replace analytic leaves, but the assembly tree remains.
|Evaluated B-rep
|One closed `brep`
|Yes
|Evaluated
|Direct face, edge, trim, and control-point editing is possible; original
features and hierarchy are gone.
|Polygonal tree
|Solid-mode `bot` leaves in a combination
|Yes
|Retained
|Leaf tessellation is approximate, but components and their union tree remain
independently replaceable.
|Evaluated NMG
|One `nmg`
|Yes
|Evaluated
|Stores explicit, topology-rich polygonal boundaries and can record
non-manifold relationships.
|Evaluated triangle mesh
|One solid-mode `bot`
|Yes
|Evaluated
|Portable triangle connectivity, but curved geometry and construction history
have been sampled away.
|Sketch and revolve
|One `sketch` referenced by one `revolve`
|Yes
|Not needed here
|The profile, axis, and sweep angle are compact, meaningful parameters.
|Voxel cells
|A region containing many `arb8` boxes
|Yes (sampled)
|Cell union retained
|Individual cells are ordinary CSG geometry; size grows rapidly as cells
shrink.
|Sampled volume
|A file-backed `vol` scalar grid
|Yes (thresholded)
|None
|Compact regular-grid occupancy; resolution and threshold determine the boundary.
|Point cloud
|One `pnts` object with positions and normals
|No pawn interior
|None
|Useful as measured or sampled evidence, but it has no inherent connected
boundary or inside/outside rule.
|Wireframe
|Derived line display of the CSG object
|No
|Uses source tree
|A view-dependent drawing aid, not an independent solid representation.
|===
"Solid" in this table means that the stored object supplies usable
inside/outside semantics for the pawn. An arbitrary B-rep or mesh is not
automatically a solid: its boundary must be closed and consistently oriented.
The point size used to render `pnts` makes each sample a small sphere, but those
spheres do not reconstruct the pawn interior. A wireframe likewise does not
become a solid merely because its curves appear closed in one view.
== Implicit and parametric forms
[cols="1,1"]
[%noheader]
|===
|image:images/solid_rep_csg.png[Analytic CSG pawn,512]
|image:images/solid_rep_revolve.png[Sketch and revolve pawn,512]
|*Analytic CSG.* Native primitives retain their equations and dimensions; the
region evaluates their union during ray tracing.
|*Sketch plus revolve.* A closed line-segment profile is swept through 360
degrees. The stepped profile is intentional and remains editable in two
dimensions.
|===
Analytic CSG is an implicit representation: intersections with ideal primitive
surfaces are computed as needed rather than read from a stored boundary mesh.
It is usually the most compact form here and makes edits such as changing the
head radius or stem proportions direct. Its Boolean hierarchy also records why the
shape was assembled.
`sketch` plus `revolve` is another procedural, parameterized description. It
works especially well for an axisymmetric part, although a sketch with only
line segments produces conical and cylindrical bands rather than the pawn's
original ellipsoidal surfaces. BRL-CAD supports primitive parameters, placement
matrices, sketches, and sweeps; that should not be confused with a general
constraint solver or an associative feature-history system.
== Spline boundary representations
[cols="1,1"]
[%noheader]
|===
|image:images/solid_rep_brep_boolean.png[B-rep leaves with Boolean tree,512]
|image:images/solid_rep_brep_evaluated.png[Single evaluated B-rep,512]
|*B-rep with Booleans.* Each analytic leaf becomes a closed B-rep whose
boundaries are trimmed NURBS surfaces. The original union tree is retained.
|*B-rep without Booleans.* Boolean evaluation produces one explicit boundary;
operand identities and the construction tree no longer exist as editable
features.
|===
A B-rep stores faces, trims, edges, vertices, and their topology explicitly.
Rational NURBS can represent the source quadrics exactly as surfaces, but that
does not make every CSG-to-B-rep conversion exact: intersections, trimming,
topology classification, and repair use numerical tolerances. Keeping a tree
of B-rep leaves isolates conversion to each primitive and retains high-level
editing. Evaluating the tree yields a more self-contained boundary for
exchange and face-level work, at the cost of that history. This snapshot's
evaluated result passes both `brep ... valid` and `brep ... solid`; conversion
results should be checked rather than assumed to be closed.
== Polygonal boundaries
[cols="1,1,1"]
[%noheader]
|===
|image:images/solid_rep_polygonal_boolean.png[BoT leaves with Boolean tree,512]
|image:images/solid_rep_nmg.png[Evaluated NMG pawn,512]
|image:images/solid_rep_bot.png[Evaluated BoT pawn,512]
|*Polygonal with Booleans.* Each leaf is independently tessellated to a BoT,
then placed in the original union tree.
|*Evaluated NMG.* One non-manifold geometry object records the evaluated
polygonal boundary and its richer topology.
|*Evaluated triangle mesh.* One solid, counter-clockwise BoT stores 982
vertices and 1,960 triangular faces in this snapshot.
|===
All three images expose the same coarse tessellation. Their similar appearance
hides an important distinction: the first still has seven editable operands,
whereas the NMG and single BoT are evaluated results. NMG can represent
polygonal faces and non-manifold adjacency; BoT faces are triangles only.
Neither recreates analytic curvature when converted back. Finer tessellation
reduces visible error but increases storage and processing cost.
== Sampled forms
[cols="1,1,1"]
[%noheader]
|===
|image:images/solid_rep_voxel_cells.png[Pawn represented by CSG voxel cells,512]
|image:images/solid_rep_volume.png[Pawn represented by a VOL grid,512]
|image:images/solid_rep_point_cloud.png[Pawn represented by surface points,512]
|*Explicit voxel cells.* `voxelize` tests 3 mm cells and creates a CSG union of
699 boxes for cells exceeding the occupancy threshold.
|*Sampled volume.* `g-voxel` samples a 2 mm grid; a file-backed `vol` interprets
the resulting 17x17x30 byte array through an occupancy window.
|*Point cloud.* `pnts gen` samples the analytic surface on a 2 mm grid. Small
rendered spheres make the otherwise zero-area sample locations visible.
|===
The two voxel images are deliberately separate. The `voxelize` command emits
ordinary box primitives and a combination, while `vol` reads scalar samples on
a regular grid and derives a threshold boundary at ray-trace time. Both are
volumetric approximations whose accuracy, memory, and feature size depend on
cell spacing. A point cloud samples only the surface and has no connectivity;
surface reconstruction requires additional assumptions and may invent or omit
geometry.
== Wireframe display
image::images/solid_rep_wireframe.png[Wireframe display of the analytic CSG pawn,512]
This wireframe is a view-plane plot of MGED's unevaluated display of the
analytic CSG pawn; hidden lines are not removed. Wireframes are useful for
selection, orientation, and seeing component curves, but they are ambiguous:
curves alone do not say which side is material, which loops bound faces, or
which surfaces enclose volume. Keep the solid that generated the display
rather than treating the drawing as an equivalent conversion target.
== Conversion and editing consequences
A conversion command is not an equivalence guarantee. Before replacing source
data, check at least these effects:
* *Tolerance and resolution:* B-rep Boolean evaluation uses intersection and
topology tolerances; tessellation uses chord and angular tolerances; voxels
and points use sample spacing and thresholds. Each can erase a feature
smaller than its controlling tolerance.
* *Construction intent:* evaluating a Boolean tree discards operand identity,
primitive parameters, and ordering. Converting leaves while retaining the
tree keeps more of that intent.
* *Topology:* a visually plausible B-rep or mesh may contain gaps, duplicate
faces, self-intersections, or inconsistent orientation. Validate closure
and ray behavior, not only a shaded image.
* *Attributes:* collapsing a hierarchy may change where region identifiers,
materials, colors, and other attributes reside. Verify them separately
from geometry.
* *Round trips:* CSG to mesh to B-rep does not recover the original equations;
points to a surface requires reconstruction; resampling a volume compounds
discretization. Retain the highest-level trustworthy source.
For parameter changes and repeated design work, prefer analytic primitives,
sketch sweeps, and preserved combination trees. Prefer a validated B-rep when
trimmed-surface topology or exchange requires it. Use NMG for topology-rich
polygonal processing and BoT for triangle-oriented interchange or algorithms.
Use voxels for occupancy operations and point clouds for measured or sampled
data, not as silent substitutes for a watertight solid.
BRL-CAD also supports specialized forms such as DSP height fields, EBM
extrusions, ARS surfaces, metaballs, and legacy `poly` and `bspline` objects.
They are not shown as interchangeable pawn encodings: DSP and EBM are
domain-specific, metaballs change the modeling method, and BoT and B-rep are the
preferred general successors to the legacy polygon and spline forms.
== Reproducing the conversions
The snapshot generator creates the database and runs these principal MGED
operations (names shortened here only where noted):
[source]
----
brep comparison.csg.r brep --no-evaluation
brep comparison.csg.r brep comparison.brep_evaluated.s
facetize -n comparison.csg.r comparison.nmg.s
facetize --methods NMG comparison.csg.r comparison.bot.s
facetize --methods NMG base.s base.bot # repeated for all seven leaves
voxelize -s "3 3 3" -d 4 -t 0.45 comparison.voxel_cells.r comparison.csg.r
pnts gen -t 2 --surface --grid comparison.csg.r comparison.samples
pnts write comparison.samples comparison.xyz
pnts read -f xyzijk --size 0.45 comparison.xyz comparison.point_cloud.s
----
The generator also runs `g-voxel` and expands its sparse occupied-cell report
into the x-fastest byte array used by `vol`. It then renders every shaded
object with `rt -B -M -P1` and the saved view; MGED's `plot -2d`, `plot3-fb`,
and `fb-png` produce the wireframe image. See
`solid_geometry_comparison/generate_comparison.cmake` and
`solid_geometry_comparison/create_pawn.tcl` for the complete reproducible
inputs.
@@ -0,0 +1,24 @@
# Create the shared pawn used by the solid-representation comparison.
title {Solid geometry representation comparison pawn}
units mm
# Deliberate overlaps keep the pawn connected while exercising curved-surface
# intersections during Boolean evaluation.
db put base.s ell V {0 0 4.5} A {17 0 0} B {0 17 0} C {0 0 4.5}
db put base_bead.s ell V {0 0 9.5} A {14 0 0} B {0 14 0} C {0 0 5}
db put body.s ell V {0 0 18} A {12 0 0} B {0 12 0} C {0 0 9}
db put stem.s ell V {0 0 29} A {7 0 0} B {0 7 0} C {0 0 13}
db put collar.s ell V {0 0 39} A {9 0 0} B {0 9 0} C {0 0 3.5}
db put neck.s ell V {0 0 43} A {6.5 0 0} B {0 6.5 0} C {0 0 5}
db put head.s ell V {0 0 50} A {9 0 0} B {0 9 0} C {0 0 9}
db put comparison.csg.r comb region yes id 1000 los 100 GIFTmater 1 rgb {235 190 90} shader {plastic} tree {u {u {u {l base.s} {l base_bead.s}} {u {l body.s} {l stem.s}}} {u {u {l collar.s} {l neck.s}} {l head.s}}}
# The revolve uses a deliberately independent outline. Its single closed
# sketch approximates the same pawn silhouette without copying the CSG tree.
db put comparison.profile sketch V {0 0 0} A {1 0 0} B {0 0 1} VL {{0 0} {17 0} {17 2} {16.3 4} {15 6} {14 8} {15.4 7} {16 9} {15.4 11} {13.5 12.5} {11.2 14} {12 18} {11 21} {9.5 23} {8 26} {7.5 32} {6.5 36} {7.5 37} {9 39} {7.5 41} {6.5 42} {6.5 43} {7.5 44} {8.5 46} {9 50} {8.5 54} {6.7 56.5} {0 59}} SL {{line S 0 E 1} {line S 1 E 2} {line S 2 E 3} {line S 3 E 4} {line S 4 E 5} {line S 5 E 6} {line S 6 E 7} {line S 7 E 8} {line S 8 E 9} {line S 9 E 10} {line S 10 E 11} {line S 11 E 12} {line S 12 E 13} {line S 13 E 14} {line S 14 E 15} {line S 15 E 16} {line S 16 E 17} {line S 17 E 18} {line S 18 E 19} {line S 19 E 20} {line S 20 E 21} {line S 21 E 22} {line S 22 E 23} {line S 23 E 24} {line S 24 E 25} {line S 25 E 26} {line S 26 E 27} {line S 27 E 0}}
db put comparison.revolve.s revolve V {0 0 0} axis {0 0 1} R {1 0 0} ang 6.283185307179586 sk_name comparison.profile
db put comparison.revolve.r comb region yes id 1001 los 100 GIFTmater 1 rgb {235 190 90} shader {plastic} tree {l comparison.revolve.s}
q
@@ -0,0 +1,372 @@
# Regenerate the solid geometry representation comparison snapshots.
#
# The article is hand-written. This script builds its common pawn model,
# derives each representation using BRL-CAD tools, and replaces the committed
# images. All databases and sidecar data remain in WORKDIR.
cmake_minimum_required(VERSION 3.20)
foreach(v MGED RT GVOXEL ASC2PIX FBCLEAR PLOT3FB FBPNG
MODEL_SCRIPT IMGDIR WORKDIR)
if(NOT DEFINED ${v})
message(FATAL_ERROR "generate_comparison: -D${v}=... is required")
endif()
endforeach()
if(NOT DEFINED SIZE)
set(SIZE 512)
endif()
set(RENDER_TIMEOUT 1800)
set(PAWN_DB "${WORKDIR}/solid_representation_pawn.g")
set(VIEW_SCRIPT "${WORKDIR}/pawn.view")
set(MGED_SCRIPT "${WORKDIR}/assemble_variants.tcl")
set(VOXELIZE_SCRIPT "${WORKDIR}/voxelize.tcl")
set(VOXEL_LIST "${WORKDIR}/voxels1.txt")
set(VOLUME_ASCII "${WORKDIR}/comparison_volume.asc")
set(VOLUME_FILE "${WORKDIR}/comparison.vol")
file(REMOVE_RECURSE "${WORKDIR}")
file(MAKE_DIRECTORY "${WORKDIR}")
file(MAKE_DIRECTORY "${IMGDIR}")
function(run_process label)
execute_process(
COMMAND ${ARGN}
WORKING_DIRECTORY "${WORKDIR}"
TIMEOUT ${RENDER_TIMEOUT}
RESULT_VARIABLE process_result
OUTPUT_VARIABLE process_stdout
ERROR_VARIABLE process_stderr
)
if(NOT process_result EQUAL 0)
message(
FATAL_ERROR
"${label} failed (exit ${process_result})\n${process_stdout}${process_stderr}"
)
endif()
message(STATUS "${label}")
endfunction()
function(require_brep_property object property expected_output)
execute_process(
COMMAND "${MGED}" --no-rc -c "${PAWN_DB}" brep "${object}" "${property}"
WORKING_DIRECTORY "${WORKDIR}"
TIMEOUT ${RENDER_TIMEOUT}
RESULT_VARIABLE property_result
OUTPUT_VARIABLE property_stdout
ERROR_VARIABLE property_stderr
)
set(property_output "${property_stdout}${property_stderr}")
if(NOT property_result EQUAL 0 OR NOT property_output MATCHES "${expected_output}")
message(
FATAL_ERROR
"B-rep ${object} is not ${property}\n${property_output}"
)
endif()
message(STATUS "Validated B-rep ${object}: ${property}")
endfunction()
execute_process(
COMMAND "${MGED}" --no-rc -c "${PAWN_DB}"
WORKING_DIRECTORY "${WORKDIR}"
TIMEOUT ${RENDER_TIMEOUT}
INPUT_FILE "${MODEL_SCRIPT}"
RESULT_VARIABLE create_result
OUTPUT_VARIABLE create_stdout
ERROR_VARIABLE create_stderr
)
if(NOT create_result EQUAL 0 OR NOT EXISTS "${PAWN_DB}")
message(
FATAL_ERROR
"Creating the comparison pawn failed (exit ${create_result})\n${create_stdout}${create_stderr}"
)
endif()
# Preserve one Boolean hierarchy as B-rep leaves, and evaluate another into a
# single B-rep. The default suffix is intentional: supplying an explicit
# suffix changes parsing in older MGED versions.
set(PAWN_LEAVES base base_bead body stem collar neck head)
run_process(
"Created Boolean tree of B-rep leaves"
"${MGED}" --no-rc -c "${PAWN_DB}" brep comparison.csg.r brep --no-evaluation
)
foreach(leaf IN LISTS PAWN_LEAVES)
require_brep_property("${leaf}.s.brep" solid "brep is solid")
endforeach()
run_process(
"Created evaluated B-rep"
"${MGED}" --no-rc -c "${PAWN_DB}" brep comparison.csg.r brep comparison.brep_evaluated.s
)
require_brep_property(comparison.brep_evaluated.s valid "brep is valid")
require_brep_property(comparison.brep_evaluated.s solid "brep is solid")
# Generate both the topology-rich NMG form and the triangle-only BoT form.
run_process(
"Created evaluated NMG"
"${MGED}" --no-rc -c "${PAWN_DB}" facetize -n comparison.csg.r comparison.nmg.s
)
run_process(
"Created evaluated BoT"
"${MGED}" --no-rc -c "${PAWN_DB}" facetize --methods NMG comparison.csg.r comparison.bot.s
)
# Tessellating leaves independently preserves the editable Boolean hierarchy.
foreach(leaf IN LISTS PAWN_LEAVES)
run_process(
"Tessellated ${leaf}.s"
"${MGED}" --no-rc -c "${PAWN_DB}" facetize --methods NMG "${leaf}.s" "${leaf}.bot"
)
endforeach()
file(WRITE "${VOXELIZE_SCRIPT}" "voxelize -s {3 3 3} -d 4 -t 0.45 comparison.voxel_cells.r comparison.csg.r\nq\n")
execute_process(
COMMAND "${MGED}" --no-rc -c "${PAWN_DB}"
WORKING_DIRECTORY "${WORKDIR}"
TIMEOUT ${RENDER_TIMEOUT}
INPUT_FILE "${VOXELIZE_SCRIPT}"
RESULT_VARIABLE voxelize_result
OUTPUT_VARIABLE voxelize_stdout
ERROR_VARIABLE voxelize_stderr
)
if(NOT voxelize_result EQUAL 0)
message(
FATAL_ERROR
"Creating explicit voxel cells failed (exit ${voxelize_result})\n${voxelize_stdout}${voxelize_stderr}"
)
endif()
message(STATUS "Created explicit voxel cells")
# PNTS stores point size at import time. The generator first writes all
# sampled fields (xyzijk), then reads them back with a visible point diameter.
run_process(
"Sampled pawn surface"
"${MGED}" --no-rc -c "${PAWN_DB}" pnts gen -t 2 --surface --grid
comparison.csg.r comparison.samples
)
run_process(
"Exported pawn point samples"
"${MGED}" --no-rc -c "${PAWN_DB}" pnts write comparison.samples comparison.xyz
)
run_process(
"Created visible point cloud"
"${MGED}" --no-rc -c "${PAWN_DB}" pnts read -f xyzijk --size 0.45
comparison.xyz comparison.point_cloud.s
)
# g-voxel reports occupied cells. Expand that sparse report into the regular,
# x-fastest byte array required by VOL. The pawn bounds are [-17,17] in X/Y
# and [0,60] in Z; 2 mm cells therefore form a 17 x 17 x 30 grid.
file(REMOVE "${VOXEL_LIST}")
run_process(
"Sampled VOL grid"
"${GVOXEL}" -s "2 2 2" -d 4 -t 0.5 "${PAWN_DB}" comparison.csg.r
)
if(NOT EXISTS "${VOXEL_LIST}")
message(FATAL_ERROR "g-voxel did not create ${VOXEL_LIST}")
endif()
file(STRINGS "${VOXEL_LIST}" voxel_lines)
list(LENGTH voxel_lines occupied_voxels)
if(occupied_voxels EQUAL 0)
message(FATAL_ERROR "g-voxel reported no occupied cells")
endif()
foreach(line IN LISTS voxel_lines)
string(
REGEX MATCH
"^\\((-?[0-9]+)\\.0+, (-?[0-9]+)\\.0+, (-?[0-9]+)\\.0+\\)[ \t]+[^ \t]+[ \t]+[0-9.]+$"
parsed "${line}"
)
if(NOT parsed)
message(FATAL_ERROR "Cannot parse g-voxel output: ${line}")
endif()
set(x_coord "${CMAKE_MATCH_1}")
set(y_coord "${CMAKE_MATCH_2}")
set(z_coord "${CMAKE_MATCH_3}")
math(EXPR x_index "(${x_coord} + 16) / 2")
math(EXPR y_index "(${y_coord} + 16) / 2")
math(EXPR z_index "(${z_coord} - 1) / 2")
if(x_index LESS 0 OR x_index GREATER 16 OR
y_index LESS 0 OR y_index GREATER 16 OR
z_index LESS 0 OR z_index GREATER 29)
message(FATAL_ERROR "g-voxel coordinate outside the expected pawn grid: ${line}")
endif()
set("voxel_${x_index}_${y_index}_${z_index}" 255)
endforeach()
set(volume_text "")
foreach(z_index RANGE 0 29)
foreach(y_index RANGE 0 16)
foreach(x_index RANGE 0 16)
if(DEFINED voxel_${x_index}_${y_index}_${z_index})
set(sample ff)
else()
set(sample 00)
endif()
string(APPEND volume_text "${sample}\n")
endforeach()
endforeach()
endforeach()
file(WRITE "${VOLUME_ASCII}" "${volume_text}")
execute_process(
COMMAND "${ASC2PIX}"
WORKING_DIRECTORY "${WORKDIR}"
TIMEOUT ${RENDER_TIMEOUT}
INPUT_FILE "${VOLUME_ASCII}"
OUTPUT_FILE "${VOLUME_FILE}"
RESULT_VARIABLE asc2pix_result
ERROR_VARIABLE asc2pix_error
)
if(NOT asc2pix_result EQUAL 0)
message(FATAL_ERROR "asc2pix failed (exit ${asc2pix_result})\n${asc2pix_error}")
endif()
file(SIZE "${VOLUME_FILE}" volume_size)
if(NOT volume_size EQUAL 8670)
message(FATAL_ERROR "VOL sidecar is ${volume_size} bytes; expected 8670")
endif()
message(STATUS "Encoded ${occupied_voxels} occupied VOL cells")
# Wrap single primitives in regions so every shaded comparison uses the same
# material. The polygonal tree repeats the original CSG union hierarchy with
# BoT leaves. VOL references a sidecar basename resolved beside the database.
file(WRITE "${MGED_SCRIPT}" [=[
db put comparison.brep_evaluated.r comb region yes id 1010 los 100 GIFTmater 1 rgb {235 190 90} shader {plastic} tree {l comparison.brep_evaluated.s}
db put comparison.nmg.r comb region yes id 1020 los 100 GIFTmater 1 rgb {235 190 90} shader {plastic} tree {l comparison.nmg.s}
db put comparison.bot.r comb region yes id 1030 los 100 GIFTmater 1 rgb {235 190 90} shader {plastic} tree {l comparison.bot.s}
db put comparison.polygonal_boolean.r comb region yes id 1040 los 100 GIFTmater 1 rgb {235 190 90} shader {plastic} tree {u {u {u {l base.bot} {l base_bead.bot}} {u {l body.bot} {l stem.bot}}} {u {u {l collar.bot} {l neck.bot}} {l head.bot}}}
attr set comparison.voxel_cells.r region R region_id 1050 material_id 1 los 100 shader plastic color 235/190/90
db put comparison.point_cloud.r comb region yes id 1060 los 100 GIFTmater 1 rgb {235 190 90} shader {plastic} tree {l comparison.point_cloud.s}
db put comparison.volume.s vol file {comparison.vol} name {comparison.vol} src f w 17 n 17 d 30 lo 1 hi 255 size {2 2 2} mat {1 0 0 -17 0 1 0 -17 0 0 1 0 0 0 0 1}
db put comparison.volume.r comb region yes id 1070 los 100 GIFTmater 1 rgb {235 190 90} shader {plastic} tree {l comparison.volume.s}
q
]=])
execute_process(
COMMAND "${MGED}" --no-rc -c "${PAWN_DB}"
WORKING_DIRECTORY "${WORKDIR}"
TIMEOUT ${RENDER_TIMEOUT}
INPUT_FILE "${MGED_SCRIPT}"
RESULT_VARIABLE assemble_result
OUTPUT_VARIABLE assemble_stdout
ERROR_VARIABLE assemble_stderr
)
if(NOT assemble_result EQUAL 0)
message(
FATAL_ERROR
"Assembling comparison regions failed (exit ${assemble_result})\n${assemble_stdout}${assemble_stderr}"
)
endif()
file(WRITE "${VIEW_SCRIPT}" "viewsize 8.000000000000000e+01;\n")
file(APPEND "${VIEW_SCRIPT}" "orientation 2.480970000000000e-01 4.765910000000000e-01 7.480970000000000e-01 3.894350000000000e-01;\n")
file(APPEND "${VIEW_SCRIPT}" "eye_pt 4.199070000000000e+01 2.940060000000000e+01 5.329140000000000e+01;\n")
file(APPEND "${VIEW_SCRIPT}" "start 0; clean;\n")
file(APPEND "${VIEW_SCRIPT}" "end;\n")
function(copy_snapshot local_image)
if(NOT EXISTS "${local_image}")
message(FATAL_ERROR "Expected image was not created: ${local_image}")
endif()
file(SIZE "${local_image}" image_size)
if(image_size EQUAL 0)
message(FATAL_ERROR "Rendered image is empty: ${local_image}")
endif()
file(COPY "${local_image}" DESTINATION "${IMGDIR}")
get_filename_component(image_name "${local_image}" NAME)
file(
CHMOD "${IMGDIR}/${image_name}"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endfunction()
function(render_snapshot name object)
set(filename "solid_rep_${name}.png")
set(local_image "${WORKDIR}/${filename}")
file(REMOVE "${local_image}")
execute_process(
COMMAND "${RT}" -B -M -W "-s${SIZE}" -P1 -o "${filename}" "${PAWN_DB}" "${object}"
WORKING_DIRECTORY "${WORKDIR}"
TIMEOUT ${RENDER_TIMEOUT}
INPUT_FILE "${VIEW_SCRIPT}"
RESULT_VARIABLE render_result
OUTPUT_VARIABLE render_stdout
ERROR_VARIABLE render_stderr
)
if(NOT render_result EQUAL 0)
message(
FATAL_ERROR
"Rendering ${name} failed (exit ${render_result})\n${render_stdout}${render_stderr}"
)
endif()
copy_snapshot("${local_image}")
message(STATUS "Rendered ${filename}")
endfunction()
render_snapshot(csg comparison.csg.r)
render_snapshot(brep_boolean comparison.csg.r.brep)
render_snapshot(brep_evaluated comparison.brep_evaluated.r)
render_snapshot(polygonal_boolean comparison.polygonal_boolean.r)
render_snapshot(nmg comparison.nmg.r)
render_snapshot(bot comparison.bot.r)
render_snapshot(revolve comparison.revolve.r)
render_snapshot(voxel_cells comparison.voxel_cells.r)
render_snapshot(volume comparison.volume.r)
render_snapshot(point_cloud comparison.point_cloud.r)
# MGED exports its current wireframe display as view-plane plot3. Rasterize
# that plot through a disk framebuffer so regeneration needs no display.
set(WIREFRAME_PLOT "${WORKDIR}/solid_rep_wireframe.plot3")
set(WIREFRAME_PNG "${WORKDIR}/solid_rep_wireframe.png")
set(WIREFRAME_FB_NAME "solid_rep_wireframe.fb")
set(WIREFRAME_SCRIPT "${WORKDIR}/wireframe.tcl")
file(REMOVE "${WIREFRAME_PLOT}" "${WORKDIR}/${WIREFRAME_FB_NAME}" "${WIREFRAME_PNG}")
file(WRITE "${WIREFRAME_SCRIPT}" [=[
draw comparison.csg.r
size 80
orientation 0.248097 0.476591 0.748097 0.389435
eye_pt 41.9907 29.4006 53.2914
plot -2d solid_rep_wireframe.plot3
q
]=])
execute_process(
COMMAND "${MGED}" --no-rc -c "${PAWN_DB}"
WORKING_DIRECTORY "${WORKDIR}"
TIMEOUT ${RENDER_TIMEOUT}
INPUT_FILE "${WIREFRAME_SCRIPT}"
RESULT_VARIABLE wireframe_result
OUTPUT_VARIABLE wireframe_stdout
ERROR_VARIABLE wireframe_stderr
)
if(NOT wireframe_result EQUAL 0 OR NOT EXISTS "${WIREFRAME_PLOT}")
message(
FATAL_ERROR
"MGED wireframe export failed (exit ${wireframe_result})\n${wireframe_stdout}${wireframe_stderr}"
)
endif()
message(STATUS "Exported wireframe plot")
run_process(
"Cleared wireframe framebuffer"
"${FBCLEAR}" -c -F "${WIREFRAME_FB_NAME}" -w "${SIZE}" -n "${SIZE}" 24 24 24
)
execute_process(
COMMAND "${PLOT3FB}" -F "${WIREFRAME_FB_NAME}" -o -w "${SIZE}" -n "${SIZE}"
WORKING_DIRECTORY "${WORKDIR}"
TIMEOUT ${RENDER_TIMEOUT}
INPUT_FILE "${WIREFRAME_PLOT}"
RESULT_VARIABLE plot_result
OUTPUT_VARIABLE plot_stdout
ERROR_VARIABLE plot_stderr
)
if(NOT plot_result EQUAL 0)
message(FATAL_ERROR "plot3-fb failed (exit ${plot_result})\n${plot_stdout}${plot_stderr}")
endif()
run_process(
"Rasterized wireframe snapshot"
"${FBPNG}" -F "${WIREFRAME_FB_NAME}" -w "${SIZE}" -n "${SIZE}"
"solid_rep_wireframe.png"
)
copy_snapshot("${WIREFRAME_PNG}")
message(STATUS "Solid representation comparison: 11 snapshots regenerated")
+34 -18
View File
@@ -4,38 +4,54 @@
:manmanual: BRL-CAD
== NAME
pixdiff - highlight samples which differ between two pix or bw files
pixdiff - highlight differences between two pix or bw images
== SYNOPSIS
[source]
----
pixdiff _file1.pix_ _file2.pix_ > _out.pix_
pixdiff _file1.bw_ _file2.bw_ > _out.bw_
pixdiff -b _file1.bw_ _file2.bw_ > _out.bw_
----
[[description]]
== DESCRIPTION
*pixdiff* compares two raw *pix*(5) or *bw*(5) images byte by byte and
writes a difference image of the same size to standard output. Bytes that
differ by +/-1 are written at intensity 192, while larger differences are
written at full intensity 255. Matching bytes are written at half their
original intensity, providing visual context for locating differences.
By default, *pixdiff* compares raw *pix*(5) images as RGB pixels and writes
a PIX difference image to standard output. When all three channels of a
pixel match, it writes a dim grayscale version of that pixel to all three
output channels. When any channel differs, each matching channel is written
as zero, each channel differing by one is written as 192, and each channel
differing by more than one is written as 255.
Because the comparison does not interpret pixel structure, no format option
is needed and *pixdiff* is independent of image resolution. The two inputs
must be the same size in bytes; otherwise the program reports the mismatch
and exits. Either input file may be given as
With *-b*, *pixdiff* compares raw *bw*(5) images one byte at a time and
writes a BW difference image. Differing samples use the same 192 and 255
intensities; matching samples are written at half their original intensity.
No image dimensions are needed. The two inputs must be the same size in
bytes, and PIX input must contain complete three-byte pixels. Otherwise,
*pixdiff* reports an error. Either input file may be given as
*-* to read from standard input. Output must be redirected; *pixdiff*
refuses to write a raw image stream to a terminal.
Upon completion, the count of bytes that matched, that were off by 1, and
that were off by many is reported on standard error.
Upon completion, *pixdiff* reports matching, off-by-one, and larger-difference
channel or sample counts on standard error.
Also see *bwdiff*(1), which can also operate on *pix*(5) files and can
produce other kinds of difference output.
*bwdiff -n -b* produces a similar BW highlight image, but writes 255 rather
than 192 for off-by-one differences. The default *bwdiff*(1) output instead
shows signed differences around a neutral gray.
[[options]]
== OPTIONS
*-b*::
Treat both inputs and the output as one-byte-per-pixel BW images. Without
this option, use three-byte-per-pixel PIX images.
*-h*::
Show usage information.
[[examples]]
@@ -59,10 +75,10 @@ on standard error give a quick quantitative sense of how much changed.
====
[source,bash]
----
pixdiff depth_a.bw depth_b.bw > depth_diff.bw
pixdiff -b depth_a.bw depth_b.bw > depth_diff.bw
----
Writes a grayscale highlight image using the same byte comparison and
statistics as the color example; no format option is needed.
Writes a grayscale highlight image using byte-wise comparison. Matching
samples retain half their input intensity as context.
====
+3 -2
View File
@@ -18,7 +18,8 @@ Link with *-lanalyze*.
The public interface is organized across the headers included by
_analyze.h_, including _analyze/diff.h_, _analyze/density.h_,
_analyze/grid.h_, _analyze/heal.h_, _analyze/info.h_, _analyze/pnts.h_,
_analyze/polygonize.h_, _analyze/nirt.h_, _analyze/voxelize.h_, and
_analyze/contour.h_, _analyze/polygonize.h_, _analyze/nirt.h_,
_analyze/voxelize.h_, and
_analyze/worker.h_.
== DESCRIPTION
@@ -32,7 +33,7 @@ to gather the information they need.
Facilities provided by the library include model differencing, material
density and mass property analysis, ray-based gridding and sampling,
geometry healing, model information queries, point-cloud generation and
processing, polygonization and voxelization of geometry, and the
processing, manifold dual contouring and voxelization of geometry, and the
interactive ray-tracing engine used by the *nirt*(1) command. A parallel
worker interface supports distributing analysis work across multiple
threads.
+50
View File
@@ -200,6 +200,56 @@ ____
The LIBRT_DEBUG environment variable may be set to the hexadecimal bit vector as described by the DEBUG_* flags listed in the raytrace.h header. Similarly, many LIBRT applications provide a "-x #" command-line option which will take precedence over the environment variable.
The RT_DEBUG_RTCMP flag (0x10000000) (set with LIBRT_DEBUG=10000000)
sets up rtcmp capture, but recording starts disabled. Set
LIBRT_RTCMP_FILE before enabling the flag, then call
rt_rtcmp_capture_set_enabled(1) from the application or a debugger to
record selected rays. Call rt_rtcmp_capture_set_enabled(0) to stop
recording. Enabling returns -1 if the debug flag is unset or the output
writer failed to initialize; disabling returns 0 even before setup. A
ray must begin while recording is enabled, and leaving recording
disabled when it finishes suppresses its record. The debug flag must be
set before concurrent ray shooting; use the setter to change recording
state while rays are running.
Captured hits append one high-precision rtcmp JSON record per ray with
final partitions. Misses produce no record. librt never clears the
output file; the caller must clear or rotate it before a new comparison
as needed. Separate processes must not write to the same file
concurrently. Pending records are flushed within two seconds under
normal operation and during normal process shutdown; call
rt_rtcmp_capture_flush() to wait for pending records when using a
debugger. Disabling recording does not discard records already queued. A
process terminated abnormally may lose pending records. rtcmp comparison
files should use the same hit-only capture mode on both sides; its
generation mode also includes misses. The output can be expanded to also
include primitive segments if LIBRT_RTCMP_PRIMITIVES is set to 1 before
capture is set up.
For example, run a single-threaded ray tracing application in a debugger
and stop at `rt_shootray` for the suspect ray. Capture just that call,
then compare it with a capture of the same ray from a reference build:
[source,shell]
----
$ LIBRT_DEBUG=10000000 LIBRT_RTCMP_FILE=trial.json \
gdb --args ./ray_application model.g
(gdb) break rt_shootray
(gdb) run
(gdb) call rt_rtcmp_capture_set_enabled(1)
(gdb) finish
(gdb) call rt_rtcmp_capture_set_enabled(0)
(gdb) call rt_rtcmp_capture_flush()
(gdb) quit
$ rtcmp -c reference.json trial.json
----
Continue to the suspect ray before enabling capture if the breakpoint
first stops on another ray. Produce `reference.json` with the same ray
and the same capture mode; set LIBRT_RTCMP_PRIMITIVES=1 for both runs
when primitive segments are needed to locate a difference before Boolean
evaluation.
The LIBRT_V4FLIP environment variable may be set to a true or false value to respectively force or disable endianness interpretation of v4 geometry database files. The default behavior is to automatically detect whether flipping the endian interpretation will help LIBRT read a binary-incompatible v4 geometry database file. Setting LIBRT_V4FLIP will override automatic detection.
+24 -16
View File
@@ -10,7 +10,7 @@ facetize - Creates __new_object__ using __old_object__ as a guide, creating an e
[source]
----
facetize [-h] [-v] [-q] [-n] [-r] [-s suffix] [-p prefix] [--in-place] [--max-time #] [--max-pnts #] [--resume] [--methods m1,m2,...] [--method-opts METHOD opt1=val opt2=val...] [--no-empty] [--log-file filename] [--nmg-booleval] [--disable-fixup] [--perturb] [--no-perturb] [--perturb-sa-tol #] [--perturb-vol-tol #] [--tolerate-failures] [-B -t threshold] {old_object new_object}
facetize [-h] [-v] [-q] [-n] [-r] [-j jobs] [-s suffix] [-p prefix] [--in-place] [--max-time #] [--max-pnts #] [--resume] [--methods m1,m2,...] [--method-opts METHOD opt1=val opt2=val...] [--no-empty] [--log-file filename] [--nmg-booleval] [--disable-fixup] [--perturb] [--no-perturb] [--perturb-sa-tol #] [--perturb-vol-tol #] [--tolerate-failures] [-B -t threshold] {old_object new_object}
----
@@ -45,6 +45,8 @@ By default, the Manifold BoT path can make use of a coplanarity-avoidance pertur
When the perturbation step is active, per-region *facetize* validates the initial Boolean output against the original CSG geometry using a Crofton stochastic raytrace. The default tolerance thresholds that trigger a perturb retry are 10% for both surface area and volume; these can be adjusted with *--perturb-sa-tol* and *--perturb-vol-tol*. At the end of a per-region facetization run *facetize* prints a concise validation summary listing how many regions passed, triggered a perturb retry, or encountered one of the following noteworthy conditions:
_Unbounded halfspace (validation unavailable)_: Crofton surface-area and volume comparisons require a finite sampling domain. A standalone halfspace, or another CSG result without finite bounds, is therefore not sampled and is counted as having validation unavailable. A bounded object intersected with or subtracted by a halfspace can still be validated because its finite operand supplies the sampling bounds.
_Sub-mm / few-hit bypass (accepted with note)_: When the Crofton sampler finds only a very small number of ray-surface intersections (below an internal threshold of 50 crossings), the sampling noise alone would exceed 14% relative error, making any SA comparison meaningless. Geometry in this category is typically sub-millimetre in cross-section (e.g., a TGC with a radius under 0.2 mm) but the stochastic sampler has confirmed that some geometry is present. The BoT conversion is accepted and the region is counted separately in the summary. Users should verify that such extreme geometry reflects actual modeling intent rather than an accidental near-degenerate primitive.
_Zero-hit replacement_: When the Crofton sampler fires rays but records zero intersections with the CSG geometry while the corresponding BoT is non-empty, *facetize* concludes that the Boolean evaluation most likely produces empty geometry (for example, a subtractor that fully engulfs the base object). In this case the non-empty BoT is discarded and replaced with an empty BoT to match the expected raytrace behavior. If this replacement appears unexpected for a given region, the *lint* command can be used to inspect the result.
@@ -61,13 +63,21 @@ Different tolerance settings will create finer or coarser meshes. See the *tol*
Primitive tessellation is performed in a child process against a private working copy of the database in the BRL-CAD cache. The original database is not modified as individual primitive meshes are generated. Only after the conversion succeeds are the requested results transferred from the working database. This separation also permits an interrupted conversion to retain its intermediate state for use with *--resume*.
The parent command sends primitive names to a persistent tessellation process one at a time. The child reports a result for each name, so a timeout, conversion failure, or child-process crash that occurs before a database write can be associated directly with the affected primitive. The child is restarted when necessary and processing continues with the next name; the parent does not subdivide and retry the whole group to discover which object failed. Unless output is suppressed with *--quiet*, long tessellation batches also report their current object and completed-object count at approximately five-second intervals.
The parent command sends primitive names to a small pool of persistent tessellation processes. Each child reports a result for every name, so a timeout, conversion failure, or child-process crash can be associated directly with the affected primitive. A child is restarted when necessary and processing continues with the next name; the parent does not subdivide and retry the whole group to discover which object failed. Unless output is suppressed with *--quiet*, long tessellation batches also report their completed-object count and active-worker state at approximately five-second intervals.
Database updates use a separate write handshake. After preparing a mesh in memory, the child announces that it is ready to write and reports the approximate mesh size, then waits. The parent acknowledges that it is waiting for the write before the child may update the working database. The child explicitly reports when the update is complete. Consequently, the normal per-object tessellation limit, including *--max-time* and method-specific limits, applies to mesh preparation and does not interrupt an acknowledged database write.
By default, *facetize* uses at most two worker processes and only enables the second when both CPU and memory information indicate it is safe. It reserves the larger of one GiB or one quarter of total physical memory for the rest of the system. Starting another job also requires at least 512 MiB beyond that reserve, or the largest worker resident-memory measurement seen so far if that is greater. If the platform cannot report the required memory information, *facetize* falls back to one worker. The available CPU count is divided among worker processes and is also imposed as the thread limit inside each worker, preventing nested algorithms from independently using all CPUs. *--jobs* changes the maximum process count; it does not bypass the memory admission checks.
Per-region BoT conversion uses this worker policy for both independent CSG validation and initial Manifold Boolean evaluation. When more than one worker is available, persistent validation processes each open their own read-only handle to the original database and compute Crofton surface-area and volume references for different regions. Persistent Boolean processes then evaluate different region trees using independent read-only handles to one shared snapshot of the tessellated working database. That snapshot also serves as the rollback checkpoint, so increasing *--jobs* does not create additional full database copies. This process isolation avoids sharing mutable raytrace preparation or database state between concurrent evaluations. Each result remains associated with the requested region name. The parent commits completed BoTs through one writer and continues to perform hierarchy changes, validation decisions, and any perturb retries serially. A one-worker run retains the established in-process order and avoids the snapshot phase.
Validation and Boolean workers report their completed-region count and active-worker state approximately every five seconds. When *--max-time* is specified, it also bounds each parallel CSG reference or Boolean request; a timed-out process is terminated, and the failure is associated with that region. Failure or timeout of supplementary CSG validation does not cause unrelated regions to be retried.
Database updates use a separate write handshake. After preparing a mesh in memory, a child announces that it is ready to write and reports the approximate mesh size and its current resident memory, then waits. The parent grants write permission, the child acknowledges when it is starting the write, and the child explicitly reports when the update is complete. Consequently, the normal per-object tessellation limit, including *--max-time* and method-specific limits, applies to mesh preparation and does not interrupt an acknowledged write.
With multiple workers, primitive tessellation children write to small staging databases rather than modifying the shared working database. Region Boolean children read one immutable cache-local snapshot while completed results are committed to the working database. The snapshot doubles as the recovery checkpoint and is opened independently by each worker; it is not duplicated per worker. For very large files, snapshot preparation reports the amount copied and elapsed time at five-second intervals. A region result is first completed in memory and enters the write handshake only when it is ready to replace the prior staged result. After a child reports a completed staging write, the parent submits that result to a single persistent writer process. The writer announces that it is ready, waits for the parent's permission, acknowledges that it is starting the write, transfers the result through one persistent working-database handle, and reports completion. This permits tessellation and initial region Boolean evaluation to proceed in parallel without concurrent database allocation updates or repeated full directory scans, while allowing the parent to supervise the canonical database write itself. With one worker, the established direct path avoids the extra staging I/O and database snapshot.
Before the first primitive conversion, the parent measures write throughput on the same cache filesystem as the working database. It writes a temporary file in 1 MiB chunks until approximately one second has elapsed or 128 MiB has been written, then removes the file immediately. Successful mesh writes of at least 1 MiB subsequently refine this profile. For each database update, the parent allows ten times the projected write time, with a minimum of five seconds and a maximum of five minutes. This measured allowance protects legitimate long writes on slow storage while still detecting a genuinely stalled update.
If a child fails before write permission is granted, the working database is known to be unchanged and no rollback is needed. A failure, crash, or write-deadline expiration after permission is granted but before completion is ambiguous: the working database may contain a partial update. In that case *facetize* restores its cache-local checkpoint and replays only the primitive conversions already known to have succeeded. The original database remains untouched during this recovery.
If a child fails before acknowledging that its write has started, the working database is known to be unchanged and no rollback is needed. In parallel mode, a failure during a child write affects only that worker's disposable staging database, so the failed object is reported and the worker can be restarted without replaying unrelated objects. A serial child failure during a direct write, or a writer-process failure after acknowledging write start, is ambiguous because the working database may contain a partial update. In those cases *facetize* restores its cache-local checkpoint and replays only the conversions not already tied to a specific failure. The original database remains untouched during this recovery.
[[facetize_options]]
@@ -94,6 +104,10 @@ Instructs *facetize* to produce NMG solids rather than BoT solids.
Rather than converting all specified inputs to one top level object, walk specified trees and individually convert regions to facetized objects. This mode is useful when wanting to display models in shaded mode while preserving color and region ID properties. If no regions are present a normal conversion is performed instead.
*-j, --jobs #*::
Set the maximum number of facetize worker processes. A value of 1 forces serial processing. The default value of 0 selects a conservative automatic limit based on available CPUs and memory. Memory checks may delay or reduce parallel work even when a larger value is requested. In per-region BoT mode the same limit controls parallel CSG reference sampling and initial Manifold Boolean evaluation.
*-s, --suffix*::
User specified suffix to use avoiding naming conflicts (naming conflict avoidance is needed when creating objects in *-r* mode.)
@@ -119,7 +133,7 @@ Resume an incomplete facetization process (will utilize cached data from a previ
*--methods*::
Accepts a comma separated list of one or more facetization methods to use. The default is to try all algorithms available as needed, but if a user knows they want to try a specific methodology they can call it out using this option.
Accepts a comma separated list of one or more facetization methods to use. The default tries NMG tessellation first, Manifold Dual Contouring (MDC) second, and SPSR as a final fallback. Other listed methods may be selected explicitly if a user wants to try a specific methodology.
*--method-opts*::
@@ -231,21 +245,15 @@ mged>**facetize --tolerate-failures large_model large_model.partial.bot**
====
.Increase Decimation in CM Mode
.Refine a Manifold Dual Contouring conversion
[example]
====
mged>**facetize --methods CM --method-opts feature_size=0.06 d_feature_size=2.0 ellipse.r ell.bot**
This selects MDC directly and requests a finer cell size with a larger ray
budget than the default:
The default settings on this object in CM mode will produce a little over 8000 faces in the final bot, but the addition of the *d_feature_size* option with a >1.5 value has dramatically reduced the count to 104.
mged>**facetize --methods MDC --method-opts "MDC feature_size=0.1 max_rays=400000" ellipse.r ell.bot**
====
.Decrease Decimation in CM Mode
[example]
====
mged>**facetize --methods CM --method-opts feature_size=0.06 d_feature_size=0.01 ellipse.r ell.bot**
If the intent is preserve a more detailed mesh, reducing *decimation-feature-size* will keep more of the original triangles - in the above example, almost 250 thousand of the original 6.9 million faces were retained. NOTE: use lower values here cautiously, as extremely large meshes can be very difficult for many tools to deal with.
Smaller feature sizes increase mesh detail, ray count, memory use, and runtime.
====
+1
View File
@@ -22,4 +22,5 @@ Task-focused guides and how-to articles.
* link:articles/procedural_geometry.html[BRL-CAD Procedural Geometry Gallery]
* link:articles/projection_shader.html[Using the Projection Shader]
* link:articles/renderer_showcase.html[BRL-CAD Renderer Showcase]
* link:articles/solid_geometry_comparison.html[Solid Geometry Representation Comparisons]
* link:articles/tire.html[Vehicle Tire and Wheel Creation in BRL-CAD]
+13 -16
View File
@@ -679,23 +679,21 @@ Convert CSG geometry to a 3D voxel grid by:
fill fraction
* Level-of-detail parameter controls sub-voxel sampling
==== 7.5 Implicit Surface Polygonizer (Marching Cubes / Tetrahedral)
==== 7.5 Manifold Dual Contouring
An implicit surface polygonizer (Bloomenthal tetrahedral marching) for
converting any inside/outside function to a triangle mesh.
`contour.cpp` evaluates CSG geometry directly with `librt` and constructs
closed, oriented triangle meshes:
`polygonizer.c` (based on Jules Bloomenthal’s "`An Implicit Surface
Polygonizer,`" Graphics Gems IV, 1994) converts any implicit function
(inside/outside test) to a triangle mesh:
* Maintains a hash table of evaluated lattice corners and edges
* Expanding front: starts at a seed point and spreads outward, testing
adjacent cube faces
* Each transitive cube is optionally decomposed into 6 tetrahedra for
sub-cube accuracy
* Edge-surface crossing is found by bisection (`converge`) then the
vertex normal is estimated from finite differences
* Used in `libanalyze` for converting CSG regions to faceted form
* Recursively refines an implicit octree using cached axis-aligned rays along
node box edges and interior quarter- and center-lines
* Reuses complete ray partitions at the conforming finest grid and retains
evaluated boundary points with analytic surface normals
* Resolves ambiguous faces consistently and permits multiple vertices in a
cell to preserve local topology
* Places vertices with bounded quadratic-error minimization
* Validates the resulting indexed mesh before returning it
* Backs the legacy `analyze_polygonize` interface without retaining the old
seed-driven marching-tetrahedra implementation
==== 7.6 Geometry Differencing (raydiff)
@@ -1712,7 +1710,6 @@ import
runtime
* *MT19937*: Mersenne Twister PRNG
* *pbrt-v3* (derived): HLBVH construction algorithm
* *Bloomenthal polygonizer*: implicit surface polygonization
* *Screened Poisson Reconstruction* (Michael Kazhdan): surface
reconstruction from point clouds
* *Ball Pivoting Algorithm*: surface reconstruction
-1
View File
@@ -55,7 +55,6 @@ brlcad_manage_files(pbrt.txt ${DOC_DIR}/legal/embedded TRIGGER
brlcad_manage_files(picohash.txt ${DOC_DIR}/legal/embedded TRIGGER gist)
brlcad_manage_files(pixcii.txt ${DOC_DIR}/legal/embedded TRIGGER libicv)
brlcad_manage_files(point_in_polygon.txt ${DOC_DIR}/legal/embedded TRIGGER libbg)
brlcad_manage_files(polygonizer.txt ${DOC_DIR}/legal/embedded TRIGGER libanalyze)
brlcad_manage_files(predicates.txt ${DOC_DIR}/legal/embedded TRIGGER libbg)
brlcad_manage_files(profont.txt ${DOC_DIR}/legal/embedded TRIGGER libbu)
brlcad_manage_files(pstdint.txt ${DOC_DIR}/legal/embedded TRIGGER libbu)
-9
View File
@@ -1,9 +0,0 @@
https://www.bloomenthal.com/JBloom/code/polygonizer.c
Authored by Jules Bloomenthal, Xerox PARC.
Copyright (c) Xerox Corporation, 1991. All rights reserved.
Permission is granted to reproduce, use and distribute this code for
any and all purposes, provided that this notice appears in all copies.
file:/src/libanalyze/polygonizer.c
-1
View File
@@ -61,5 +61,4 @@ Author: Paul Mackerras (paulus@cs.anu.edu.au),
file:/src/libtclcad/tkImgFmtPIX.c
file:/src/tclscripts/cad_clrpick.tcl
file:/src/tclscripts/html_library.tcl
+1
View File
@@ -31,6 +31,7 @@
#include "common.h"
#include "analyze/defines.h"
#include "analyze/contour.h"
#include "analyze/debug.h"
#include "analyze/diff.h"
#include "analyze/density.h"
+1
View File
@@ -1,5 +1,6 @@
set(
analyze_headers
contour.h
debug.h
defines.h
density.h
+118
View File
@@ -0,0 +1,118 @@
/* C O N T O U R . H
* BRL-CAD
*
* Copyright (c) 2026 United States Government as represented by
* the U.S. Army Research Laboratory.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this file; see the file named COPYING for more
* information.
*/
/** @addtogroup libanalyze
* @{ */
/** @file analyze/contour.h
*
* Ray-driven manifold dual contouring of evaluated BRL-CAD geometry.
*/
#ifndef ANALYZE_CONTOUR_H
#define ANALYZE_CONTOUR_H
#include "common.h"
#include <stddef.h>
#include "vmath.h"
#include "analyze/defines.h"
__BEGIN_DECLS
#define ANALYZE_MDC_DEFAULT_MAX_RAYS 0
#define ANALYZE_MDC_DEFAULT_MINIMUM_FREE_MEM 150000000
#define ANALYZE_MDC_DEFAULT_MIN_DEPTH 2
#define ANALYZE_MDC_DEFAULT_MAX_DEPTH 10
#define ANALYZE_MDC_MAX_DEPTH 20
#define ANALYZE_MDC_DEFAULT_MAX_TIME 600
struct db_i;
/** Resource and accuracy controls for analyze_mdc(). */
struct analyze_mdc_params {
/** Requested maximum finest-cell edge length. Zero selects an
* implementation default based on the model bounds. */
fastf_t feature_size;
/** Optional user ceiling for the automatically derived ray budget.
* Zero applies only geometry, depth, time, and memory limits. */
size_t max_rays;
/** Abort before available memory drops below this many bytes. */
size_t minimum_free_mem;
/** Minimum and maximum power-of-two grid depths. */
int min_depth;
int max_depth;
/** Maximum wall-clock processing time in seconds. Zero is unlimited. */
int max_time;
/** Emit progress diagnostics when non-zero. */
int verbosity;
};
#define ANALYZE_MDC_PARAMS_DEFAULT { \
0.0, \
ANALYZE_MDC_DEFAULT_MAX_RAYS, \
ANALYZE_MDC_DEFAULT_MINIMUM_FREE_MEM, \
ANALYZE_MDC_DEFAULT_MIN_DEPTH, \
ANALYZE_MDC_DEFAULT_MAX_DEPTH, \
ANALYZE_MDC_DEFAULT_MAX_TIME, \
0 \
}
enum analyze_mdc_status {
ANALYZE_MDC_OK = 0,
ANALYZE_MDC_INVALID_INPUT = 1,
ANALYZE_MDC_PREP_FAILED = 2,
ANALYZE_MDC_NO_SURFACE = 3,
ANALYZE_MDC_RAY_LIMIT = 4,
ANALYZE_MDC_TIMEOUT = 5,
ANALYZE_MDC_MEMORY_LIMIT = 6,
ANALYZE_MDC_AMBIGUOUS = 7,
ANALYZE_MDC_NOT_MANIFOLD = 8
};
/**
* Evaluate @p object with librt and construct an indexed triangle mesh.
*
* On success, the caller owns @p faces and @p vertices and must release them
* with bu_free(). Failure leaves all outputs empty.
*/
ANALYZE_EXPORT extern enum analyze_mdc_status
analyze_mdc(int **faces, size_t *num_faces, point_t **vertices,
size_t *num_vertices, const char *object, struct db_i *dbip,
const struct analyze_mdc_params *params);
__END_DECLS
#endif /* ANALYZE_CONTOUR_H */
/** @} */
/*
* Local Variables:
* mode: C
* tab-width: 8
* indent-tabs-mode: t
* c-file-style: "stroustrup"
* End:
* ex: shiftwidth=4 tabstop=8
*/
+22 -2
View File
@@ -43,9 +43,29 @@ struct analyze_polygonize_params {
size_t minimum_free_mem;
int verbosity;
};
#define ANALYZE_POLYGONIZE_PARAMS_DEFAULT { 0, 0, 30, 150000000, 0 }
#define ANALYZE_POLYGONIZE_DEFAULT_MAX_CYCLE_TIME 30
#define ANALYZE_POLYGONIZE_DEFAULT_MINIMUM_FREE_MEM 150000000
#define ANALYZE_POLYGONIZE_PARAMS_DEFAULT { 0, 0, \
ANALYZE_POLYGONIZE_DEFAULT_MAX_CYCLE_TIME, \
ANALYZE_POLYGONIZE_DEFAULT_MINIMUM_FREE_MEM, 0 }
/**
* Legacy polygonization interface, implemented by analyze_mdc().
*
* @p size is the requested maximum cell edge length. @p p_s is retained for
* source and binary compatibility but is no longer used as a starting seed.
* The caller owns successful output arrays and must release them with
* bu_free(). Failure leaves all outputs empty.
*
* @return 0 on success
* @return -1 on invalid input or polygonization failure
* @return 2 when a time limit is reached
* @return 3 when the minimum-free-memory limit is reached
*/
ANALYZE_EXPORT extern int
analyze_polygonize(int **faces, int *num_faces, point_t **vertices, int *num_vertices, fastf_t size, point_t p_s, const char *obj, struct db_i *dbip, struct analyze_polygonize_params *p);
analyze_polygonize(int **faces, int *num_faces, point_t **vertices,
int *num_vertices, fastf_t size, point_t p_s, const char *obj,
struct db_i *dbip, struct analyze_polygonize_params *p);
__END_DECLS
+1
View File
@@ -55,6 +55,7 @@
#include "bg/clip.h"
#include "bg/lseg.h"
#include "bg/obr.h"
#include "bg/pca.h"
#include "bg/plane.h"
#include "bg/polygon.h"
#include "bg/sat.h"
+4 -4
View File
@@ -50,12 +50,12 @@ BG_EXPORT extern int bg_lseg_clip(fastf_t *xp1, fastf_t *yp1, fastf_t *xp2, fast
* The RPP has faces parallel to the coordinate planes and is defined
* by a minimum point and a maximum point.
*
* FIXME: the function name implies this takes a point,dir for a,b but
* it actually takes a line segment going from points a to b!
* Despite its historical name, this function clips the finite line segment
* from a to b.
*
* Returns -
* 0 if ray does not hit RPP,
* !0 if ray hits RPP.
* 0 if the segment does not hit the RPP,
* !0 if the segment hits the RPP.
*
* Implicit Return -
* if !0 was returned, "a" and "b" have been clipped to the RPP.
+6 -3
View File
@@ -126,9 +126,12 @@ BG_EXPORT extern int bg_3d_coplanar_obr(point_t *center,
* \endverbatim
*
*
* @param[out] pnts eight points of oriented bounding box
* @param points_3d array of 3D points
* @param pnt_cnt number of points in pnts array
* @param[out] pnts eight non-NULL, caller-provided point_t storage
* locations for the oriented bounding box vertices
* @param[in] points_3d flat array containing 3 * pnt_cnt coordinate values
* @param[in] pnt_cnt number of points in points_3d
*
* @return 0 on success and -1 for invalid input or when no box can be fit
*/
BG_EXPORT extern int bg_3d_obb(point_t **pnts,
const fastf_t *points_3d,
+4 -4
View File
@@ -21,7 +21,7 @@
/*----------------------------------------------------------------------*/
/** @addtogroup bg_pca
*
* Principle Component Analysis
* Principal Component Analysis
*
* Calculates an XYZ coordinate system such that it aligns with the largest
* variations in the supplied data. Intuitively, it "aligns" with the
@@ -50,7 +50,7 @@
* point_t p;
* for (size_t i = 0; i < pntcnt; i++) {
* MAT4X3PNT(p, RT, pnts[i]);
* VMOVE(pnts[i], v);
* VMOVE(pnts[i], p);
* }
* @endcode
*/
@@ -69,7 +69,7 @@ __BEGIN_DECLS
/**
* @brief
* Perform a Principle Component Analysis on a set of points.
* Perform a Principal Component Analysis on a set of points.
*
* Outputs are a center point and XYZ vectors for the coordinate system.
*
@@ -88,7 +88,7 @@ BG_EXPORT extern int bg_pca(point_t *c, vect_t *xaxis, vect_t *yaxis, vect_t *za
__END_DECLS
#endif /* BG_PLANE_H */
#endif /* BG_PCA_H */
/** @} */
/*
* Local Variables:
+7 -4
View File
@@ -1171,9 +1171,10 @@ BG_EXPORT extern int bg_isect_planes(point_t pt,
/**
* @brief
* Given an origin and a normal, create a plane_t.
* Given an origin and a normal, create a plane_t with a unit normal.
* The input point and normal are not modified. A zero-length normal fails.
*/
BG_EXPORT extern int bg_plane_pt_nrml(plane_t *p, point_t pt, vect_t nrml);
BG_EXPORT extern int bg_plane_pt_nrml(plane_t *p, const point_t pt, const vect_t nrml);
/**
* @brief
@@ -1188,13 +1189,15 @@ BG_EXPORT extern int bg_fit_plane(point_t *c, vect_t *n, size_t npnts, point_t *
/**
* @brief
* Find the closest U,V point on the plane p to 3d point pt.
* Find the closest U,V point on the plane p to 3d point pt. The plane normal
* need not be unit length.
*/
BG_EXPORT extern int bg_plane_closest_pt(fastf_t *u, fastf_t *v, plane_t *p, point_t *pt);
/**
* @brief
* Return the 3D point on the plane at parametric coordinates u, v.
* Return the 3D point on the plane at parametric coordinates u, v. The plane
* normal need not be unit length.
*/
BG_EXPORT extern int bg_plane_pt_at(point_t *pt, plane_t *p, fastf_t u, fastf_t v);
+2 -1
View File
@@ -293,6 +293,7 @@ BG_EXPORT extern int bg_3d_polygon_area(fastf_t *area, size_t npts, const point_
* @param[in] npts Number of point_ts, stored in pts
* @param[in] pts all points of the polygon, sorted counter-clockwise.
* The array mustn't contain duplicated points or non-coplanar points.
* A zero-area polygon fails.
*
* @return 0 if calculation was successful
* @return 1 if calculation failed, e.g. because one in-parameter is a NULL-pointer
@@ -307,7 +308,7 @@ BG_EXPORT extern int bg_3d_polygon_centroid(point_t *cent, size_t npts, const po
*@param[in] npts Number of points, pts contains
*@param pts Array of point_ts, building a convex polygon. Duplicated points
*aren't allowed. The points in the array will be sorted counter-clockwise.
*@param[in] cmp Plane equation of the polygon
*@param[in] cmp Plane equation of the polygon. Its normal must be nonzero.
*
*@return 0 if calculation was successful
*@return 1 if calculation failed, e.g. because pts is a NULL-pointer
+20 -8
View File
@@ -39,7 +39,9 @@
__BEGIN_DECLS
/**
* Test for an intersection between a line and an Axis-Aligned Bounding Box (AABB).
* Test for an intersection between an infinite line and an Axis-Aligned
* Bounding Box (AABB). ldir need not be unit length, but must be nonzero.
* aabb_extent supplies the positive half extents along the coordinate axes.
*
* Returns 1 if they intersect, 0 otherwise.
*/
@@ -50,7 +52,10 @@ bg_sat_line_aabb(
);
/**
* Test for an intersection between a line and an Oriented Bounding Box (OBB).
* Test for an intersection between an infinite line and an Oriented Bounding
* Box (OBB). ldir need not be unit length, but must be nonzero. Each OBB
* extent vector points from the center to a face center; nonzero vectors must
* be mutually perpendicular, and a zero vector represents a degenerate axis.
*
* Returns 1 if they intersect, 0 otherwise.
*/
@@ -61,7 +66,9 @@ bg_sat_line_obb(
);
/**
* Test for an intersection between a triangle and an Axis-Aligned Bounding Box (AABB).
* Test for an intersection between a triangle and an Axis-Aligned Bounding
* Box (AABB). extent supplies the positive half extents along the coordinate
* axes.
*
* Returns 1 if they intersect, 0 otherwise.
*/
@@ -72,7 +79,10 @@ bg_sat_tri_aabb(
);
/**
* Test for an intersection between a triangle and an Oriented Bounding Box (OBB).
* Test for an intersection between a triangle and an Oriented Bounding Box
* (OBB). Each extent vector points from the center to a face center; nonzero
* vectors must be mutually perpendicular, and a zero vector represents a
* degenerate axis.
*
* Returns 1 if they intersect, 0 otherwise.
*/
@@ -85,8 +95,9 @@ bg_sat_tri_obb(
/**
* Test for an intersection between an Axis-Aligned Bounding Box (AABB) and an
* Oriented Bounding Box (OBB). The latter is defined by a center point and
* three perpendicular vectors from the center to the centers of the various
* faces.
* three extent vectors from the center to the centers of the various faces.
* Nonzero extent vectors must be mutually perpendicular; a zero vector
* represents a degenerate axis.
*
* Returns 1 if they intersect, 0 otherwise.
*/
@@ -98,8 +109,9 @@ bg_sat_aabb_obb(
/**
* Test for an intersection between two Oriented Bounding Boxes (OBBs). The
* boxes are defined by a center point and three perpendicular vectors from the
* center to the centers of the various faces.
* boxes are defined by a center point and three extent vectors from the center
* to the centers of the various faces. Nonzero extent vectors must be
* mutually perpendicular; a zero vector represents a degenerate axis.
*
* Returns 1 if they intersect, 0 otherwise.
*/
+127 -5
View File
@@ -67,6 +67,7 @@
#define BG_SPSR_H
#include "common.h"
#include <stdint.h>
#include "vmath.h"
#include "bg/defines.h"
@@ -109,7 +110,7 @@ struct bg_3d_spsr_opts {
#define BG_3D_SPSR_BOUNDARY_DIRICHLET 3
#define BG_3D_SPSR_DEFAULT_DEGREE 1 /* DEFAULT_FEM_DEGREE */
#define BG_3D_SPSR_DEFAULT_DEPTH 11
#define BG_3D_SPSR_DEFAULT_DEPTH 8
#define BG_3D_SPSR_DEFAULT_KERNELDEPTH 0
#define BG_3D_SPSR_DEFAULT_ITERATIONS 0
#define BG_3D_SPSR_DEFAULT_FULL_DEPTH 0
@@ -117,13 +118,13 @@ struct bg_3d_spsr_opts {
#define BG_3D_SPSR_DEFAULT_BASEVCYCLES 0
#define BG_3D_SPSR_DEFAULT_MAX_MEM 0
#define BG_3D_SPSR_DEFAULT_THREADS 0
#define BG_3D_SPSR_DEFAULT_SAMPLES_PER_NODE 1.1
#define BG_3D_SPSR_DEFAULT_SCALE 1.0
#define BG_3D_SPSR_DEFAULT_SAMPLES_PER_NODE 1.5
#define BG_3D_SPSR_DEFAULT_SCALE 1.1
#define BG_3D_SPSR_DEFAULT_WIDTH 0.0
#define BG_3D_SPSR_DEFAULT_CONFIDENCE 0.0
#define BG_3D_SPSR_DEFAULT_CONFIDENCE_BIAS 0.0
#define BG_3D_SPSR_DEFAULT_CGSOLVER_ACCURACY 1.0e-3
#define BG_3D_SPSR_DEFAULT_POINT_WEIGHT 8.0 /* DefaultPointWeightMultiplier * Degree */
#define BG_3D_SPSR_DEFAULT_POINT_WEIGHT 2.0
#define BG_3D_SPSR_DEFAULT_NONMANIFOLD 0
#define BG_3D_SPSR_DEFAULT_LINEARFIT 0
#define BG_3D_SPSR_DEFAULT_EXACT 1
@@ -167,10 +168,131 @@ struct bg_3d_spsr_opts {
* @return 0 if successful, else error
*
*/
BG_EXPORT int bg_3d_spsr(int **faces, int *num_faces, point_t **vertices, int *num_vertices,
DEPRECATED BG_EXPORT int bg_3d_spsr(int **faces, int *num_faces, point_t **vertices, int *num_vertices,
const point_t *input_points_3d, const vect_t *input_normals_3d,
int num_input_pnts, struct bg_3d_spsr_opts *opts);
/** Reasons the SPSR solver may request additional source samples. */
#define BG_3D_SPSR_REFINE_RESIDUAL 0x01u
#define BG_3D_SPSR_REFINE_NORMAL 0x02u
#define BG_3D_SPSR_REFINE_DENSITY 0x04u
#define BG_3D_SPSR_REFINE_SURFACE_VARIATION 0x08u
/** Adaptive SPSR termination states. */
#define BG_3D_SPSR_COMPLETE 0
#define BG_3D_SPSR_CALLBACK_STOP 1
#define BG_3D_SPSR_POINT_LIMIT 2
#define BG_3D_SPSR_TIME_LIMIT 3
#define BG_3D_SPSR_NO_NEW_SAMPLES 4
#define BG_3D_SPSR_SOLVER_ERROR 5
/**
* One oriented source sample. A positive @p thickness records the length of
* the solid ray partition that supplied the sample. Non-zero equal pair IDs
* identify the entry and exit samples of the same partition.
*/
struct bg_3d_spsr_sample {
point_t point;
vect_t normal;
fastf_t thickness;
uint64_t pair_id;
};
/** A spatial location at which the solver would benefit from more samples. */
struct bg_3d_spsr_refinement_hint {
point_t point;
vect_t normal;
fastf_t error;
unsigned int reasons;
};
/** Source-to-candidate measurements supplied by an adaptive callback. */
struct bg_3d_spsr_validation {
size_t ray_count;
size_t source_hit_rays;
size_t partition_mismatch_rays;
size_t thin_partition_count;
size_t thin_partition_mismatches;
fastf_t endpoint_error_p95;
fastf_t endpoint_error_p99;
fastf_t chord_error_fraction;
fastf_t surface_area_error_fraction;
fastf_t volume_error_fraction;
int passed;
};
/** Information passed to an adaptive source-sampling callback. */
struct bg_3d_spsr_refinement_request {
size_t pass;
fastf_t target_feature_size;
double remaining_time;
const point_t *vertices;
size_t vertex_count;
const int *faces;
size_t face_count;
const struct bg_3d_spsr_refinement_hint *hints;
size_t hint_count;
};
/**
* Callback response. Sample storage remains owned by the callback and need
* only remain valid until the callback returns; libbg copies it immediately.
*/
struct bg_3d_spsr_refinement_response {
const struct bg_3d_spsr_sample *samples;
size_t sample_count;
struct bg_3d_spsr_validation validation;
/** Non-zero asks the adaptive driver to stop after this candidate. */
int stop_refinement;
};
typedef int (*bg_3d_spsr_refinement_func_t)(
struct bg_3d_spsr_refinement_response *response,
const struct bg_3d_spsr_refinement_request *request,
void *client_data);
/** Options controlling a bounded adaptive SPSR reconstruction. */
struct bg_3d_spsr_adaptive_opts {
struct bg_3d_spsr_opts solver;
size_t max_refinement_passes;
size_t max_points;
fastf_t target_feature_size;
double max_time;
};
/** Last-resort solve budget; callbacks may stop earlier when progress stalls. */
#define BG_3D_SPSR_DEFAULT_REFINEMENT_PASSES 8
#define BG_3D_SPSR_ADAPTIVE_OPTS_DEFAULT { \
BG_3D_SPSR_OPTS_DEFAULT, \
BG_3D_SPSR_DEFAULT_REFINEMENT_PASSES, \
0, \
0.0, \
0.0 }
/** Summary of an adaptive SPSR attempt. */
struct bg_3d_spsr_report {
size_t solve_count;
size_t initial_sample_count;
size_t final_sample_count;
size_t requested_sample_count;
size_t accepted_sample_count;
double elapsed_time;
int termination;
struct bg_3d_spsr_validation validation;
};
/**
* Reconstruct a surface and, when requested, obtain targeted additional
* samples from @p refine. A callback is required when refinement passes are
* enabled. The final candidate must be marked as passed by the callback.
*/
BG_EXPORT int bg_3d_spsr_adaptive(int **faces, int *num_faces,
point_t **vertices, int *num_vertices,
const struct bg_3d_spsr_sample *input_samples, size_t sample_count,
const struct bg_3d_spsr_adaptive_opts *opts,
bg_3d_spsr_refinement_func_t refine, void *client_data,
struct bg_3d_spsr_report *report);
__END_DECLS
#endif /* BG_SPSR_H */
+1 -1
View File
@@ -52,7 +52,7 @@ BG_EXPORT extern double bg_tri_closest_pt(
__END_DECLS
#endif /* BG_TRI_TRI_H */
#endif /* BG_TRI_PT_H */
/** @} */
/*
* Local Variables:
+1 -1
View File
@@ -54,7 +54,7 @@ BG_EXPORT extern int bg_isect_tri_line(point_t *isect,
* If isect is non-NULL, it is written only when an intersection is found.
*/
BG_EXPORT extern int bg_isect_tri_ray(const point_t orig,
const point_t dir,
const vect_t dir,
const point_t vert0,
const point_t vert1,
const point_t vert2,
+22 -1
View File
@@ -87,7 +87,11 @@ BG_EXPORT extern int bg_trimesh_oriented(int vcnt, int fcnt, fastf_t *v, int *f)
/**
* Check if a mesh is topologically solid. Returns 1 if the mesh is NOT SOLID
* and 0 if the mesh is SOLID. A SOLID (0) outcome indicates the mesh satisfies
* all three criteria: Closed, Manifold, Oriented
* all three criteria: Closed, Manifold, Oriented. If @p bedges is non-NULL,
* it is set to NULL when no edge diagnostics are present, or to a bu_calloc()
* allocated array of vertex-index pairs for unmatched, misoriented, and excess
* edges. The caller must bu_free() a non-NULL result. Use
* bg_trimesh_solid2() when structured diagnostics and their counts are needed.
*/
BG_EXPORT extern int bg_trimesh_solid(int vcnt, int fcnt, fastf_t *v, int *f, int **bedges);
@@ -120,6 +124,23 @@ BG_EXPORT extern int bg_trimesh_unmatched_edges(int num_edges, struct bg_trimesh
BG_EXPORT extern int bg_trimesh_misoriented_edges(int num_edges, struct bg_trimesh_halfedge *edge_list, bg_edge_error_funct_t error_edge_func, void *data);
BG_EXPORT extern int bg_trimesh_excess_edges(int num_edges, struct bg_trimesh_halfedge *edge_list, bg_edge_error_funct_t error_edge_func, void *data);
BG_EXPORT extern int bg_trimesh_solid2(int vcnt, int fcnt, fastf_t *v, int *f, struct bg_trimesh_solid_errors *errors);
/**
* Report geometric intersections between faces of one triangle mesh.
* Contact confined to a shared indexed vertex or edge is allowed; overlap
* beyond that shared feature and contact between unconnected faces count as
* self intersections. This test does not check manifoldness or closure.
*
* @param[in] faces flat array of three vertex indices per triangle
* @param[in] num_faces number of triangles
* @param[in] points array of vertex positions
* @param[in] num_points number of vertices
*
* @return 1 if self intersecting, 0 if not, -1 for malformed input
* (invalid indices, non-finite vertices, or degenerate faces) or a failed check.
*/
BG_EXPORT extern int bg_trimesh_self_isect(const int *faces, size_t num_faces,
const point_t *points, size_t num_points);
BG_EXPORT extern int bg_trimesh_hanging_nodes(int num_vertices, int num_faces, fastf_t *vertices, int *faces, struct bg_trimesh_solid_errors *errors);
BG_EXPORT extern struct bg_trimesh_halfedge * bg_trimesh_generate_edge_list(int fcnt, int *f);
+15 -12
View File
@@ -214,8 +214,8 @@ BN_EXPORT extern void bn_mat_ae(mat_t m,
double elev);
/**
* Find the azimuth and elevation angles that correspond to the
* direction (not including twist) given by a direction vector.
* Find the azimuth and elevation angles, in degrees, that correspond
* to the direction (not including twist) given by a direction vector.
*/
BN_EXPORT extern void bn_ae_vec(fastf_t *azp,
fastf_t *elp,
@@ -236,14 +236,16 @@ BN_EXPORT extern void bn_aet_vec(fastf_t *az,
fastf_t accuracy);
/**
* Find a unit vector from the origin given azimuth and elevation.
* Find a unit vector from the origin given azimuth and elevation in
* radians.
*/
BN_EXPORT extern void bn_vec_ae(vect_t vec,
fastf_t az,
fastf_t el);
/**
* Find a vector from the origin given azimuth, elevation, and distance.
* Find a vector from the origin given azimuth and elevation in radians,
* and distance.
*/
BN_EXPORT extern void bn_vec_aed(vect_t vec,
fastf_t az,
@@ -310,8 +312,10 @@ BN_EXPORT extern void bn_vec_perp(vect_t new_vec,
* space by the angle between the two. There are many candidate
* matrices.
*
* The input 'from' and 'to' vectors need not be unit length.
* MAT4X3VEC(to, m, from) is the identity that is created.
* The input 'from' and 'to' vectors need not be unit length. They are
* normalized internally. Near-parallel inputs are handled using the
* angular tolerance in 'tol'. If either input cannot be normalized,
* the result is the identity matrix.
*
*/
BN_EXPORT extern void bn_mat_fromto(mat_t m,
@@ -344,12 +348,11 @@ BN_EXPORT extern void bn_mat_zrot(mat_t m,
double cosz);
/**
* Given a direction vector D of unit length, product a matrix which
* rotates that vector D onto the -Z axis. This matrix will be
* suitable for use as a "model2view" matrix.
*
* XXX This routine will fail if the vector is already more or less
* aligned with the Z axis.
* Given a nonzero direction vector D, produce a matrix which
* rotates D onto the -Z axis. D is normalized internally. Z-axis
* directions use a deterministic roll, and a zero direction produces
* the identity matrix. This matrix will be suitable for use as a
* model2view matrix.
*
* This is done in several steps.
*
+31
View File
@@ -37,11 +37,42 @@ __BEGIN_DECLS
typedef struct bn_multipoly {
uint32_t magic;
/**< Number of coefficients in the first polynomial variable. */
int dgrs;
/**< Number of coefficients in the second polynomial variable. */
int dgrt;
/**< Coefficient of S^s * T^t is cf[s][t]. */
double **cf;
} bn_multipoly_t;
/**
* Allocate a zero-valued bivariate polynomial with the specified
* coefficient counts. Both counts must be positive.
*/
BN_EXPORT extern struct bn_multipoly *bn_multipoly_new(int dgrs, int dgrt);
/** Release a bivariate polynomial allocated by bn_multipoly_new(). */
BN_EXPORT extern void bn_multipoly_free(struct bn_multipoly *poly);
/** Grow a polynomial to at least the specified coefficient counts. */
BN_EXPORT extern struct bn_multipoly *bn_multipoly_grow(struct bn_multipoly *poly,
int dgrs,
int dgrt);
/** Set the coefficient of S^s * T^t, growing the polynomial as needed. */
BN_EXPORT extern struct bn_multipoly *bn_multipoly_set(struct bn_multipoly *poly,
int s,
int t,
double value);
/** Return the sum of two bivariate polynomials. */
BN_EXPORT extern struct bn_multipoly *bn_multipoly_add(const struct bn_multipoly *p1,
const struct bn_multipoly *p2);
/** Return the product of two bivariate polynomials. */
BN_EXPORT extern struct bn_multipoly *bn_multipoly_mul(const struct bn_multipoly *p1,
const struct bn_multipoly *p2);
__END_DECLS
#endif /* BN_MULTIPOLY_H */
+20 -4
View File
@@ -45,7 +45,10 @@ __BEGIN_DECLS
/**
* Polynomial data type
* bn_poly->cf[n] corresponds to X^n
*
* Coefficients are stored from the highest to the lowest degree:
* `cf[0]` is the coefficient of `X^dgr` and `cf[dgr]` is the
* constant coefficient.
*/
typedef struct bn_poly {
uint32_t magic;
@@ -63,6 +66,9 @@ typedef struct bn_poly {
*
* @brief
* multiply two polynomials
*
* The output may alias either input. If the result exceeds
* BN_MAX_POLY_DEGREE, returns BN_POLY_NULL without modifying product.
*/
BN_EXPORT extern struct bn_poly *bn_poly_mul(struct bn_poly *product,
const struct bn_poly *m1,
@@ -81,6 +87,8 @@ BN_EXPORT extern struct bn_poly *bn_poly_scale(struct bn_poly *eqn,
* bn_poly_add
* @brief
* add two polynomials
*
* The output may alias either input.
*/
BN_EXPORT extern struct bn_poly *bn_poly_add(struct bn_poly *sum,
const struct bn_poly *poly1,
@@ -90,6 +98,8 @@ BN_EXPORT extern struct bn_poly *bn_poly_add(struct bn_poly *sum,
* bn_poly_sub
* @brief
* subtract two polynomials
*
* The output may alias either input.
*/
BN_EXPORT extern struct bn_poly *bn_poly_sub(struct bn_poly *diff,
const struct bn_poly *poly1,
@@ -98,7 +108,10 @@ BN_EXPORT extern struct bn_poly *bn_poly_sub(struct bn_poly *diff,
/**
* @brief
* Divides any polynomial into any other polynomial using synthetic
* division. Both polynomials must have real coefficients.
* division. Both polynomials must have real coefficients and the
* divisor's leading coefficient must be nonzero. The quotient and
* remainder outputs must be distinct; the quotient may alias the
* dividend. All other output/input pairs must be distinct.
*/
BN_EXPORT extern void bn_poly_synthetic_division(struct bn_poly *quo,
struct bn_poly *rem,
@@ -108,7 +121,8 @@ BN_EXPORT extern void bn_poly_synthetic_division(struct bn_poly *quo,
/**
*@brief
* Uses the quadratic formula to find the roots (in `complex' form) of
* any quadratic equation with real coefficients.
* any quadratic equation with real coefficients. A nonzero leading
* coefficient need not be one.
*
* @return 1 for success
* @return 0 for fail.
@@ -144,6 +158,7 @@ BN_EXPORT extern int bn_poly_quadratic_roots(struct bn_complex roots[],
* If D < 0, there will be three unequal real roots.
*
* Returns 1 for success, 0 for fail.
* A nonzero leading coefficient need not be one.
*/
BN_EXPORT extern int bn_poly_cubic_roots(struct bn_complex roots[],
const struct bn_poly *eqn);
@@ -151,7 +166,8 @@ BN_EXPORT extern int bn_poly_cubic_roots(struct bn_complex roots[],
/**
*@brief
* Uses the quartic formula to find the roots (in `complex' form)
* of any quartic equation with real coefficients.
* of any quartic equation with real coefficients. A nonzero leading
* coefficient need not be one.
*
* @return 1 for success
* @return 0 for fail.
+4 -3
View File
@@ -100,8 +100,8 @@ BN_EXPORT extern void quat_double(quat_t qout,
/**
*@brief Gives the bisector of quaternions q1 and q2.
*
* (Could be done with quat_slerp and factor 0.5)
* [I believe they must be unit quaternions this to work]
* Inputs must be unit quaternions. Antipodal inputs use a valid
* great-circle midpoint.
*/
BN_EXPORT extern void quat_bisect(quat_t qout,
const quat_t q1,
@@ -161,7 +161,8 @@ BN_EXPORT extern void quat_exp(quat_t out,
/**
*@brief
* Take the natural logarithm of a unit quaternion.
* Take the natural logarithm of a unit quaternion. The identity
* quaternion maps to the zero quaternion.
* Code by Ken Shoemake.
*/
BN_EXPORT extern void quat_log(quat_t out,
+16 -9
View File
@@ -205,23 +205,30 @@ BU_EXPORT extern int bu_sscanf(const char *src, const char *fmt, ...) _BU_ATTR_S
/** Routines for scanning certain kinds of data. */
/**
* Scans a sequence of fastf_t numbers from a string or stdin
* Scans a sequence of fastf_t numbers from a string or stdin.
*
* Scanning fastf_t numbers with bu_sscanf() is difficult, because
* doing so requires scanning to some intermediate type like double
* and then assigning to the fastf_t variable to convert the value to
* whatever type fastf_t really is. This function makes it possible
* to scan a series of fastf_t numbers separated by some character(s)
* easily, by doing the required conversion internally to the
* functions. As series of delimiter characters will be skipped,
* empty scan fields are not supported (e.g., "0.0,,0.0,1.0" will scan
* as 3 fields, not 4 with the 2nd skipped).
* to scan a series of fastf_t numbers easily, by doing the required
* conversion internally. Delimiters form a non-empty character set:
* one or more delimiter characters must separate values, and repeated
* delimiters are skipped. Empty scan fields are therefore not
* supported (e.g., "0.0,,0.0,1.0" scans as 3 fields, not 4 with the
* second skipped). A trailing delimiter is not consumed after the
* final requested value.
*
* @param[out] c Returns number of characters scanned by the function
* @param[out] c Optional destination for the number of input characters
* consumed. It is set to zero before scanning and remains zero for
* invalid arguments or when no value is scanned.
* @param[in] src A source string to scan from, or NULL to read from stdin
* @param[in] delim Any delimiter character(s) to skip between scan values
* @param[in] delim Non-empty set of delimiter characters to skip between
* scan values
* @param[in] n Number of fastf_t values to scan from the src input string
* @param[out] ... Pointers to fastf_t for storing scanned values (optional)
* @param[out] ... Exactly n fastf_t pointers for storing scanned values;
* individual pointers may be NULL
* @return Number of values scanned
*
*/
BU_EXPORT extern int bu_scan_fastf_t(int *c, const char *src, const char *delim, size_t n, ...);
+14 -1
View File
@@ -103,10 +103,23 @@ BU_EXPORT extern void bu_nice_set(int newnice);
/**
* Return the maximum number of physical CPUs that are considered to
* be available to this process now.
* be available to this process now, subject to any process-local limit set by
* bu_avail_cpus_set().
*/
BU_EXPORT extern size_t bu_avail_cpus(void);
/**
* Limit the CPU count reported by bu_avail_cpus() and honored by subsequent
* bu_parallel() calls in this process. A value of zero removes the limit.
* Call this before starting worker threads; changing the limit does not resize
* work that is already running.
*
* This is useful when several independent processes share one machine and
* each process contains code that selects its own parallelism with
* bu_avail_cpus().
*/
BU_EXPORT extern void bu_avail_cpus_set(size_t ncpu);
/**
* Create parallel threads of execution.
+1 -1
View File
@@ -1 +1 @@
45
47
+4 -1
View File
@@ -31,7 +31,10 @@
__BEGIN_DECLS
struct rt_comb_internal; /* forward declaration */
struct bu_external;
struct db_i;
struct directory;
struct rt_comb_internal;
/* db5_attr.c */
+2 -2
View File
@@ -84,7 +84,7 @@ __BEGIN_DECLS
#define RT_DEBUG_HF 0x04000000 /**< @brief 27 Height Field solids */
#define RT_DEBUG_MESHING 0x08000000 /**< @brief 28 Print meshing/triangulation details */
#define RT_DEBUG_UNUSED_3 0x10000000 /**< @brief 29 Unassigned */
#define RT_DEBUG_RTCMP 0x10000000 /**< @brief 29 Set up rtcmp capture; recording uses a runtime toggle. If LIBRT_RTCMP_PRIMITIVES=1 includes primitive segments. */
#define RT_DEBUG_UNUSED_4 0x20000000 /**< @brief 30 Unassigned */
/* Options which will cause the library to write binary debugging output */
@@ -96,7 +96,7 @@ __BEGIN_DECLS
"\040PL_BOX" \
"\037PL_SOLIDS" \
"\036UNUSED_4" \
"\035UNUSED_3" \
"\035RTCMP" \
"\034UNUSED_2" \
"\033HF" \
"\032EBM" \
+23 -6
View File
@@ -465,6 +465,17 @@ rt_get_solid_keypoint(struct rt_edit *s, point_t *pt, const char **strp, fastf_t
RT_EXPORT extern void
rt_edit_set_edflag(struct rt_edit *s, int edflag);
/**
* Set a parameter-edit translation target expressed in model base units.
*
* rt_edit's parameter-edit handlers consume e_para in database local units,
* while keypoints and edit axes are maintained in model base units. This
* helper performs the boundary conversion for callers that have computed a
* target from a keypoint, axis, or view transform.
*/
RT_EXPORT extern void
rt_edit_set_translation_target(struct rt_edit *s, const point_t target);
RT_EXPORT extern int
rt_edit_knob_cmd_process(
struct rt_edit *s,
@@ -499,8 +510,10 @@ rt_knob_edit_sca(
int matrix_edit);
/* Equivalent to sedit - run editing logic after input data is set in
* rt_edit container */
RT_EXPORT extern void
* rt_edit container. Transient input flags are consumed whether the edit
* succeeds or fails; parameter values remain available to the caller.
* Returns BRLCAD_ERROR if the primitive edit fails. */
RT_EXPORT extern int
rt_edit_process(struct rt_edit *s);
/**
@@ -521,7 +534,7 @@ rt_edit_snap_point(point2d_t pt, const struct rt_edit *s);
* restored later with rt_edit_revert().
*
* The snapshot is stored inside the rt_edit struct. Calling this
* function again overwrites any previous snapshot (single-level undo).
* function again replaces the previous snapshot only on success.
*
* @return BRLCAD_OK on success, BRLCAD_ERROR if the export failed.
*/
@@ -532,8 +545,8 @@ rt_edit_checkpoint(struct rt_edit *s);
* Restore primitive parameters from the snapshot saved by
* rt_edit_checkpoint().
*
* If no snapshot has been saved (or the last snapshot was already
* consumed) this function logs a message and returns BRLCAD_ERROR.
* The snapshot remains available for repeated restores. If none has
* been saved, this function logs a message and returns BRLCAD_ERROR.
*
* @return BRLCAD_OK on success, BRLCAD_ERROR otherwise.
*/
@@ -697,7 +710,11 @@ enum rt_constraint_edit_op_kind {
RT_CONSTRAINT_EDIT_OP_SET_BEND,
RT_CONSTRAINT_EDIT_OP_SCALE_OD,
RT_CONSTRAINT_EDIT_OP_SCALE_ID,
RT_CONSTRAINT_EDIT_OP_SCALE_BEND
RT_CONSTRAINT_EDIT_OP_SCALE_BEND,
/* Set every point when an all-zero dimension has no scale reference. */
RT_CONSTRAINT_EDIT_OP_SET_ALL_OD,
RT_CONSTRAINT_EDIT_OP_SET_ALL_ID,
RT_CONSTRAINT_EDIT_OP_SET_ALL_BEND
};
struct rt_constraint_edit_param_ref {
+46
View File
@@ -227,6 +227,32 @@ struct rt_crofton_params {
double time_ms; /**< wall-clock time budget (ms); 0 = disabled */
};
/** One solid partition observed by a Crofton ray. */
struct rt_crofton_segment {
point_t in_point;
vect_t in_normal;
point_t out_point;
vect_t out_normal;
fastf_t thickness;
size_t ray_id;
};
/**
* Structured samples and estimates produced by rt_crofton_collect().
* Release @p segments with rt_crofton_result_free().
*/
struct rt_crofton_result {
struct rt_crofton_segment *segments;
size_t segment_count;
size_t ray_count;
size_t crossing_count;
double surface_area;
double volume;
};
/** Initialize an rt_crofton_result before first use. */
#define RT_CROFTON_RESULT_INIT { NULL, 0, 0, 0, 0.0, 0.0 }
/**
* Run the Cauchy-Crofton ray-sampling estimator on an already-prepared
@@ -337,6 +363,26 @@ struct rt_crofton_params {
*/
RT_EXPORT extern int rt_crofton_shoot(double *out_surf_area, double *out_volume, point_t *out_aabb_min, point_t *out_aabb_max, point_t out_obb[8], point_t **out_points, size_t *out_point_count, struct rt_i *rtip, const struct rt_crofton_params *params, const fastf_t *bbox_min, const fastf_t *bbox_max);
/**
* Run Crofton sampling while preserving oriented entry/exit pairs.
*
* @p result must be initialized with RT_CROFTON_RESULT_INIT. On success it
* owns the returned segment array. @p rtip must already be prepared.
* @p ray_offset skips that many samples in the deterministic sequence and
* labels the returned rays starting at that value. This lets successive
* calls use disjoint validation streams.
*/
RT_EXPORT extern int rt_crofton_collect(struct rt_crofton_result *result,
struct rt_i *rtip,
const struct rt_crofton_params *params,
size_t ray_offset,
const fastf_t *bbox_min,
const fastf_t *bbox_max);
/** Release storage owned by a structured Crofton result. */
RT_EXPORT extern void rt_crofton_result_free(
struct rt_crofton_result *result);
/**
* Cauchy-Crofton surface-area and/or volume estimator for a primitive.
+1
View File
@@ -41,6 +41,7 @@ struct rt_nmg_edit {
struct loopuse *lu_copy; /* copy of loop to be extruded */
plane_t lu_pl; /* plane equation for loop to be extruded */
struct shell *es_s; /* Shell where extrusion is to end up */
int es_s_from_extrusion; /* Replace this edit's prior preview */
point_t lu_keypoint; /* keypoint of lu_copy for extrusion */
struct vertex *es_v; /* Currently selected NMG vertex (ECMD_NMG_VPICK) */
struct faceuse *es_fu; /* Currently selected NMG faceuse (ECMD_NMG_FPICK) */
+12
View File
@@ -55,6 +55,18 @@
__BEGIN_DECLS
#define RT_RTCMP_CAPTURE_RUNTIME_TOGGLE 1
/** Set RT_DEBUG_RTCMP recording: nonzero enables, zero disables.
* Enabling requires the debug flag and a usable output writer.
* Return 0 on success and -1 on failure. Disabling succeeds even
* before setup.
*/
RT_EXPORT extern int rt_rtcmp_capture_set_enabled(int enabled);
/** Wait until pending RT_DEBUG_RTCMP records have reached the output file. */
RT_EXPORT extern int rt_rtcmp_capture_flush(void);
/**
* @brief
* Shoot a ray
+62 -38
View File
@@ -30,6 +30,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include(CMakeParseArguments)
include("${CMAKE_CURRENT_LIST_DIR}/BRLCAD_Repository.cmake")
# Try to locate a usable git executable. On Windows, Visual Studio may
# provide git in non-standard locations; try common Program Files and
@@ -88,6 +89,15 @@ function(brlcad_bext_init BEXT_SHA1)
set(BRLCAD_EXT_DIR "${BRLCAD_EXT_DIR_ENV}")
endif(BRLCAD_EXT_DIR_ENV AND NOT DEFINED BRLCAD_EXT_DIR)
# Resolve paths before probing them so later subconfigures use the same
# directories even when launched from a different working directory.
foreach(_brlcad_ext_path_var BRLCAD_EXT_DIR BRLCAD_EXT_SOURCE_DIR)
if(DEFINED ${_brlcad_ext_path_var} AND NOT "${${_brlcad_ext_path_var}}" STREQUAL "")
get_filename_component(${_brlcad_ext_path_var} "${${_brlcad_ext_path_var}}" ABSOLUTE BASE_DIR "${CMAKE_SOURCE_DIR}")
set(${_brlcad_ext_path_var} "${${_brlcad_ext_path_var}}" PARENT_SCOPE)
endif()
endforeach()
set(_brlcad_ext_dir_specified FALSE)
set(_brlcad_ext_dir_managed FALSE)
@@ -148,14 +158,14 @@ function(brlcad_bext_init BEXT_SHA1)
elseif(NOT _brlcad_ext_dir_specified)
message(
WARNING
"External dependencies will be downloaded, configured, and built automatically as-needed. Set BRLCAD_EXT_DIR to specify instead."
"External dependencies will be acquired from ${_BRLCAD_REPOSITORY_ROOT}, configured, and built automatically as-needed. Set BRLCAD_EXT_DIR to specify instead."
)
endif()
message(
STATUS
"BRLCAD_EXT_DIR specifies prebuilt external dependencies directory\n"
"containing 'install' and 'noinstall' folders, outputs from installing\n"
"https://github.com/BRL-CAD/bext.\n"
"${_BRLCAD_BEXT_REPOSITORY}.\n"
)
endif(NOT BRLCAD_EXT_NOINSTALL_DIR OR NOT BRLCAD_EXT_INSTALL_DIR)
@@ -211,28 +221,24 @@ function(brlcad_rel_version BRLCAD_REL)
set(${BRLCAD_REL} "rel-${VMAJOR}-${VMINOR}-${VPATCH}" PARENT_SCOPE)
endfunction()
# Look up branch or tag SHA1 hashes from primary github.com repo
# Branch/tag queries are advisory; an unavailable source cannot validate them.
function(remote_sha1 SHA1_VAR BRANCH)
set(${SHA1_VAR} "" PARENT_SCOPE)
if(NOT GIT_EXEC)
set(${SHA1_VAR} "" PARENT_SCOPE)
return()
endif()
# This needs a working internet connection to succeed (and GitHub
# must be up and working as well.)
brlcad_repository_git_command(git_command)
execute_process(
COMMAND ${GIT_EXEC} ls-remote https://github.com/BRL-CAD/bext.git ${BRANCH}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE LS_REMOTE_STATUS
OUTPUT_VARIABLE LS_REMOTE_STR
ERROR_VARIABLE LS_REMOTE_STR
)
if(NOT LS_REMOTE_STATUS AND LS_REMOTE_STR)
string(REPLACE " " ";" LS_REMOTE_STR "${LS_REMOTE_STR}")
string(REPLACE "\t" ";" LS_REMOTE_STR "${LS_REMOTE_STR}")
list(GET LS_REMOTE_STR 0 REMOTE_SHA1)
set(${SHA1_VAR} "${REMOTE_SHA1}" PARENT_SCOPE)
else()
set(${SHA1_VAR} "" PARENT_SCOPE)
COMMAND "${CMAKE_COMMAND}" -E env GIT_TERMINAL_PROMPT=0 --
${git_command} -c credential.helper= -c credential.interactive=false
ls-remote "${_BRLCAD_BEXT_REPOSITORY}" "${BRANCH}"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE git_result
OUTPUT_VARIABLE remote_refs
ERROR_QUIET
)
if(git_result STREQUAL "0" AND remote_refs MATCHES "^([0-9a-f]+)[ \t]")
set(${SHA1_VAR} "${CMAKE_MATCH_1}" PARENT_SCOPE)
endif()
endfunction()
@@ -367,24 +373,29 @@ function(setup_bext_dir)
# no pre-existing sources, so we're cloning into the build dir
set(BRLCAD_EXT_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/bext")
# Write current SHA1 for subsequent processing
brlcad_repository_git_command(git_command)
message(STATUS "Cloning bext from ${_BRLCAD_BEXT_REPOSITORY}")
execute_process(
COMMAND ${git_command} clone "${_BRLCAD_BEXT_REPOSITORY}" "${BRLCAD_EXT_SOURCE_DIR}"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
RESULT_VARIABLE git_result
)
if(NOT git_result STREQUAL "0")
message(FATAL_ERROR "Unable to clone bext from ${_BRLCAD_BEXT_REPOSITORY} (${git_result})")
endif()
execute_process(
COMMAND ${git_command} -c advice.detachedHead=false checkout "${BEXT_SHA1}"
WORKING_DIRECTORY "${BRLCAD_EXT_SOURCE_DIR}"
RESULT_VARIABLE git_result
)
if(NOT git_result STREQUAL "0")
message(FATAL_ERROR "Unable to check out pinned bext commit ${BEXT_SHA1} from ${_BRLCAD_BEXT_REPOSITORY} (${git_result}); ensure the repository contains this commit")
endif()
# Record the pin only after checkout succeeds.
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/bext.sha1" "${BEXT_SHA1}")
distclean("${CMAKE_CURRENT_BINARY_DIR}/bext.sha1")
# Clone
message("BRL-CAD bext clone command: ${GIT_EXEC} clone https://github.com/BRL-CAD/bext.git")
execute_process(
COMMAND ${GIT_EXEC} clone https://github.com/BRL-CAD/bext.git
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND_ERROR_IS_FATAL ANY
)
message("BRL-CAD bext checkout command: ${GIT_EXEC} -c advice.detachedHead=false checkout ${BEXT_SHA1}")
execute_process(
COMMAND ${GIT_EXEC} -c advice.detachedHead=false checkout ${BEXT_SHA1}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bext
COMMAND_ERROR_IS_FATAL ANY
)
# Configure process will need to clean up bext
if (BRLCAD_BEXT_CLEANUP)
set(BEXT_SRC_CLEANUP TRUE PARENT_SCOPE)
@@ -425,6 +436,12 @@ function(brlcad_ext_setup)
message(FATAL_ERROR "Invalid bext directory: ${BRLCAD_EXT_SOURCE_DIR}")
endif()
if(NOT _BRLCAD_REPOSITORY_ROOT STREQUAL "${_BRLCAD_REPOSITORY_DEFAULT_ROOT}/"
AND NOT EXISTS "${BRLCAD_EXT_SOURCE_DIR}/CMake/BextGit.cmake")
message(FATAL_ERROR
"bext sources in ${BRLCAD_EXT_SOURCE_DIR} do not support BEXT_REPOSITORY_ROOT; update bext before building with BRLCAD_REPOSITORY_ROOT=${BRLCAD_REPOSITORY_ROOT}")
endif()
# We do allow the user to specify a build dir to be reused, however
# this is unpredictable and may cause unexpected results depending
# on what is or isn't rebuilt - use with care.
@@ -463,11 +480,18 @@ function(brlcad_ext_setup)
endif(BRLCAD_ENABLE_APPLESEED)
# Define CMake arguments we'll need regardless of mode
set(bext_shallow_clone ON)
if(_BRLCAD_REPOSITORY_LOCAL)
set(bext_shallow_clone OFF)
endif()
set(CMAKE_CMD_ARGS
-S ${BRLCAD_EXT_SOURCE_DIR} -B ${BRLCAD_EXT_BUILD_DIR} -DGIT_SHALLOW_CLONE=ON
-DENABLE_ALL=${BEXT_ENABLE_ALL} -DUSE_GDAL=${BEXT_USE_GDAL} -DUSE_QT=${BEXT_USE_QT} -DUSE_TCL=${BEXT_USE_TCL}
-DUSE_APPLESEED=${BEXT_USE_APPLESEED} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX=${BRLCAD_EXT_INSTALL_DIR}
-S "${BRLCAD_EXT_SOURCE_DIR}" -B "${BRLCAD_EXT_BUILD_DIR}"
"-DBEXT_REPOSITORY_ROOT:STRING=${_BRLCAD_REPOSITORY_ROOT}"
"-DGIT_SHALLOW_CLONE:BOOL=${bext_shallow_clone}"
"-DENABLE_ALL=${BEXT_ENABLE_ALL}" "-DUSE_GDAL=${BEXT_USE_GDAL}"
"-DUSE_QT=${BEXT_USE_QT}" "-DUSE_TCL=${BEXT_USE_TCL}"
"-DUSE_APPLESEED=${BEXT_USE_APPLESEED}" "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
"-DCMAKE_INSTALL_PREFIX=${BRLCAD_EXT_INSTALL_DIR}"
)
if(BRLCAD_X11_PROVIDER_RESOLVED STREQUAL "XMIN" AND BRLCAD_XMIN_ROOT)
list(APPEND CMAKE_CMD_ARGS
+32 -21
View File
@@ -119,14 +119,16 @@ mark_as_advanced(SYS_INCLUDE_PATTERNS)
# ${BRLCAD_EXT_DIR}/install copies, so wrap logic to do so into a
# function.
function(strip_excluded RDIR EXPATTERNS)
file(GLOB_RECURSE staged_files LIST_DIRECTORIES false RELATIVE "${RDIR}" "${RDIR}/*")
foreach(ep ${${EXPATTERNS}})
file(GLOB_RECURSE MATCHING_FILES LIST_DIRECTORIES false RELATIVE "${RDIR}" "${RDIR}/${ep}")
foreach(rf ${MATCHING_FILES})
set(matching_files ${staged_files})
list(FILTER matching_files INCLUDE REGEX "${ep}")
foreach(rf ${matching_files})
file(REMOVE "${RDIR}/${rf}")
if(EXISTS ${RDIR}/${rf})
if(EXISTS "${RDIR}/${rf}")
message(FATAL_ERROR "Removing ${RDIR}/${rf} failed")
endif(EXISTS ${RDIR}/${rf})
endforeach(rf ${MATCHING_FILES})
endif(EXISTS "${RDIR}/${rf}")
endforeach(rf ${matching_files})
endforeach(ep ${${EXPATTERNS}})
endfunction(strip_excluded)
@@ -1106,9 +1108,9 @@ function(brlcad_install_strclear_replace stamp_dir strclear source install_file
endif()
endfunction()
function(brlcad_install_binary_postprocess stamp_dir strclear source install_file install_type mode rpath_tool install_rpath build_lib_path rel_rpath use_selective_rpath verbose)
function(brlcad_install_binary_postprocess stamp_dir strclear source install_file install_type mode rpath_tool install_rpath build_lib_path rel_rpath verbose)
set(_brlcad_physical_file "$ENV{DESTDIR}${install_file}")
set(_brlcad_signature "binary-postprocess|${install_type}|${mode}|${rpath_tool}|${install_rpath}|${build_lib_path}|${rel_rpath}|${use_selective_rpath}|${strclear}")
set(_brlcad_signature "binary-postprocess|${install_type}|${mode}|${rpath_tool}|${install_rpath}|${build_lib_path}|${rel_rpath}|${strclear}")
_brlcad_postprocess_needed(_brlcad_needed "${stamp_dir}" "${source}" "${_brlcad_physical_file}" "${_brlcad_signature}")
if(NOT _brlcad_needed)
return()
@@ -1119,32 +1121,41 @@ function(brlcad_install_binary_postprocess stamp_dir strclear source install_fil
message(FATAL_ERROR "Post-install copy did not create ${_brlcad_physical_file}")
endif()
set(_brlcad_result 0)
set(_brlcad_rpath_output)
set(_brlcad_rpath_error)
if("${mode}" STREQUAL "RPATH_TOOL")
set(_brlcad_selective_rpath_args)
if(use_selective_rpath)
set(_brlcad_selective_rpath_args --set-rpath-if-needed --set-rpath-if-needed-prepend --stale-rpath-prefix "${build_lib_path}")
endif()
# Install the exact project-defined search order. A selective update can
# leave an existing relative-only RPATH without the canonical install path.
execute_process(
COMMAND "${rpath_tool}" --set-rpath "${install_rpath}" ${_brlcad_selective_rpath_args} "${_brlcad_physical_file}"
COMMAND "${rpath_tool}" --set-rpath "${install_rpath}" "${_brlcad_physical_file}"
RESULT_VARIABLE _brlcad_result
OUTPUT_VARIABLE _brlcad_rpath_output
ERROR_VARIABLE _brlcad_rpath_error
)
elseif("${mode}" STREQUAL "APPLE")
execute_process(
COMMAND install_name_tool -delete_rpath "${build_lib_path}" "${_brlcad_physical_file}"
RESULT_VARIABLE _brlcad_result
OUTPUT_VARIABLE _brlcad_output
ERROR_VARIABLE _brlcad_error
OUTPUT_VARIABLE _brlcad_rpath_output
ERROR_VARIABLE _brlcad_rpath_error
)
if(_brlcad_result EQUAL 0)
execute_process(
COMMAND install_name_tool -add_rpath "${rel_rpath}" "${_brlcad_physical_file}"
RESULT_VARIABLE _brlcad_result
OUTPUT_VARIABLE _brlcad_rpath_output
ERROR_VARIABLE _brlcad_rpath_error
)
endif()
endif()
if(NOT _brlcad_result EQUAL 0)
message(WARNING "Post-install RPATH update failed for ${_brlcad_physical_file}")
message(
WARNING
"Post-install RPATH update failed for ${_brlcad_physical_file}\n"
"stdout: ${_brlcad_rpath_output}\n"
"stderr: ${_brlcad_rpath_error}"
)
return()
endif()
@@ -1838,13 +1849,9 @@ endfunction()
elseif(APPLE)
set(_brlcad_install_postprocess_mode "APPLE")
endif(P_RPATH_EXECUTABLE)
set(_brlcad_install_use_selective_rpath FALSE)
if(P_RPATH_SUPPORTS_SET_IF_NEEDED_PREPEND)
set(_brlcad_install_use_selective_rpath TRUE)
endif(P_RPATH_SUPPORTS_SET_IF_NEEDED_PREPEND)
install(
CODE
"include(\"${BRLCAD_EXT_INSTALL_POSTPROCESS_SCRIPT}\")\nbrlcad_install_binary_postprocess(\"${BRLCAD_EXT_INSTALL_POSTPROCESS_STAMP_DIR}\" \"${STRCLEAR_EXECUTABLE}\" \"${CMAKE_BINARY_DIR}/${tf}\" \"\${CMAKE_INSTALL_PREFIX}/${tf}\" \"PROGRAM\" \"${_brlcad_install_postprocess_mode}\" \"${_brlcad_install_postprocess_tool}\" \"${_brlcad_install_postprocess_rpath}\" \"${CMAKE_BINARY_DIR}/${LIB_DIR}\" \"${REL_RPATH}\" \"${_brlcad_install_use_selective_rpath}\" \"${BRLCAD_VERBOSE}\")"
"include(\"${BRLCAD_EXT_INSTALL_POSTPROCESS_SCRIPT}\")\nbrlcad_install_binary_postprocess(\"${BRLCAD_EXT_INSTALL_POSTPROCESS_STAMP_DIR}\" \"${STRCLEAR_EXECUTABLE}\" \"${CMAKE_BINARY_DIR}/${tf}\" \"\${CMAKE_INSTALL_PREFIX}/${tf}\" \"PROGRAM\" \"${_brlcad_install_postprocess_mode}\" \"${_brlcad_install_postprocess_tool}\" \"${_brlcad_install_postprocess_rpath}\" \"${CMAKE_BINARY_DIR}/${LIB_DIR}\" \"${REL_RPATH}\" \"${BRLCAD_VERBOSE}\")"
)
continue()
endif("${tf}" IN_LIST ALL_BINARY_FILES)
@@ -2198,7 +2205,11 @@ macro(find_package_opencv)
set(OpenCV_DIR_TMP "${OpenCV_DIR}")
set(OpenCV_DIR "${CMAKE_BINARY_DIR}/${LIB_DIR}/cmake/opencv4")
set(OpenCV_ROOT ${CMAKE_BINARY_DIR})
find_package(OpenCV COMPONENTS core features2d imgproc highgui)
find_package(OpenCV CONFIG COMPONENTS core imgproc imgcodecs highgui)
if(OpenCV_FOUND AND OpenCV_VERSION_MAJOR GREATER_EQUAL 5)
# OpenCV 5 moved boundingRect from imgproc to geometry.
find_package(OpenCV CONFIG COMPONENTS geometry)
endif()
unset(OpenCV_ROOT)
# If no bundled copy, see what the system has
+108
View File
@@ -0,0 +1,108 @@
# Copyright (c) 2026 United States Government as represented by
# the U.S. Army Research Laboratory.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# 3. The name of the author may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include_guard(GLOBAL)
set(_BRLCAD_REPOSITORY_DEFAULT_ROOT "https://github.com/BRL-CAD")
set(BRLCAD_REPOSITORY_ROOT "${_BRLCAD_REPOSITORY_DEFAULT_ROOT}" CACHE STRING
"Repository URL or local mirror directory containing bext and its dependency repositories")
function(brlcad_repository_root out_root out_local)
set(root "${BRLCAD_REPOSITORY_ROOT}")
set(local FALSE)
if(root STREQUAL "")
message(FATAL_ERROR "BRLCAD_REPOSITORY_ROOT must be a repository URL or local mirror directory")
endif()
# Match bext's URL handling, but resolve relative paths against BRL-CAD.
# Drive paths must be checked before scp-style SSH locations.
if(root MATCHES "^file://")
set(local TRUE)
string(REPLACE "=" "%3D" root "${root}")
elseif(root MATCHES "^[A-Za-z]:[/\\\\]" OR
NOT (root MATCHES "^[A-Za-z][A-Za-z0-9+.-]*://" OR root MATCHES "^[^/]+:.+"))
set(local TRUE)
string(REPLACE "\\" "/" root "${root}")
if(WIN32 OR NOT root MATCHES "^[A-Za-z]:/")
get_filename_component(root "${root}" ABSOLUTE BASE_DIR "${CMAKE_SOURCE_DIR}")
endif()
# Escape literal percent signs first so native paths cannot introduce
# URL escapes. An equals sign also has meaning in Git's -c assignments.
string(REPLACE "%" "%25" root "${root}")
string(REPLACE " " "%20" root "${root}")
string(REPLACE "#" "%23" root "${root}")
string(REPLACE "?" "%3F" root "${root}")
string(REPLACE "=" "%3D" root "${root}")
if(root MATCHES "^[A-Za-z]:/")
set(root "file:///${root}")
elseif(root MATCHES "^//")
set(root "file:${root}")
else()
set(root "file://${root}")
endif()
endif()
if(NOT root MATCHES "^file:///*$")
string(REGEX REPLACE "/+$" "" root "${root}")
string(APPEND root "/")
else()
set(root "file:///")
endif()
set(${out_root} "${root}" PARENT_SCOPE)
set(${out_local} "${local}" PARENT_SCOPE)
endfunction()
function(brlcad_repository_git_command out_command)
set(git_command "${GIT_EXEC}")
if(WIN32)
list(APPEND git_command -c core.longpaths=true)
endif()
if(_BRLCAD_REPOSITORY_LOCAL)
list(APPEND git_command -c protocol.file.allow=always)
# This also constrains recursive Git processes and user URL rewrites.
list(PREPEND git_command "${CMAKE_COMMAND}" -E env GIT_ALLOW_PROTOCOL=file --)
endif()
set(${out_command} "${git_command}" PARENT_SCOPE)
endfunction()
brlcad_repository_root(_BRLCAD_REPOSITORY_ROOT _BRLCAD_REPOSITORY_LOCAL)
set(_BRLCAD_BEXT_REPOSITORY "${_BRLCAD_REPOSITORY_ROOT}bext.git")
message(STATUS "BRL-CAD repository root: ${_BRLCAD_REPOSITORY_ROOT}")
if(_BRLCAD_REPOSITORY_LOCAL)
message(STATUS "BRL-CAD Git acquisition: file transport only")
endif()
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+36 -27
View File
@@ -169,23 +169,26 @@ function(BRLCAD_ADD_TEST NAME test_name COMMAND test_prog)
add_dependencies(check ${_test_dependencies})
endfunction(BRLCAD_ADD_TEST)
# Register a test whose command needs a private X server. Keeping Xmin's
# process setup here lets GUI fixtures concentrate on application behavior and
# gives every caller the same display geometry, timeout, and dependency
# handling. Tests are registered only when the build selected Xmin as its X11
# provider.
function(BRLCAD_ADD_XMIN_TEST)
if(NOT BUILD_TESTING OR NOT BRLCAD_X11_PROVIDER_RESOLVED STREQUAL "XMIN")
# Register a GUI test using the selected display backend. Xmin is currently
# the only backend; its server and control paths stay here so fixtures only
# depend on the GUI test controller contract.
function(BRLCAD_ADD_GUI_TEST)
if(NOT BUILD_TESTING)
return()
endif()
cmake_parse_arguments(PARSE_ARGV 0 XMIN "" "NAME;SCREEN;TIMEOUT"
"COMMAND;ENVIRONMENT;SERVER_ARGS")
if(NOT XMIN_NAME)
message(FATAL_ERROR "BRLCAD_ADD_XMIN_TEST requires NAME")
if(BRLCAD_X11_PROVIDER_RESOLVED STREQUAL "XMIN")
_brlcad_add_xmin_gui_test(${ARGV})
endif()
if(NOT XMIN_COMMAND)
message(FATAL_ERROR "BRLCAD_ADD_XMIN_TEST requires COMMAND")
endfunction()
function(_brlcad_add_xmin_gui_test)
cmake_parse_arguments(PARSE_ARGV 0 GUI "" "NAME;SCREEN;TIMEOUT"
"COMMAND;ENVIRONMENT;SERVER_ARGS")
if(NOT GUI_NAME)
message(FATAL_ERROR "BRLCAD_ADD_GUI_TEST requires NAME")
endif()
if(NOT GUI_COMMAND)
message(FATAL_ERROR "BRLCAD_ADD_GUI_TEST requires COMMAND")
endif()
set(_xmin_server "${Xmin_SERVER_EXECUTABLE}")
@@ -199,36 +202,42 @@ function(BRLCAD_ADD_XMIN_TEST)
find_program(_xmin_run NAMES xmin-run HINTS "${_xmin_bin_dir}" NO_DEFAULT_PATH NO_CACHE)
endif()
if(NOT _xmin_server OR NOT _xmin_run)
message(WARNING "Skipping ${XMIN_NAME}: the selected Xmin SDK does not provide its test runner")
message(WARNING "Skipping ${GUI_NAME}: the selected Xmin SDK does not provide its test runner")
return()
endif()
if(NOT XMIN_SCREEN)
set(XMIN_SCREEN "1280x960x24")
if(NOT GUI_SCREEN)
set(GUI_SCREEN "1280x960x24")
endif()
if(NOT _xmin_bin_dir)
get_filename_component(_xmin_bin_dir "${_xmin_server}" DIRECTORY)
endif()
find_program(_xmin_ctl NAMES xminctl HINTS "${_xmin_bin_dir}"
NO_DEFAULT_PATH NO_CACHE)
set(_xmin_environment "XMIN_SCREEN=${XMIN_SCREEN}" ${XMIN_ENVIRONMENT})
set(_gui_environment
"GUI_TEST_SCREEN=${GUI_SCREEN}"
"XMIN_SCREEN=${GUI_SCREEN}"
${GUI_ENVIRONMENT}
)
if(_xmin_ctl)
list(PREPEND _xmin_environment "XMIN_CTL=${_xmin_ctl}")
list(PREPEND _gui_environment
"GUI_TEST_CTL=${CMAKE_SOURCE_DIR}/regress/xmin/xmin_gui_ctl.sh"
"XMIN_CTL=${_xmin_ctl}"
)
endif()
set(_xmin_command
"${CMAKE_COMMAND}" -E env ${_xmin_environment} ${XMIN_COMMAND}
set(_gui_command
"${CMAKE_COMMAND}" -E env ${_gui_environment} ${GUI_COMMAND}
)
brlcad_add_test(
NAME ${XMIN_NAME}
NAME ${GUI_NAME}
COMMAND "${_xmin_run}" --server "${_xmin_server}"
--screen "${XMIN_SCREEN}" ${XMIN_SERVER_ARGS} -- ${_xmin_command}
--screen "${GUI_SCREEN}" ${GUI_SERVER_ARGS} -- ${_gui_command}
)
if(XMIN_TIMEOUT)
set_tests_properties(${XMIN_NAME} PROPERTIES TIMEOUT "${XMIN_TIMEOUT}")
if(GUI_TIMEOUT)
set_tests_properties(${GUI_NAME} PROPERTIES TIMEOUT "${GUI_TIMEOUT}")
endif()
endfunction(BRLCAD_ADD_XMIN_TEST)
endfunction()
# Local Variables:
# mode: cmake
+1
View File
@@ -15,6 +15,7 @@ set(
BRLCAD_Options.cmake
BRLCAD_Probe_Validation.cmake
BRLCAD_Regress_Util.cmake
BRLCAD_Repository.cmake
BRLCAD_Summary.cmake
BRLCAD_Targets.cmake
BRLCAD_Test_Wrappers.cmake
+31 -1
View File
@@ -95,6 +95,33 @@ add_custom_target(
)
set_target_properties(distcheck-source_archives PROPERTIES FOLDER "BRL-CAD Distribution Checking")
# Dependency paths must survive CMake, build-tool, and shell parsing. Load
# their values from a cache file rather than embedding them in command text.
set(distcheck_dependency_cache "${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp/distcheck_dependencies.cmake")
set(distcheck_dependency_vars BRLCAD_REPOSITORY_ROOT BRLCAD_EXT_DIR)
foreach(distcheck_optional_var BRLCAD_EXT_SOURCE_DIR BRLCAD_EXT_PARALLEL)
if(DEFINED ${distcheck_optional_var})
list(APPEND distcheck_dependency_vars ${distcheck_optional_var})
endif()
endforeach()
file(WRITE "${distcheck_dependency_cache}" "")
foreach(distcheck_var IN LISTS distcheck_dependency_vars)
set(distcheck_value "${${distcheck_var}}")
if(distcheck_var STREQUAL "BRLCAD_REPOSITORY_ROOT")
set(distcheck_value "${_BRLCAD_REPOSITORY_ROOT}")
endif()
set(distcheck_type STRING)
if(distcheck_var MATCHES "_DIR$")
set(distcheck_type PATH)
endif()
string(REPLACE "\\" "\\\\" distcheck_value "${distcheck_value}")
string(REPLACE "\"" "\\\"" distcheck_value "${distcheck_value}")
string(REPLACE "$" "\\$" distcheck_value "${distcheck_value}")
file(APPEND "${distcheck_dependency_cache}"
"set(${distcheck_var} \"${distcheck_value}\" CACHE ${distcheck_type} \"Inherited dependency setting\" FORCE)\n")
endforeach()
distclean("${distcheck_dependency_cache}")
# Utility function for defining individual distcheck targets
macro(
create_distcheck
@@ -120,7 +147,10 @@ macro(
# Need to set these locally so configure_file will pick them up...
set(TARGET_SUFFIX ${TARGET_SUFFIX})
set(CMAKE_OPTS ${CMAKE_OPTS_IN})
# Keep machine-specific settings out of the options saved for CI above.
# The shared cache replaces each variant's unquoted output argument.
string(REPLACE "-DBRLCAD_EXT_DIR=${BRLCAD_EXT_DIR}" "" CMAKE_OPTS "${CMAKE_OPTS_IN}")
string(APPEND CMAKE_OPTS " -C \"${distcheck_dependency_cache}\"")
# For configure_file, need to set these as variables not just input parameters
set(source_dir "${source_dir}")
+6
View File
@@ -1,3 +1,9 @@
brlcad (7.46.0-0) unstable; urgency=low
* update brlcad version
-- Cliff Yapp <cyapp@brlcad.org> Thu, 07 Oct 2026 20:24:00 +0000
brlcad (7.44.0-0) unstable; urgency=low
* update brlcad version
+1 -1
View File
@@ -11,7 +11,7 @@
\f0\i\b\fs72 \cf0 README
\fs36 \
\f1\i0\b0\fs28 This is BRL-CAD 7.44.0 for Mac OS X. Please send any bugs, comments, questions, or suggestions to the project website.\
\f1\i0\b0\fs28 This is BRL-CAD 7.46.0 for Mac OS X. Please send any bugs, comments, questions, or suggestions to the project website.\
\fs22 \
+1 -1
View File
@@ -4,7 +4,7 @@
\margl1440\margr1440\vieww8020\viewh6280\viewkind0
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
\f0\fs22 \cf0 This installer will guide you through the installation of BRL-CAD 7.44.0 for Mac OS X and Darwin.\
\f0\fs22 \cf0 This installer will guide you through the installation of BRL-CAD 7.46.0 for Mac OS X and Darwin.\
\
This distribution of BRL-CAD requires approximately 500 MB of available disk space and does not include source code.\
\
+2 -1
View File
@@ -110,7 +110,8 @@ add_subdirectory(rtedge)
# RtWizard Image Generation Regression Tests
add_subdirectory(rtwizard)
# Shared Xmin GUI test support
# Shared GUI test support and Xmin fixtures
add_subdirectory(gui)
add_subdirectory(xmin)
# per-primitive validity
+14
View File
@@ -117,6 +117,20 @@ if(TARGET libged)
endif(TARGET libged)
if(TARGET librt AND FUZZER_SUPPORTED)
set(RT_EDIT_FUZZ_DIR "${CMAKE_SOURCE_DIR}/src/librt/tests/edit")
brlcad_addexec(
fuzz_rt_edit_test
"${RT_EDIT_FUZZ_DIR}/fuzz.cpp;${RT_EDIT_FUZZ_DIR}/ars.cpp;${RT_EDIT_FUZZ_DIR}/bot.cpp"
"libbu;librt;libnmg;libwdb;libbrep"
TEST
)
set_target_properties(fuzz_rt_edit_test PROPERTIES UNITY_BUILD OFF)
target_compile_options(fuzz_rt_edit_test PRIVATE ${FUZZER_EXE_COMPILE_OPTIONS})
target_link_options(fuzz_rt_edit_test PRIVATE ${FUZZER_LINK_OPTIONS})
BRLCAD_ADD_TEST(NAME fuzz_rt_edit_smoke COMMAND fuzz_rt_edit_test -runs=1 -max_total_time=5)
endif()
cmakefiles(
CMakeLists.txt
fuzz_ged.cpp
+13 -17
View File
@@ -79,7 +79,9 @@ endif(NOT EXISTS \"\${GCV_EXEC}\")\n"
# setup conversion tests
foreach(in_file ${INPUT_FILES})
get_filename_component(curr_in_basename ${in_file} NAME_WLE)
set(out_path "${CMAKE_CURRENT_BINARY_DIR}/conv-${curr_in_basename}")
# Tests in the same directory may run concurrently, so their output paths
# must not overlap.
set(out_path "${CMAKE_CURRENT_BINARY_DIR}/conv-${TARGET_DIRECTION}-${curr_in_basename}")
# need to split suffix so we can distinguish from different converters
if(${fmt}_EXPORTER)
@@ -120,7 +122,7 @@ endif(NOT EXISTS \"\${GCV_EXEC}\")\n"
)
endif(${fmt}_GCV_OPTIONS)
set(out_distclean ${out_distclean}} "${out_path}-${out_fmt}${out_suffix}")
set(out_distclean ${out_distclean} "${out_path}-${out_fmt}${out_suffix}")
set(expected_output_files "${expected_output_files} \"${out_path}-${out_fmt}${out_suffix}\"")
endforeach(out_fmt ${${fmt}_CONVERTERS})
@@ -162,19 +164,8 @@ execute_process(
file(APPEND \"\${LOGFILE}\" \"\${log_msg}\\n\")
unset(log_msg)
"
)
set(OUTPUT_FILES ${OUTPUT_FILES} ${out_distclean})
unset(expected_output_files)
unset(out_distclean)
endforeach(in_file ${INPUT_FILES})
file(
APPEND
${cmake_in_path}
"
# check output files exists and are a reasonable size
# check output files exist and are a reasonable size
foreach(out_file \${ofiles})
if(NOT EXISTS \"\${out_file}\")
file(APPEND \"\${LOGFILE}\" \"FAILURE: \${curr_result}, \${out_file} not found.\")
@@ -191,13 +182,18 @@ foreach(out_file \${ofiles})
file(APPEND \"\${LOGFILE}\" \"FAILURE: \${curr_result} file size is \${file_size} for \${out_file}\\n Expecting ${EXPECTED_FILE_SIZE} with delta ${FILE_SIZE_DELTA}\")
message(FATAL_ERROR \"[gcv] Failure while converting ${in_file}, see \${LOGFILE} for more info.\")
endif(\"\${size_delta}\" GREATER \"${FILE_SIZE_DELTA}\")
endif(NOT EXISTS \"\${out_file}\")\n
endif(NOT EXISTS \"\${out_file}\")
# cleanup file from build dir
file(REMOVE \"\${out_file}\")
endforeach(out_file \${ofiles})
"
)
"
)
set(OUTPUT_FILES ${OUTPUT_FILES} ${out_distclean})
unset(expected_output_files)
unset(out_distclean)
endforeach(in_file ${INPUT_FILES})
# assume the fmt is the gcv dependency unless specified
if(${fmt}_DEPS)
+1 -1
View File
@@ -2,7 +2,7 @@ if(TARGET gcv-assetimport)
gcv_regress_util("gltf" "tetra-gltf2.0.gltf;tetra-glb2.0.glb" DEPS "gcv;gcv-assetimport" GCV_OPTIONS "--input-format=assetimport")
gcv_regress_util("glb" "tetra.g" DEPS "gcv;gcv-assetimport" GCV_OPTIONS "--output-format=assetimport" EXPECTED_FILE_SIZE "1476" EXPORTER)
gcv_regress_util("gltf" "tetra.g" DEPS "gcv;gcv-assetimport" GCV_OPTIONS "--output-format=assetimport" EXPECTED_FILE_SIZE "3356" EXPORTER)
distclean("${CMAKE_CURRENT_BINARY_DIR}/conv-tetra.bin")
distclean("${CMAKE_CURRENT_BINARY_DIR}/conv-regress-g-gltf-tetra.bin")
endif(TARGET gcv-assetimport)
if(TARGET gcv-gltf)
+2 -2
View File
@@ -1,7 +1,7 @@
if(TARGET gcv-assetimport)
set(dep_str DEPS "gcv;gcv-obj;gcv-assetimport" CONVERTERS "assetimport")
distclean("${CMAKE_CURRENT_BINARY_DIR}/conv-tetra-assetimport.mtl") # hard to track companion files
distclean("${CMAKE_CURRENT_BINARY_DIR}/conv-regress-g-obj-tetra-assetimport.mtl") # hard to track companion files
else()
set(dep_str "")
endif(TARGET gcv-assetimport)
@@ -9,7 +9,7 @@ endif(TARGET gcv-assetimport)
gcv_regress_util("obj" "tetra.obj" ${dep_str})
gcv_regress_util("obj_unnamed_group" "tetra-unnamed-group.obj" DEPS "gcv;gcv-obj")
gcv_regress_util("obj" "tetra.g" ${dep_str} EXPORTER)
distclean("${CMAKE_CURRENT_BINARY_DIR}/conv-tetra.mtl")
distclean("${CMAKE_CURRENT_BINARY_DIR}/conv-regress-g-obj-tetra.mtl")
cmakefiles(
CMakeLists.txt
+259 -16
View File
@@ -68,6 +68,13 @@
* ("/tc6_reg.c/sub6.s#sub"), so the lookup missed and no variant was
* applied, leaving the phantom face. After the fix the plan is built
* from region roots so keys match and the phantom face is eliminated.
*
* TC7 - NMG Boolean isolation and output modes: verifies that an interrupted
* worker cannot commit output, then exercises BoT, NMG, region, and
* in-place output paths.
*
* TC8 - implicit solid roots survive the working-database close and remain
* valid members of the imported output hierarchy.
*/
#include "common.h"
@@ -78,7 +85,9 @@
#include <string>
#include "bu/app.h"
#include "bu/env.h"
#include "bu/file.h"
#include "bu/log.h"
#include "bu/malloc.h"
#include "bu/str.h"
#include "bu/vls.h"
@@ -142,6 +151,36 @@ write_comb2(struct rt_wdb *wdbp,
0, 0, 0, 0, 0, 0, 0);
}
static int
write_comb1(struct rt_wdb *wdbp, const char *comb_name, const char *member, int is_region)
{
struct bu_list head;
BU_LIST_INIT(&head);
mk_addmember(member, &head, NULL, WMOP_UNION);
return mk_comb(wdbp, comb_name, &head, is_region, NULL, NULL, NULL,
0, 0, 0, 0, 0, 0, 0);
}
static int
run_facetize_command(const char *gfile, int argc, const char **argv, int verbose)
{
struct ged *gedp = ged_open("db", gfile, 1);
if (!gedp) {
bu_log("[regress_facetize] ged_open(%s) failed\n", gfile);
return BRLCAD_ERROR;
}
int ret = ged_exec(gedp, argc, argv);
if (verbose || ret != BRLCAD_OK) {
const char *log = bu_vls_cstr(gedp->ged_result_str);
if (log && log[0])
bu_log("[facetize] %s\n", log);
}
ged_close(gedp);
return ret;
}
/**
* Open @a gfile with ged_open and run "facetize @a input @a output".
* Returns BRLCAD_OK on success, BRLCAD_ERROR otherwise.
@@ -149,23 +188,8 @@ write_comb2(struct rt_wdb *wdbp,
static int
run_facetize(const char *gfile, const char *input, const char *output, int verbose)
{
struct ged *gedp = ged_open("db", gfile, 1);
if (!gedp) {
bu_log("[regress_facetize] ged_open(%s) failed\n", gfile);
return BRLCAD_ERROR;
}
const char *av[4] = {"facetize", input, output, NULL};
int ret = ged_exec(gedp, 3, av);
if (verbose || ret != BRLCAD_OK) {
const char *log = bu_vls_cstr(gedp->ged_result_str);
if (log && log[0])
bu_log("[facetize] %s\n", log);
}
ged_close(gedp);
return ret;
return run_facetize_command(gfile, 3, av, verbose);
}
/**
@@ -212,6 +236,46 @@ bu_log("[regress_facetize] check_bot: '%s' type %d is not a BoT\n",
return ok;
}
static int
check_object_type(const char *gfile, const char *object_name, int expected_type)
{
struct db_i *dbip = db_open(gfile, DB_OPEN_READONLY);
if (!dbip || db_dirbuild(dbip) < 0) {
if (dbip)
db_close(dbip);
return BRLCAD_ERROR;
}
struct directory *dp = db_lookup(dbip, object_name, LOOKUP_QUIET);
if (!dp) {
bu_log("[regress_facetize] '%s' does not exist\n", object_name);
db_close(dbip);
return BRLCAD_ERROR;
}
struct rt_db_internal intern;
RT_DB_INTERNAL_INIT(&intern);
if (rt_db_get_internal(&intern, dp, dbip, NULL) < 0) {
db_close(dbip);
return BRLCAD_ERROR;
}
int ret = (intern.idb_minor_type == expected_type) ? BRLCAD_OK : BRLCAD_ERROR;
if (ret != BRLCAD_OK)
bu_log("[regress_facetize] '%s' type %d, expected %d\n",
object_name, intern.idb_minor_type, expected_type);
rt_db_free_internal(&intern);
db_close(dbip);
return ret;
}
static int
count_log_hook(void *data, void *UNUSED(message))
{
int *count = (int *)data;
(*count)++;
return 0;
}
/**
* Run rt_crofton_shoot on @a obj_name in @a gfile.
* Stores SA (mm2) and VOL (mm3) in *sa / *vol.
@@ -1120,6 +1184,183 @@ tc6_havoc_wind9_pattern(const char *tmpdir, int verbose)
return BRLCAD_OK;
}
static int
tc7_nmg_modes(const char *tmpdir, int verbose)
{
bu_log("[regress_facetize] TC7: NMG Boolean and output modes...\n");
struct bu_vls gpath = BU_VLS_INIT_ZERO;
bu_vls_printf(&gpath, "%s/tc7_nmg.g", tmpdir);
const char *gfile = bu_vls_cstr(&gpath);
if (bu_file_exists(gfile, NULL))
bu_file_delete(gfile);
struct db_i *dbip = db_create(gfile, 5);
if (!dbip) {
bu_vls_free(&gpath);
return BRLCAD_ERROR;
}
struct rt_wdb *wdbp = wdb_dbopen(dbip, RT_WDB_TYPE_DB_DEFAULT);
point_t box_pts[8] = {
{0.0, 0.0, 0.0}, {10.0, 0.0, 0.0},
{10.0, 10.0, 0.0}, {0.0, 10.0, 0.0},
{0.0, 0.0, 10.0}, {10.0, 0.0, 10.0},
{10.0, 10.0, 10.0}, {0.0, 10.0, 10.0}
};
if (write_arb8(wdbp, "box.s", box_pts) < 0 ||
write_comb1(wdbp, "box.r", "box.s", 1) < 0 ||
write_comb1(wdbp, "box.c", "box.s", 0) < 0) {
wdb_close(wdbp);
bu_vls_free(&gpath);
return BRLCAD_ERROR;
}
wdb_close(wdbp);
const char *bot_av[] = {"facetize", "--nmg-booleval", "box.r", "box.bot", NULL};
const char *fault_av[] = {"facetize", "--nmg-booleval", "box.r", "fault.bot", NULL};
const char *nmg_av[] = {"facetize", "-n", "box.r", "box.nmg", NULL};
const char *regions_av[] = {"facetize", "-r", "--nmg-booleval", "box.r", "box.regions", NULL};
const char *fallback_av[] = {"facetize", "-r", "--nmg-booleval", "box.c", "box-fallback.bot", NULL};
const char *object_in_place_av[] = {"facetize", "--in-place", "--nmg-booleval", "box.c", NULL};
const char *in_place_av[] = {"facetize", "-r", "--in-place", "--nmg-booleval", "box.r", NULL};
int ret = BRLCAD_OK;
auto check_tc7 = [&ret](bool passed, const char *description) {
if (passed)
return;
bu_log("[regress_facetize] TC7: FAIL - %s\n", description);
ret = BRLCAD_ERROR;
};
struct bu_vls fault_path = BU_VLS_INIT_ZERO;
bu_vls_printf(&fault_path, "%s/tc7_nmg_worker.fault", tmpdir);
(void)bu_file_delete(bu_vls_cstr(&fault_path));
(void)bu_setenv("LIBGED_FACETIZE_TEST_FAULT",
"nmg-before-ready:fault.bot", 1);
(void)bu_setenv("LIBGED_FACETIZE_TEST_FAULT_FILE",
bu_vls_cstr(&fault_path), 1);
int fault_ret = run_facetize_command(gfile, 4, fault_av, verbose);
(void)bu_setenv("LIBGED_FACETIZE_TEST_FAULT", "", 1);
(void)bu_setenv("LIBGED_FACETIZE_TEST_FAULT_FILE", "", 1);
check_tc7(fault_ret == BRLCAD_ERROR,
"an interrupted NMG Boolean worker did not report failure");
check_tc7(bu_file_exists(bu_vls_cstr(&fault_path), NULL),
"NMG Boolean worker fault did not trigger");
check_tc7(check_object_type(gfile, "fault.bot", ID_BOT) != BRLCAD_OK,
"an interrupted NMG Boolean worker committed an output");
(void)bu_file_delete(bu_vls_cstr(&fault_path));
bu_vls_free(&fault_path);
int hook_calls = 0;
bu_log_add_hook(count_log_hook, &hook_calls);
int bot_ret = run_facetize_command(gfile, 4, bot_av, verbose);
int hook_calls_before_probe = hook_calls;
bu_log("facetize NMG hook restoration probe\n");
bu_log_delete_hook(count_log_hook, &hook_calls);
check_tc7(bot_ret == BRLCAD_OK, "NMG Boolean BoT command failed");
check_tc7(hook_calls == hook_calls_before_probe + 1,
"temporary log hook was not restored");
check_tc7(check_bot_exists(gfile, "box.bot") == BRLCAD_OK,
"NMG Boolean BoT output is missing");
int nmg_ret = run_facetize_command(gfile, 4, nmg_av, verbose);
check_tc7(nmg_ret == BRLCAD_OK, "NMG output command failed");
check_tc7(check_object_type(gfile, "box.nmg", ID_NMG) == BRLCAD_OK,
"NMG output has the wrong type");
int regions_ret = run_facetize_command(gfile, 5, regions_av, verbose);
check_tc7(regions_ret == BRLCAD_OK, "NMG Boolean region command failed");
check_tc7(check_object_type(gfile, "box.regions", ID_COMBINATION) == BRLCAD_OK,
"NMG Boolean region output is missing");
int fallback_ret = run_facetize_command(gfile, 5, fallback_av, verbose);
check_tc7(fallback_ret == BRLCAD_OK,
"region mode object fallback command failed");
check_tc7(check_bot_exists(gfile, "box-fallback.bot") == BRLCAD_OK,
"region mode object fallback output is missing");
int object_in_place_ret = run_facetize_command(gfile, 4,
object_in_place_av, verbose);
check_tc7(object_in_place_ret == BRLCAD_OK,
"in-place NMG Boolean object command failed");
check_tc7(check_object_type(gfile, "box.c", ID_BOT) == BRLCAD_OK,
"in-place NMG Boolean object has the wrong type");
int in_place_ret = run_facetize_command(gfile, 5, in_place_av, verbose);
check_tc7(in_place_ret == BRLCAD_OK,
"in-place NMG Boolean region command failed");
check_tc7(check_object_type(gfile, "box.r", ID_COMBINATION) == BRLCAD_OK,
"in-place region root has the wrong type");
check_tc7(check_bot_exists(gfile, "box.r.bot") == BRLCAD_OK,
"in-place region BoT output is missing");
bu_log("[regress_facetize] TC7: %s\n", ret == BRLCAD_OK ? "PASS" : "FAIL");
bu_vls_free(&gpath);
return ret;
}
/* ------------------------------------------------------------------ */
/* TC8: implicit root replacement persists across database reopen */
/* ------------------------------------------------------------------ */
static int
tc8_implicit_root_persistence(const char *tmpdir, int verbose)
{
bu_log("[regress_facetize] TC8: implicit root persistence...\n");
struct bu_vls gpath = BU_VLS_INIT_ZERO;
bu_vls_printf(&gpath, "%s/tc8_implicit_root.g", tmpdir);
const char *gfile = bu_vls_cstr(&gpath);
if (bu_file_exists(gfile, NULL))
bu_file_delete(gfile);
struct db_i *dbip = db_create(gfile, 5);
if (!dbip) {
bu_vls_free(&gpath);
return BRLCAD_ERROR;
}
struct rt_wdb *wdbp = wdb_dbopen(dbip, RT_WDB_TYPE_DB_DEFAULT);
point_t region_points[8] = {
{0.0, 0.0, 0.0}, {10.0, 0.0, 0.0},
{10.0, 10.0, 0.0}, {0.0, 10.0, 0.0},
{0.0, 0.0, 10.0}, {10.0, 0.0, 10.0},
{10.0, 10.0, 10.0}, {0.0, 10.0, 10.0}
};
point_t loose_points[8] = {
{20.0, 0.0, 0.0}, {30.0, 0.0, 0.0},
{30.0, 10.0, 0.0}, {20.0, 10.0, 0.0},
{20.0, 0.0, 10.0}, {30.0, 0.0, 10.0},
{30.0, 10.0, 10.0}, {20.0, 10.0, 10.0}
};
if (!wdbp || write_arb8(wdbp, "region.s", region_points) < 0 ||
write_arb8(wdbp, "loose.s", loose_points) < 0 ||
write_comb1(wdbp, "box.r", "region.s", 1) < 0 ||
write_comb2(wdbp, "assembly.c", "box.r", 'u',
"loose.s", 'u') < 0) {
if (wdbp)
wdb_close(wdbp);
bu_vls_free(&gpath);
return BRLCAD_ERROR;
}
wdb_close(wdbp);
const char *facetize_args[] = {
"facetize", "-r", "assembly.c", "assembly.regions", NULL
};
int ret = run_facetize_command(gfile, 4, facetize_args, verbose);
if (ret == BRLCAD_OK &&
(check_object_type(gfile, "assembly.regions", ID_COMBINATION) != BRLCAD_OK ||
check_object_type(gfile, "facetize_assembly.c", ID_COMBINATION) != BRLCAD_OK ||
check_bot_exists(gfile, "box.r.bot") != BRLCAD_OK ||
check_bot_exists(gfile, "facetize_loose.s") != BRLCAD_OK))
ret = BRLCAD_ERROR;
bu_log("[regress_facetize] TC8: %s\n",
ret == BRLCAD_OK ? "PASS" : "FAIL");
bu_vls_free(&gpath);
return ret;
}
/* ------------------------------------------------------------------ */
/* main */
/* ------------------------------------------------------------------ */
@@ -1151,6 +1392,8 @@ return 1;
if (tc4_havoc_reuse(tmpdir, verbose) != BRLCAD_OK) ret = 1;
if (tc5_near_coplanar_subTOL(tmpdir, verbose) != BRLCAD_OK) ret = 1;
if (tc6_havoc_wind9_pattern(tmpdir, verbose) != BRLCAD_OK) ret = 1;
if (tc7_nmg_modes(tmpdir, verbose) != BRLCAD_OK) ret = 1;
if (tc8_implicit_root_persistence(tmpdir, verbose) != BRLCAD_OK) ret = 1;
if (ret == 0)
bu_log("[regress_facetize] All tests PASSED\n");
+1
View File
@@ -23,6 +23,7 @@ set(
gqa.mass_mix.am.out
gqa.mass_mix.aw.out
gqa.mass_mix.u0.out
gqa.missing_density.out
gqa.mged
gqa.overlaps.plot3
gqa.sphere_adaptive.out
+24
View File
@@ -67,6 +67,11 @@ run_capture ( ) {
return $ret
}
expect_failure ( ) {
"$@"
test $? -ne 0
}
extract_last_number ( ) {
label="$1"
file="$2"
@@ -101,6 +106,19 @@ assert_close ( ) {
fi
}
assert_contains ( ) {
expected="$1"
file="$2"
desc="$3"
if grep -F -q "$expected" "$file" ; then
log "PASS: $desc"
else
log "FAIL: $desc"
STATUS="`expr $STATUS + 1`"
fi
}
MGED="`ensearch mged`"
if test ! -f "$MGED" ; then
log "Unable to find mged, aborting"
@@ -177,6 +195,10 @@ adjust mass_air.r GIFTmater 2
g mass_air_only.g mass_air.r
g mass_air_mix.g mass_solid.r mass_air.r
in missing_density.s rpp 2 3 0 1 0 1
r missing_density.r u missing_density.s
adjust missing_density.r GIFTmater 123
in sphere.s sph 0 0 0 1
r sphere.r u sphere.s
adjust sphere.r GIFTmater 5
@@ -243,6 +265,7 @@ run_capture gqa.mass_mix.aw.out $GQABIN -u m,m^3,kg -g 250mm-50mm -Aw gqa.g mass
run_capture gqa.mass_mix.am.out $GQABIN -u m,m^3,kg -g 250mm-50mm -Am gqa.g mass_air_mix.g
run_capture gqa.mass_mix.u0.out $GQABIN -u m,m^3,kg -g 250mm-50mm -U 0 -Aw gqa.g mass_air_mix.g
run_capture gqa.sphere_adaptive.out $GQABIN -u m,m^3,kg -q -Av -g 0.05m gqa.g sphere.r
run_capture gqa.missing_density.out expect_failure $GQABIN -u m,m^3,kg -g 250mm-50mm -f density_table.txt -Aw gqa.g missing_density.r
MASS_AIR_AW="`extract_last_number 'Average total weight:' gqa.mass_air.aw.out`"
MASS_AIR_AM="`extract_last_number 'Average total weight:' gqa.mass_air.am.out`"
@@ -257,6 +280,7 @@ assert_close 1001 "$MASS_MIX_AW" 0.001 "mixed solid+air modeled weight with -Aw"
assert_close "$MASS_MIX_AW" "$MASS_MIX_AM" 0.001 "-Aw and -Am agree on mixed modeled air"
assert_close 1000 "$MASS_MIX_U0" 0.001 "-U 0 excludes modeled air from weight"
assert_close 4.18879 "$SPHERE_VOLUME" 0.01 "adaptive sphere volume refines beyond symmetric first pass"
assert_contains "Density 123 on region /missing_density.r is not defined in the density table." gqa.missing_density.out "undefined density produces an error"
if [ $STATUS = 0 ] ; then
+17
View File
@@ -0,0 +1,17 @@
cmakefiles(
CMakeLists.txt
README.md
gui_test.sh
gui_smoke.sh
gui_tcl_test.sh
gui_test.tcl
gui_test_core.tcl
sketch_test.tcl
)
# Local Variables:
# mode: cmake
# tab-width: 2
# indent-tabs-mode: nil
# End:
# ex: shiftwidth=2 tabstop=8
+39
View File
@@ -0,0 +1,39 @@
# GUI regression support
The shared support has three layers:
1. `brlcad_add_gui_test` registers a test and delegates session setup to the
selected backend.
2. `GUI_TEST_CTL` is the window-control interface supplied by the backend.
3. `gui_test.sh`, `gui_smoke.sh`, `gui_tcl_test.sh`, and `gui_test.tcl` provide
shell and Tcl helpers for application lifecycle, artifacts, window input,
screen comparisons, widgets, menus, and asynchronous Tcl errors.
Application fixtures own their semantic oracles. `sketch_test.tcl` contains
shared sketch assertions used by Archer and MGED. The core helpers do not
encode application menus, object models, or screen layouts.
## Controller contract
The controller takes one command followed by arguments:
| Command | Result |
| --- | --- |
| `wait-window --timeout milliseconds title` | Return an opaque window token. |
| `geometry token` | Print `x y width height`. |
| `activate token`, `close token` | Control the identified window. |
| `click [--delay milliseconds] token x y button`, `mouse-move token x y`, `button button down|up` | Send pointer input. |
| `key name`, `type text` | Send keyboard input. |
| `wait-stable --quiet milliseconds --timeout milliseconds token` | Wait for visual quiescence. |
| `capture-screen path` | Write a binary PPM of the composed screen. |
| `screen-geometry` | Print `width height`. |
`root` denotes screen coordinates. Tk fixtures publish `winfo id` values as
window tokens and widget-local points as coordinates. The backend resolves
the tokens; fixtures do not interpret their representation. Capture and
screen geometry must describe the same screen so root-coordinate cropping is
consistent.
The only implemented backend is Xmin. See [its fixtures](../xmin/README.md)
for setup and test coverage. A native backend will also need a CMake session
provider and working display/input permissions on its runner.
+88
View File
@@ -0,0 +1,88 @@
#!/bin/sh
set -eu
: "${GUI_TEST_SHELL:?GUI_TEST_SHELL is required}"
. "$GUI_TEST_SHELL"
gui_stop_app()
{
if [ -n "${GUI_APP_PID:-}" ] && kill -0 "$GUI_APP_PID" 2>/dev/null; then
kill "$GUI_APP_PID" >/dev/null 2>&1 || true
fi
}
if [ "$#" -lt 2 ]; then
echo "Usage: $0 expected-window executable [argument ...]" >&2
exit 2
fi
: "${GUI_TEST_CTL:?GUI_TEST_CTL is required}"
expected_window=$1
shift
application=$1
shift
gui_require_executable "$GUI_TEST_CTL"
gui_require_executable "$application"
GUI_ARTIFACT_DIR=$(mktemp -d "${TMPDIR:-/tmp}/brlcad-gui-smoke.XXXXXX")
export GUI_ARTIFACT_DIR
GUI_APP_LOG="$GUI_ARTIFACT_DIR/application.log"
export GUI_APP_LOG
trap gui_stop_app EXIT INT TERM
"$application" "$@" >"$GUI_APP_LOG" 2>&1 &
GUI_APP_PID=$!
export GUI_APP_PID
if ! window_id=$("$GUI_TEST_CTL" wait-window --timeout "$GUI_WAIT_TIMEOUT_MS" \
"$expected_window"); then
gui_fail "window did not appear: $expected_window"
fi
if ! kill -0 "$GUI_APP_PID" 2>/dev/null; then
"$GUI_TEST_CTL" wait-stable --quiet "$GUI_STABLE_QUIET_MS" \
--timeout "$GUI_STABLE_TIMEOUT_MS" "$window_id" >/dev/null 2>&1 || true
gui_fail "application exited before its window could be tested"
fi
"$GUI_TEST_CTL" activate "$window_id"
if ! geometry=$(gui_wait_for_minimum_geometry "$window_id" \
"$GUI_MIN_WINDOW_WIDTH" "$GUI_MIN_WINDOW_HEIGHT"); then
gui_fail "window did not reach a usable geometry: $expected_window ($geometry)"
fi
gui_capture_screen "$window_id" "$GUI_ARTIFACT_DIR/before.ppm"
if [ -n "${GUI_SMOKE_ACTION:-}" ]; then
gui_require_executable "$GUI_SMOKE_ACTION"
"$GUI_SMOKE_ACTION" "$window_id" "$GUI_ARTIFACT_DIR"
if [ "${GUI_MIN_CHANGED_BYTES:-0}" -gt 0 ]; then
gui_wait_for_image_difference "$GUI_ARTIFACT_DIR/before.ppm" \
"$GUI_ARTIFACT_DIR/after.ppm" "$GUI_MIN_CHANGED_BYTES" \
"$window_id"
else
gui_capture_screen "$window_id" "$GUI_ARTIFACT_DIR/after.ppm"
fi
fi
"$GUI_TEST_CTL" close "$window_id"
wait "$GUI_APP_PID"
GUI_APP_PID=
if [ "${GUI_KEEP_ARTIFACTS:-0}" -eq 1 ]; then
echo "GUI smoke artifacts: $GUI_ARTIFACT_DIR"
else
"${CMAKE_COMMAND:-cmake}" -E remove_directory "$GUI_ARTIFACT_DIR"
fi
echo "PASS: $expected_window launched, rendered, and closed"
# Local Variables:
# tab-width: 8
# mode: sh
# sh-indentation: 4
# sh-basic-offset: 4
# indent-tabs-mode: t
# End:
# ex: shiftwidth=4 tabstop=8 cino=N-s
+60
View File
@@ -0,0 +1,60 @@
#!/bin/sh
set -eu
: "${GUI_TEST_SHELL:?GUI_TEST_SHELL is required}"
. "$GUI_TEST_SHELL"
if [ "$#" -lt 2 ]; then
echo "Usage: $0 test-name executable [argument ...]" >&2
exit 2
fi
test_name=$1
shift
test_program=$1
gui_require_executable "$test_program"
GUI_TEST_DIR=$(mktemp -d "${TMPDIR:-/tmp}/brlcad-gui-${test_name}.XXXXXX")
export GUI_TEST_DIR
gui_tcl_test_cleanup()
{
if [ "${GUI_KEEP_ARTIFACTS:-0}" -eq 0 ]; then
"${CMAKE_COMMAND:-cmake}" -E remove_directory "$GUI_TEST_DIR"
fi
}
trap 'exit 1' INT TERM
if ! "$@"; then
echo "GUI test artifacts: $GUI_TEST_DIR" >&2
exit 1
fi
if [ -s "$GUI_TEST_DIR/result" ]; then
test_result=$(sed -n '1p' "$GUI_TEST_DIR/result")
case "$test_result" in
PASS:*) ;;
*)
echo "$test_result" >&2
echo "GUI test artifacts: $GUI_TEST_DIR" >&2
exit 1
;;
esac
fi
if [ "${GUI_KEEP_ARTIFACTS:-0}" -eq 1 ]; then
echo "GUI test artifacts: $GUI_TEST_DIR"
else
gui_tcl_test_cleanup
fi
# Local Variables:
# tab-width: 8
# mode: sh
# sh-indentation: 4
# sh-basic-offset: 4
# indent-tabs-mode: t
# End:
# ex: shiftwidth=4 tabstop=8 cino=N-s
+156
View File
@@ -0,0 +1,156 @@
#!/bin/sh
GUI_WAIT_TIMEOUT_MS=${GUI_WAIT_TIMEOUT_MS:-30000}
GUI_STABLE_QUIET_MS=${GUI_STABLE_QUIET_MS:-200}
GUI_STABLE_TIMEOUT_MS=${GUI_STABLE_TIMEOUT_MS:-5000}
GUI_POLL_SECONDS=${GUI_POLL_SECONDS:-0.05}
GUI_MIN_WINDOW_WIDTH=${GUI_MIN_WINDOW_WIDTH:-200}
GUI_MIN_WINDOW_HEIGHT=${GUI_MIN_WINDOW_HEIGHT:-150}
gui_fail()
{
echo "FAIL: $1" >&2
if [ -n "${GUI_APP_LOG:-}" ] && [ -f "$GUI_APP_LOG" ]; then
sed -n '1,240p' "$GUI_APP_LOG" >&2
fi
exit 1
}
gui_require_executable()
{
if [ ! -x "$1" ]; then
gui_fail "required executable is unavailable: $1"
fi
}
gui_wait_for_minimum_geometry()
{
window=$1
minimum_width=$2
minimum_height=$3
timeout_seconds=$(((GUI_WAIT_TIMEOUT_MS + 999) / 1000))
start_time=$(date +%s)
while :; do
geometry=$("$GUI_TEST_CTL" geometry "$window") || return 1
set -- $geometry
if [ "$#" -ge 4 ]; then
width=$3
height=$4
if [ "$width" -ge "$minimum_width" ] &&
[ "$height" -ge "$minimum_height" ]; then
echo "$geometry"
return 0
fi
fi
current_time=$(date +%s)
if [ $((current_time - start_time)) -ge "$timeout_seconds" ]; then
echo "$geometry"
return 1
fi
sleep "$GUI_POLL_SECONDS"
done
}
gui_capture_screen()
{
window=$1
output=$2
"$GUI_TEST_CTL" wait-stable --quiet "$GUI_STABLE_QUIET_MS" \
--timeout "$GUI_STABLE_TIMEOUT_MS" "$window" >/dev/null 2>&1 || true
# Tk and Qt compose child windows into the root; a top-level-only capture
# can therefore contain just the parent's cleared backing surface.
"$GUI_TEST_CTL" capture-screen "$output" ||
gui_fail "could not capture the GUI test screen"
if [ "$(sed -n '1p' "$output")" != "P6" ]; then
gui_fail "screen capture is not a binary PPM image: $output"
fi
nonzero_bytes=$(LC_ALL=C tr -d '\000' < "$output" | wc -c | tr -d ' ')
if [ "$nonzero_bytes" -lt 1024 ]; then
gui_fail "screen capture contains no meaningful rendered content"
fi
}
gui_count_changed_bytes()
{
first=$1
second=$2
minimum=$3
# Stop once the threshold is reached. Full root captures are large, and
# their exact total difference is immaterial to this binary assertion.
changed_bytes=$(cmp -l "$first" "$second" | awk -v minimum="$minimum" \
'NR >= minimum { print NR; exit }
END { if (NR < minimum) print NR }')
echo "$changed_bytes"
}
gui_wait_for_image_difference()
{
first=$1
second=$2
minimum=$3
window=$4
timeout_seconds=$(((GUI_WAIT_TIMEOUT_MS + 999) / 1000))
start_time=$(date +%s)
if [ ! -s "$first" ]; then
gui_fail "cannot compare a missing or empty GUI capture: $first"
fi
while :; do
gui_capture_screen "$window" "$second"
changed_bytes=$(gui_count_changed_bytes "$first" "$second" "$minimum")
if [ "$changed_bytes" -ge "$minimum" ]; then
return 0
fi
current_time=$(date +%s)
if [ $((current_time - start_time)) -ge "$timeout_seconds" ]; then
gui_fail "GUI captures changed by only $changed_bytes bytes; expected at least $minimum"
fi
sleep "$GUI_POLL_SECONDS"
done
}
# Capture a root-coordinate region of the screen as PPM. The conversion
# commands preserve the image comparison format used by the MGED fixture.
gui_capture_region()
(
output=$1
x=$2
y=$3
width=$4
height=$5
root_capture=${output%.ppm}-root.ppm
root_pixels=${output%.ppm}-root.pix
cropped_pixels=${output%.ppm}-cropped.pix
geometry=$("$GUI_TEST_CTL" screen-geometry) || exit 1
set -- $geometry
screen_width=$1
screen_height=$2
lower_y=$((screen_height - y - height))
upper_y=$((lower_y + height - 1))
right_x=$((x + width - 1))
"$GUI_TEST_CTL" wait-stable --quiet "$GUI_STABLE_QUIET_MS" \
--timeout "$GUI_STABLE_TIMEOUT_MS" root >/dev/null 2>&1 || true
"$GUI_TEST_CTL" capture-screen "$root_capture" || exit 1
"$ICV_BIN" "$root_capture" "$root_pixels" >/dev/null 2>&1 || exit 1
"$PIXCROP_BIN" "$root_pixels" "$cropped_pixels" \
"$screen_width" "$width" "$height" \
"$x" "$upper_y" "$right_x" "$upper_y" \
"$right_x" "$lower_y" "$x" "$lower_y" >/dev/null 2>&1 || exit 1
"$ICV_BIN" -w "$width" -n "$height" \
"$cropped_pixels" "$output" >/dev/null 2>&1 || exit 1
rm -f "$root_capture" "$root_pixels" "$cropped_pixels"
)
# Local Variables:
# tab-width: 8
# mode: sh
# sh-indentation: 4
# sh-basic-offset: 4
# indent-tabs-mode: t
# End:
# ex: shiftwidth=4 tabstop=8 cino=N-s
@@ -1,4 +1,4 @@
# X M I N _ G U I _ T E S T . T C L
# G U I _ T E S T . T C L
# BRL-CAD
#
# Copyright (c) 2026 United States Government as represented by
@@ -18,14 +18,14 @@
# information.
#
###
source [file join [file dirname [info script]] xmin_test.tcl]
source [file join [file dirname [info script]] gui_test_core.tcl]
namespace eval ::xmin::test {
namespace eval ::gui::test {
variable background_errors {}
variable numeric_tolerance 1.0e-12
}
proc ::xmin::test::record_background_error {message} {
proc ::gui::test::record_background_error {message} {
variable background_errors
set error_info ""
set error_code ""
@@ -38,15 +38,15 @@ proc ::xmin::test::record_background_error {message} {
lappend background_errors [list $message $error_info $error_code]
}
proc ::xmin::test::capture_background_errors {} {
proc ::gui::test::capture_background_errors {} {
variable background_errors
set background_errors {}
proc ::bgerror {message} {
::xmin::test::record_background_error $message
::gui::test::record_background_error $message
}
}
proc ::xmin::test::require_no_background_errors {} {
proc ::gui::test::require_no_background_errors {} {
variable background_errors
if {[llength $background_errors] == 0} {
return
@@ -66,7 +66,7 @@ proc ::xmin::test::require_no_background_errors {} {
error "background Tcl error(s):\n[join $report \n]"
}
proc ::xmin::test::check_background_errors {status message} {
proc ::gui::test::check_background_errors {status message} {
if {$status == 0 &&
[catch {require_no_background_errors} background_error]} {
return [list 1 "FAIL: $background_error"]
@@ -74,13 +74,13 @@ proc ::xmin::test::check_background_errors {status message} {
return [list $status $message]
}
proc ::xmin::test::require {condition message} {
proc ::gui::test::require {condition message} {
if {![uplevel 1 [list expr $condition]]} {
error $message
}
}
proc ::xmin::test::equivalent_values {first second} {
proc ::gui::test::equivalent_values {first second} {
variable numeric_tolerance
if {$first eq $second} {
return 1
@@ -103,7 +103,7 @@ proc ::xmin::test::equivalent_values {first second} {
return 1
}
proc ::xmin::test::widget_inventory {root} {
proc ::gui::test::widget_inventory {root} {
set counts {}
foreach widget [linsert [descendants $root] 0 $root] {
set class [winfo class $widget]
@@ -118,7 +118,7 @@ proc ::xmin::test::widget_inventory {root} {
return [join [lsort -dictionary $inventory] "\n"]
}
proc ::xmin::test::menu_inventory_walk {menu path inventory_name visited_name} {
proc ::gui::test::menu_inventory_walk {menu path inventory_name visited_name} {
upvar 1 $inventory_name inventory $visited_name visited
if {[dict exists $visited $menu]} {
return
@@ -147,7 +147,7 @@ proc ::xmin::test::menu_inventory_walk {menu path inventory_name visited_name} {
}
}
proc ::xmin::test::menu_roots {root} {
proc ::gui::test::menu_roots {root} {
set roots {}
if {![catch {set menu [$root cget -menu]}] &&
$menu ne "" && [winfo exists $menu]} {
@@ -177,7 +177,7 @@ proc ::xmin::test::menu_roots {root} {
return $roots
}
proc ::xmin::test::menu_inventory {root} {
proc ::gui::test::menu_inventory {root} {
set inventory {}
set visited {}
foreach menu_root [menu_roots $root] {
@@ -191,7 +191,7 @@ proc ::xmin::test::menu_inventory {root} {
return [join [lsort -dictionary -unique $inventory] "\n"]
}
proc ::xmin::test::find_menu_entry {root labels} {
proc ::gui::test::find_menu_entry {root labels} {
set menu ""
set remaining [lrange $labels 1 end]
foreach menu_root [menu_roots $root] {
@@ -237,7 +237,7 @@ proc ::xmin::test::find_menu_entry {root labels} {
return $found
}
proc ::xmin::test::invoke_menu_entry {root labels} {
proc ::gui::test::invoke_menu_entry {root labels} {
set entry [find_menu_entry $root $labels]
if {$entry eq ""} {
error "menu entry not found: [join $labels { > }]"
@@ -249,75 +249,6 @@ proc ::xmin::test::invoke_menu_entry {root labels} {
$menu invoke $index
}
proc ::xmin::test::sketch_editor_stub {command args} {
switch -- $command {
get_scale {
return 1.0
}
get_vlist {
return {{0 0} {10 0} {5 5}}
}
set_radius {
return
}
default {
error "unexpected sketch editor command: $command"
}
}
}
proc ::xmin::test::require_unit_vector {vector description} {
lassign $vector x y
set magnitude [expr {sqrt($x * $x + $y * $y)}]
require {abs($magnitude - 1.0) < 1.0e-9} "$description is not a unit vector: $vector"
}
proc ::xmin::test::exercise_sketch_segments {
arc_class bezier_class application object_namespace
} {
set canvas .xmin_sketch_segments
catch {destroy $canvas}
canvas $canvas
set editor ::xmin::test::sketch_editor_stub
set arc ${object_namespace}::arc_probe
$arc_class $arc $editor $canvas {S 0 E 1 R 10 L 0 O 0}
set start_tangent [$arc get_tangent_at_vertex 0]
set end_tangent [$arc get_tangent_at_vertex 1]
require_unit_vector $start_tangent "$application sketch arc start tangent"
require_unit_vector $end_tangent "$application sketch arc end tangent"
require {[$arc get_tangent_at_vertex 2] eq "0 0"} "$application sketch arc returned a tangent for an unrelated vertex"
$arc draw {}
require {[llength [$canvas find all]] == 1} "$application sketch arc did not draw on its canvas"
$arc reverse_orientation
set reversed_tangent [$arc get_tangent_at_vertex 0]
lassign $start_tangent sx sy
lassign $reversed_tangent rx ry
require {
abs($sx + $rx) < 1.0e-9 && abs($sy + $ry) < 1.0e-9
} "$application sketch arc orientation did not reverse its tangent"
::itcl::delete object $arc
set circle ${object_namespace}::circle_probe
$arc_class $circle $editor $canvas {S 0 E 1 R -1 L 0 O 0}
require_unit_vector [$circle get_tangent_at_vertex 0] "$application full-circle tangent"
require {[$circle get_tangent_at_vertex 1] eq "0 0"} "$application full circle reported a tangent at its center"
::itcl::delete object $circle
set bezier ${object_namespace}::bezier_probe
set item_count [llength [$canvas find all]]
$bezier_class $bezier $editor $canvas {D 2 P {0 2 1}}
$bezier draw {}
require {
[llength [$canvas find all]] == $item_count + 1
} "$application sketch Bezier did not draw on its canvas"
require {
[string match {*bezier D 2 P*} [$bezier serialize 1.0]]
} "$application sketch Bezier did not serialize its control points"
::itcl::delete object $bezier
destroy $canvas
}
# Local Variables:
# mode: Tcl
# tab-width: 8
@@ -1,4 +1,4 @@
# X M I N _ T E S T . T C L
# G U I _ T E S T _ C O R E . T C L
# BRL-CAD
#
# Copyright (c) 2026 United States Government as represented by
@@ -18,15 +18,15 @@
# information.
#
###
namespace eval ::xmin::test {
namespace eval ::gui::test {
variable directory
if {![info exists ::env(XMIN_TEST_DIR)]} {
error "XMIN_TEST_DIR is required"
if {![info exists ::env(GUI_TEST_DIR)]} {
error "GUI_TEST_DIR is required"
}
set directory $::env(XMIN_TEST_DIR)
set directory $::env(GUI_TEST_DIR)
}
proc ::xmin::test::write {name contents} {
proc ::gui::test::write {name contents} {
variable directory
set destination [file join $directory $name]
set temporary ${destination}.tmp
@@ -36,14 +36,14 @@ proc ::xmin::test::write {name contents} {
file rename -force $temporary $destination
}
proc ::xmin::test::publish_target {name widget} {
proc ::gui::test::publish_target {name widget} {
write ${name}_window [winfo id $widget]
write $name [list \
[expr {[winfo width $widget] / 2}] \
[expr {[winfo height $widget] / 2}]]
}
proc ::xmin::test::descendants {widget} {
proc ::gui::test::descendants {widget} {
set descendants {}
foreach child [winfo children $widget] {
lappend descendants $child
@@ -52,7 +52,7 @@ proc ::xmin::test::descendants {widget} {
return $descendants
}
proc ::xmin::test::find_widget {root class text} {
proc ::gui::test::find_widget {root class text} {
foreach widget [descendants $root] {
if {[winfo class $widget] ne $class ||
[catch {set widget_text [$widget cget -text]}] ||
+96
View File
@@ -0,0 +1,96 @@
# S K E T C H _ T E S T . T C L
# BRL-CAD
#
# Copyright (c) 2026 United States Government as represented by
# the U.S. Army Research Laboratory.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# version 2.1 as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this file; see the file named COPYING for more
# information.
#
###
# Shared sketch segment checks used by Archer and MGED.
proc ::gui::test::sketch_editor_stub {command args} {
switch -- $command {
get_scale {
return 1.0
}
get_vlist {
return {{0 0} {10 0} {5 5}}
}
set_radius {
return
}
default {
error "unexpected sketch editor command: $command"
}
}
}
proc ::gui::test::require_unit_vector {vector description} {
lassign $vector x y
set magnitude [expr {sqrt($x * $x + $y * $y)}]
require {abs($magnitude - 1.0) < 1.0e-9} "$description is not a unit vector: $vector"
}
proc ::gui::test::exercise_sketch_segments {
arc_class bezier_class application object_namespace
} {
set canvas .gui_sketch_segments
catch {destroy $canvas}
canvas $canvas
set editor ::gui::test::sketch_editor_stub
set arc ${object_namespace}::arc_probe
$arc_class $arc $editor $canvas {S 0 E 1 R 10 L 0 O 0}
set start_tangent [$arc get_tangent_at_vertex 0]
set end_tangent [$arc get_tangent_at_vertex 1]
require_unit_vector $start_tangent "$application sketch arc start tangent"
require_unit_vector $end_tangent "$application sketch arc end tangent"
require {[$arc get_tangent_at_vertex 2] eq "0 0"} "$application sketch arc returned a tangent for an unrelated vertex"
$arc draw {}
require {[llength [$canvas find all]] == 1} "$application sketch arc did not draw on its canvas"
$arc reverse_orientation
set reversed_tangent [$arc get_tangent_at_vertex 0]
lassign $start_tangent sx sy
lassign $reversed_tangent rx ry
require {
abs($sx + $rx) < 1.0e-9 && abs($sy + $ry) < 1.0e-9
} "$application sketch arc orientation did not reverse its tangent"
::itcl::delete object $arc
set circle ${object_namespace}::circle_probe
$arc_class $circle $editor $canvas {S 0 E 1 R -1 L 0 O 0}
require_unit_vector [$circle get_tangent_at_vertex 0] "$application full-circle tangent"
require {[$circle get_tangent_at_vertex 1] eq "0 0"} "$application full circle reported a tangent at its center"
::itcl::delete object $circle
set bezier ${object_namespace}::bezier_probe
set item_count [llength [$canvas find all]]
$bezier_class $bezier $editor $canvas {D 2 P {0 2 1}}
$bezier draw {}
require {
[llength [$canvas find all]] == $item_count + 1
} "$application sketch Bezier did not draw on its canvas"
require {
[string match {*bezier D 2 P*} [$bezier serialize 1.0]]
} "$application sketch Bezier did not serialize its control points"
::itcl::delete object $bezier
destroy $canvas
}
# Local Variables:
# mode: Tcl
# tab-width: 8
# indent-tabs-mode: t
# End:
+13
View File
@@ -68,6 +68,7 @@ set(
sca_view.mged
search_exec.mged
sed.mged
sed_reset.mged
set_perspective.mged
setview.mged
size.mged
@@ -100,6 +101,7 @@ if(TARGET mged)
continue()
endif(TNAME STREQUAL "")
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${testfile}")
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/${testfile}" TEST_CONTENTS)
if(TNAME STREQUAL "search_exec")
string(CONFIGURE "${TEST_CONTENTS}" TEST_CONTENTS @ONLY)
@@ -126,6 +128,12 @@ if(TARGET mged)
elseif(TNAME STREQUAL "arb")
set(TEST_EXPECT "'arb' testing completed")
set(TEST_SOURCE "${CMAKE_CURRENT_BINARY_DIR}/regress_${testfile}")
elseif(TNAME MATCHES "^(extrude|facedef|mirface|permute)$")
set(TEST_EXPECT "'${TNAME}' testing completed")
set(TEST_SOURCE "${CMAKE_CURRENT_BINARY_DIR}/regress_${testfile}")
elseif(TNAME STREQUAL "edgedir")
set(TEST_EXPECT "'edarb edgedir' testing completed")
set(TEST_SOURCE "${CMAKE_CURRENT_BINARY_DIR}/regress_${testfile}")
elseif(TNAME STREQUAL "killtree")
set(TEST_EXPECT "KILL Solid: killtree_dup.s")
set(TEST_REJECT "db_lookup(killtree_dup.s) failed")
@@ -138,6 +146,10 @@ if(TARGET mged)
elseif(TNAME STREQUAL "prim_edit")
set(TEST_EXPECT "Primitive parameter editing testing completed")
set(TEST_REJECT "FAIL:")
elseif(TNAME STREQUAL "sed_reset")
set(TEST_EXPECT "PASS: 'sed_reset' testing completed")
set(TEST_REJECT "FAIL:")
set(TEST_SOURCE "${CMAKE_CURRENT_BINARY_DIR}/regress_${testfile}")
elseif(TNAME STREQUAL "overlap_plotting")
set(TEST_DB "${CMAKE_SOURCE_DIR}/src/libged/tests/ged_tests.g")
set(TEST_EXPECT "PASS overlap plotting")
@@ -187,6 +199,7 @@ distclean(${mged_outfiles})
cmakefiles(
CMakeLists.txt
csg_edit.mged
mged.tcl
regression_resources.tcl
search_exec_procs.tcl
+31
View File
@@ -119,4 +119,35 @@ if {![catch {get $invalid_inner}]} {
}
# ARBN uses one independent thickness per plane. Exercise unequal offsets so
# the test also verifies the plane ordering and inward normal convention.
set arbn_outer inside_arbn_outer.s
set arbn_inner inside_arbn_inner.s
set arbn_thicknesses {1 2 3 4 1.5 0.5}
in $arbn_outer arbn 6 \
1 0 0 10 -1 0 0 0 \
0 1 0 10 0 -1 0 0 \
0 0 1 10 0 0 -1 0
if {[catch {inside $arbn_outer $arbn_inner {*}$arbn_thicknesses} result]} {
error "inside failed for ARBN: $result"
}
set arbn_definition [get $arbn_inner]
set expected_offsets {9 -2 7 -4 8.5 -0.5}
for {set plane 0} {$plane < 6} {incr plane} {
set equation [lindex $arbn_definition [expr {4 + 2 * $plane}]]
set actual_offset [lindex $equation 3]
if {abs($actual_offset - [lindex $expected_offsets $plane]) > $plane_tolerance} {
error "ARBN inside plane $plane has offset $actual_offset: $arbn_definition"
}
}
facetize -n inside_arbn_inner_nmg.s $arbn_inner
set invalid_arbn_inner inside_arbn_invalid.s
if {![catch {inside $arbn_outer $invalid_arbn_inner {*}[lrepeat 6 6]}]} {
error "ARBN inside accepted thicknesses that collapse the solid"
}
if {![catch {get $invalid_arbn_inner}]} {
error "ARBN inside wrote an invalid collapsed solid"
}
puts "*** 'arb' testing completed ***"
+406
View File
@@ -962,8 +962,140 @@ foreach test [list \
csg_matrix_mouse_check {*}$test
}
puts "--- Repeated graphical object transforms ---"
proc csg_matrix_repeated_mouse_check {} {
global orig_gui transform csg_mouse_dm_pixels csg_mouse_view_size
global csg_drag_scale
set prim csg_matrix_repeat.s
set inner csg_matrix_repeat_inner.c
set outer csg_matrix_repeat_outer.c
set saved_orig_gui $orig_gui
set expected [csg_edit_identity_matrix]
set failed [catch {
in $prim sph 0 0 0 10
comb $inner u $prim
comb $outer u $inner
set orig_gui 0
for {set step 0} {$step < 16} {incr step} {
e $outer
center 0 0 0
size $csg_mouse_view_size
setview 0 0 0
dm size $csg_mouse_dm_pixels $csg_mouse_dm_pixels
_mged_press oill
_mged_ill -e -i 1 /$outer/$inner/$prim
_mged_matpick 2
if {[status state] ne "OBJ EDIT" || $transform ne "e"} {
error "step $step did not enter object editing"
}
set view_before [csg_edit_view_state]
if {$step % 2 == 0} {
press Rotate
dm con r z 100 100
set operation [csg_matrix_axis_rotation z 10]
set motion {dm motion 140 100}
} else {
press Scale
dm am s 100 100
set operation [csg_matrix_scale all $csg_drag_scale]
set motion {dm motion 164 100}
}
set motion_code [catch {uplevel #0 $motion} motion_result]
if {$motion_code != 0 && $motion_code != 2} {
error "step $step mouse motion failed: $motion_result"
}
dm idle
press accept
set expected [csg_matrix_multiply $operation $expected]
csg_edit_comb_leaf_matrix_at $inner $prim $expected
csg_edit_view_state_at $view_before
d $outer
}
} failure]
set orig_gui $saved_orig_gui
catch {press reject}
catch {Z}
foreach object [list $outer $inner $prim] {
catch {kill $object}
}
if {$failed} {
puts " FAIL: repeated object mouse rotations/scales ($failure)"
} else {
puts " PASS: repeated object mouse rotations/scales"
}
}
csg_matrix_repeated_mouse_check
puts "--- All ARB point, edge, and face states ---"
proc csg_edit_sed_point {attribute} {
set serialized [get_sed]
set index [lsearch -exact $serialized $attribute]
if {$index < 0 || $index + 1 >= [llength $serialized]} {
error "get_sed has no $attribute: $serialized"
}
return [lindex $serialized [expr {$index + 1}]]
}
proc csg_arb_repeated_mouse_check {} {
global orig_gui csg_bv_coord_half_range csg_mouse_dm_pixels
global csg_mouse_view_size
set source csg_lifecycle_arb5.s
set prim csg_arb_repeat.s
set saved_orig_gui $orig_gui
set expected {}
set failed [catch {
cp $source $prim
e $prim
center 0 0 0
size $csg_mouse_view_size
setview 0 0 0
dm size $csg_mouse_dm_pixels $csg_mouse_dm_pixels
set orig_gui 0
sed $prim
press {Move Edges}
press {Move Point 5}
set original_z [lindex [db get $source V5] 2]
for {set step 0} {$step < 64} {incr step} {
if {$step > 0 && $step % 8 == 0} {
press sedit
press {Move Edges}
press {Move Point 5}
}
set mouse_x [expr {150 + 2 * ($step % 5)}]
set mouse_y [expr {150 + 2 * (($step * 3) % 5)}]
M 1 $mouse_x $mouse_y
set expected [list \
[expr {$mouse_x / $csg_bv_coord_half_range * $csg_mouse_view_size / 2.0}] \
[expr {$mouse_y / $csg_bv_coord_half_range * $csg_mouse_view_size / 2.0}] \
$original_z]
set actual [csg_edit_sed_point V5]
if {[csg_edit_point_distance $actual $expected] > 0.000001} {
error "step $step expected V5 $expected, got $actual"
}
}
press accept
d $prim
if {[csg_edit_point_distance [db get $prim V5] $expected] > 0.000001} {
error "accepted V5 differs from the final mouse target"
}
foreach vertex {V1 V2 V3 V4} {
csg_edit_point_matches_source $source $vertex $prim
}
arb_standard_storage_check arb5 $prim
} failure]
set orig_gui $saved_orig_gui
catch {press reject}
catch {d $prim}
catch {kill $prim}
if {$failed} {
puts " FAIL: repeated ARB5 mouse movement ($failure)"
} else {
puts " PASS: repeated ARB5 mouse movement"
}
}
csg_arb_repeated_mouse_check
# Every ARB menu entry is checked independently. The variants do not share
# menu indices, so sampling one edge or face would miss precisely the class of
# integration failure this test is intended to catch. Move each selection a
@@ -1322,6 +1454,280 @@ csg_edit_sequence_check csg_lifecycle_dsp.s "Toggle Smooth" {
{press {Toggle Smooth}}
} [list csg_edit_scalar_at sm 1]
puts "--- Specialized mouse editing and menu inventory ---"
proc csg_edit_prepare_mouse_view {} {
global csg_dispatch_view_size
center 0 0 0
size $csg_dispatch_view_size
setview 0 0 0
}
array set csg_mouse_covered {}
proc csg_mouse_case {source menu_items label commands validator} {
global csg_mouse_covered
csg_edit_sequence_check $source $label $commands $validator
set type [lindex [db get $source] 0]
if {![info exists csg_mouse_covered($type)]} {
set csg_mouse_covered($type) {}
}
foreach item $menu_items {
if {[lsearch -exact $csg_mouse_covered($type) $item] < 0} {
lappend csg_mouse_covered($type) $item
}
}
}
proc csg_edit_menu_inventory_check {source ignored} {
global csg_mouse_covered
if {[catch {
Z
e $source
sed $source
set actual [mmenu_get 0]
set type [lindex [db get $source] 0]
set covered {}
if {[info exists csg_mouse_covered($type)]} {
set covered $csg_mouse_covered($type)
}
foreach item $actual {
set tested [expr {[lsearch -exact $covered $item] >= 0}]
set exempt [expr {[lsearch -exact $ignored $item] >= 0}]
if {$tested == $exempt} {
error "menu entry '$item' needs exactly one mouse-test or exclusion"
}
}
foreach item [concat $covered $ignored] {
if {[lsearch -exact $actual $item] < 0} {
error "recorded menu entry '$item' is absent from $actual"
}
}
press reject
d $source
} failure]} {
puts " FAIL: menu inventory $source ($failure)"
catch {press reject}
catch {Z}
} else {
puts " PASS: menu inventory $source"
}
}
csg_edit_prepare_mouse_view
set csg_special_mouse_target [list \
[expr {512.0 / $csg_bv_coord_half_range * $csg_dispatch_view_size / 2.0}] \
[expr {512.0 / $csg_bv_coord_half_range * $csg_dispatch_view_size / 2.0}] 0]
set csg_special_mouse_scale [expr {1.0 + 2047.0 / ($csg_bv_coord_half_range * 4.0)}]
set csg_special_mouse_shrink [expr {
1.0 / (1.0 + 1024.0 / ($csg_bv_coord_half_range * 4.0))}]
csg_mouse_case csg_lifecycle_pipe.s {{Move Point}} "mouse select and move point" {
{csg_edit_prepare_mouse_view}
{press {Select Point}}
{p 0 0 0}
{press {Move Point}}
{M 1 512 512}
} [list csg_edit_point_at V0 $csg_special_mouse_target]
in csg_mouse_pipe_topology.s pipe 4 \
0 0 0 1 2 3 \
0 0 30 1 2 3 \
30 40 80 1 2 3 \
80 80 100 1 2 3
csg_mouse_case csg_mouse_pipe_topology.s {{Select Point} {Move Point}} "mouse select point" {
{csg_edit_prepare_mouse_view}
{press {Select Point}}
{M 1 0 0}
{press {Move Point}}
{M 1 512 512}
} [list csg_edit_point_at V0 $csg_special_mouse_target]
csg_mouse_case csg_mouse_pipe_topology.s {{Append Point}} "mouse append point" {
{csg_edit_prepare_mouse_view}
{press {Append Point}}
{M 1 512 512}
} [list csg_edit_point_at V4 {5 5 0}]
csg_mouse_case csg_mouse_pipe_topology.s {{Prepend Point}} "mouse prepend point" {
{csg_edit_prepare_mouse_view}
{press {Prepend Point}}
{M 1 512 512}
} [list csg_edit_point_at V0 {5 5 0}]
csg_mouse_case csg_mouse_pipe_topology.s {{Split Segment}} "mouse split segment" {
{csg_edit_prepare_mouse_view}
{press {Select Point}}
{p 0 0 0}
{press {Split Segment}}
{M 1 512 512}
} [list csg_edit_point_at V1 {5 5 0}]
foreach {item attribute initial} {
{Set Point OD} O0 5
{Set Point ID} I0 3
{Set Point Bend} R0 6
} {
csg_mouse_case csg_lifecycle_pipe.s [list $item] "mouse $item" [list \
{csg_edit_prepare_mouse_view} \
{press {Select Point}} {p 0 0 0} [list press $item] \
{M 1 0 -1024}] \
[list csg_edit_scalar_at $attribute [expr {$initial * $csg_special_mouse_shrink}]]
}
foreach {item attributes initial} {
{Set Pipe OD} {O0 O1 O2 O3} {5 5 6 6}
{Set Pipe ID} {I0 I1 I2 I3} {3 3 2 0}
{Set Pipe Bend} {R0 R1 R2 R3} {6 7 10 8}
} {
set expected {}
foreach value $initial {
lappend expected [expr {$value * $csg_special_mouse_shrink}]
}
csg_mouse_case csg_lifecycle_pipe.s [list $item] "mouse $item" [list \
{csg_edit_prepare_mouse_view} \
[list press $item] {M 1 0 -1024}] \
[list csg_edit_scalar_values_at $attributes $expected]
}
proc csg_edit_bot_vertices_moved {source moved delta prim} {
set vertices [db get $source V]
for {set index 0} {$index < [llength $vertices]} {incr index} {
set expected [lindex $vertices $index]
if {[lsearch -exact $moved $index] >= 0} {
set translated {}
foreach value $expected shift $delta {
lappend translated [expr {$value + $shift}]
}
set expected $translated
}
csg_edit_list_value_at V $index $expected $prim
}
}
csg_mouse_case csg_lifecycle_bot.s {{Move Vertex}} "mouse move vertex" {
{csg_edit_prepare_mouse_view}
{press {Pick Vertex}}
{p 0}
{press {Move Vertex}}
{M 1 512 512}
} [list csg_edit_bot_vertices_moved csg_lifecycle_bot.s {0} \
$csg_special_mouse_target]
csg_mouse_case csg_lifecycle_bot.s {{Pick Vertex} {Move Vertex}} "mouse pick and move vertex" {
{csg_edit_prepare_mouse_view}
{press {Pick Vertex}}
{M 1 0 0}
{press {Move Vertex}}
{M 1 512 512}
} [list csg_edit_bot_vertices_moved csg_lifecycle_bot.s {0} \
$csg_special_mouse_target]
csg_mouse_case csg_lifecycle_bot.s {{Move Edge}} "mouse move edge" {
{csg_edit_prepare_mouse_view}
{press {Pick Edge}}
{p 0 1}
{press {Move Edge}}
{M 1 1024 512}
} [list csg_edit_bot_vertices_moved csg_lifecycle_bot.s {0 1} {10 5 0}]
csg_mouse_case csg_lifecycle_bot.s {{Pick Edge} {Move Edge}} "mouse pick and move edge" {
{csg_edit_prepare_mouse_view}
{press {Pick Edge}}
{M 1 512 512}
{press {Move Edge}}
{M 1 1024 512}
} [list csg_edit_bot_vertices_moved csg_lifecycle_bot.s {0 1} {10 5 0}]
csg_mouse_case csg_lifecycle_bot.s {{Move Triangle}} "mouse move triangle" {
{csg_edit_prepare_mouse_view}
{press {Pick Triangle}}
{p 0 1 2}
{press {Move Triangle}}
{M 1 512 512}
} [list csg_edit_bot_vertices_moved csg_lifecycle_bot.s {0 1 2} \
$csg_special_mouse_target]
csg_mouse_case csg_lifecycle_ebm.s {{Extrude Depth}} "mouse extrusion depth" {
{csg_edit_prepare_mouse_view}
{press {Extrude Depth}}
{M 1 0 2047}
} [list csg_edit_scalar_at H [expr {4.0 * $csg_special_mouse_scale}]]
csg_mouse_case csg_lifecycle_vol.s {{Threshold (low)}} "mouse low threshold" {
{csg_edit_prepare_mouse_view}
{press {Threshold (low)}}
{p 10}
{M 1 0 2047}
} [list csg_edit_scalar_at lo [expr {int(10.0 * $csg_special_mouse_scale)}]]
csg_mouse_case csg_lifecycle_vol.s {{Voxel Size (X Y Z)}} "mouse voxel size" {
{csg_edit_prepare_mouse_view}
{press {Voxel Size (X Y Z)}}
{M 1 0 2047}
} [list csg_edit_point_at size [list \
$csg_special_mouse_scale $csg_special_mouse_scale $csg_special_mouse_scale]]
csg_mouse_case csg_lifecycle_vol.s {{Threshold (hi)}} "mouse high threshold" {
{csg_edit_prepare_mouse_view}
{press {Threshold (hi)}}
{M 1 0 -1024}
} [list csg_edit_scalar_at hi [expr {int(255.0 * $csg_special_mouse_shrink)}]]
csg_mouse_case csg_lifecycle_dsp.s {{Set X}} "mouse X scale" {
{csg_edit_prepare_mouse_view}
{press {Set X}}
{M 1 0 2047}
} [list csg_edit_matrix_component_at stom 0 $csg_special_mouse_scale]
foreach {item index} {{Set Y} 5 {Set ALT} 10} {
csg_mouse_case csg_lifecycle_dsp.s [list $item] "mouse $item" [list \
{csg_edit_prepare_mouse_view} \
[list press $item] {M 1 0 2047}] \
[list csg_edit_matrix_component_at stom $index $csg_special_mouse_scale]
}
foreach type {arbn brep} {
set source csg_lifecycle_${type}.s
csg_edit_sequence_check $source "generic mouse translation" {
{csg_edit_prepare_mouse_view}
{keypoint 0 0 0}
{press sxy}
{M 1 512 512}
} [list csg_edit_bbox_translated $source $csg_special_mouse_target]
}
# Every specialized menu entry must be accounted for. Exclusions are menu
# headings, non-positional actions/settings, or the BOT triangle picker (tested
# under Xmin because it needs Tk). A new entry without a mouse case or
# explicit exclusion fails here.
foreach {source ignored} {
csg_lifecycle_pipe.s {
{PIPE MENU} {Next Point} {Previous Point} {Delete Point}
}
csg_lifecycle_bot.s {
{BOT MENU} {Pick Triangle} {Move Vertex List}
{Split Edge} {Split Face} {Fuse Vertices} {Fuse Faces}
{Delete Triangle} {Select Mode} {Select Orientation}
{Set flags} {Set Face Thickness} {Set Face Mode}
}
csg_lifecycle_dsp.s {
{DSP MENU} Name {Toggle Smooth} {Set Data Source}
}
csg_lifecycle_ebm.s {
{EBM MENU} {File Name} {File Size (W N)}
}
csg_lifecycle_vol.s {
{VOL MENU} {File Name} {File Size (X Y Z)}
}
csg_lifecycle_arbn.s {}
csg_lifecycle_brep.s {}
} {
csg_edit_menu_inventory_check $source $ignored
}
# A view-space request must remain view-space even when the editor's current
# coordinate system is object-relative. This is the fast path underlying the
# corresponding real mouse drag in the Xmin GUI test.
set csg_saved_coords [rset var coords]
set csg_saved_transform [rset var transform]
if {[catch {
Z
e csg_lifecycle_bot.s
sed csg_lifecycle_bot.s
center 0 0 0
rset var coords o
rset var transform v
knob -i -v aX 1
if {[csg_edit_point_distance [center] {-1 0 0}] > 0.000001} {
error "explicit view knob left center at [center]"
}
} csg_view_override_error]} {
puts " FAIL: view-space translation with object coordinates ($csg_view_override_error)"
} else {
puts " PASS: view-space translation with object coordinates"
}
catch {press reject}
catch {Z}
rset var coords $csg_saved_coords
rset var transform $csg_saved_transform
file delete -force $csg_data_file
file delete -force $csg_dsp_file
+33
View File
@@ -43,4 +43,37 @@ foreach {arb_type face expected_type} $arb_extrude_cases {
arb_standard_storage_check $expected_type $prim
}
# A one-inch extrusion must extend a face by 25.4 base millimeters through
# both the direct libged command and MGED's interactive solid editor.
set inch_in_mm 25.4
set tolerance 0.001
foreach mode {direct interactive} {
set suffix "_inch_$mode"
in_arb8 extrude $suffix
set prim "extrude_arb8${suffix}.s"
set base_x [lindex [db get $prim V1] 0]
units in
if {$mode eq "direct"} {
if {[catch {edarb extrude $prim 1234 1} result]} {
error "inch edarb extrusion failed: $result"
}
} else {
Z
e $prim
sed $prim
if {[catch {extrude 1234 1} result]} {
error "inch MGED extrusion failed: $result"
}
accept
Z
}
units mm
set new_x [lindex [db get $prim V5] 0]
if {abs($new_x - $base_x - $inch_in_mm) > $tolerance} {
error "inch $mode extrusion moved V5 by [expr {$new_x - $base_x}] mm"
}
}
puts "*** 'extrude' testing completed ***"
+23
View File
@@ -31,6 +31,7 @@ in tor_pe.s tor 0 0 0 0 0 1 20 2
prim_edit_check tor_pe.s "Set Radius 1" 30 r_a 30 -1
prim_edit_check tor_pe.s "Set Radius 2" 5 r_h 5 -1
prim_edit_mouse_check tor_pe.s "Set Radius 1" r_a 30 -1
prim_edit_mouse_check tor_pe.s "Set Radius 2" r_h 5 -1
kill tor_pe.s
puts "--- ELL (ellipsoid: A, B, C) ---"
@@ -39,6 +40,8 @@ prim_edit_check ell_pe.s "Set A" 8 A 8 0
prim_edit_check ell_pe.s "Set B" 6 B 6 1
prim_edit_check ell_pe.s "Set C" 4 C 4 2
prim_edit_mouse_check ell_pe.s "Set A" A 8 0
prim_edit_mouse_check ell_pe.s "Set B" B 6 1
prim_edit_mouse_check ell_pe.s "Set C" C 4 2
kill ell_pe.s
puts "--- RPC (right parabolic cylinder: H, r) ---"
@@ -46,6 +49,7 @@ in rpc_pe.s rpc 0 0 0 0 0 10 0 5 0 3
prim_edit_check rpc_pe.s "Set H" 20 H 20 2
prim_edit_check rpc_pe.s "Set r" 6 r 6 -1
prim_edit_mouse_check rpc_pe.s "Set H" H 20 2
prim_edit_mouse_check rpc_pe.s "Set r" r 6 -1
kill rpc_pe.s
puts "--- RHC (right hyperbolic cylinder: H, r, c) ---"
@@ -54,6 +58,8 @@ prim_edit_check rhc_pe.s "Set H" 20 H 20 2
prim_edit_check rhc_pe.s "Set r" 6 r 6 -1
prim_edit_check rhc_pe.s "Set c" 3 c 3 -1
prim_edit_mouse_check rhc_pe.s "Set r" r 6 -1
prim_edit_mouse_check rhc_pe.s "Set H" H 20 2
prim_edit_mouse_check rhc_pe.s "Set c" c 3 -1
kill rhc_pe.s
puts "--- EPA (elliptical paraboloid: H, r_1, r_2) ---"
@@ -62,6 +68,8 @@ prim_edit_check epa_pe.s "Set H" 20 H 20 2
prim_edit_check epa_pe.s "Set A" 8 r_1 8 -1
prim_edit_check epa_pe.s "Set B" 4 r_2 4 -1
prim_edit_mouse_check epa_pe.s "Set H" H 20 2
prim_edit_mouse_check epa_pe.s "Set A" r_1 8 -1
prim_edit_mouse_check epa_pe.s "Set B" r_2 4 -1
kill epa_pe.s
puts "--- EHY (elliptical hyperboloid: H, r_1, c) ---"
@@ -70,6 +78,8 @@ prim_edit_check ehy_pe.s "Set H" 20 H 20 2
prim_edit_check ehy_pe.s "Set A" 8 r_1 8 -1
prim_edit_check ehy_pe.s "Set c" 3 c 3 -1
prim_edit_mouse_check ehy_pe.s "Set A" r_1 8 -1
prim_edit_mouse_check ehy_pe.s "Set H" H 20 2
prim_edit_mouse_check ehy_pe.s "Set c" c 3 -1
kill ehy_pe.s
puts "--- PART (particle: H, r_v, r_h) ---"
@@ -78,6 +88,8 @@ prim_edit_check part_pe.s "Set H" 20 H 20 2
prim_edit_check part_pe.s "Set v" 4 r_v 4 -1
prim_edit_check part_pe.s "Set h" 3 r_h 3 -1
prim_edit_mouse_check part_pe.s "Set v" r_v 4 -1
prim_edit_mouse_check part_pe.s "Set H" H 20 2
prim_edit_mouse_check part_pe.s "Set h" r_h 3 -1
kill part_pe.s
puts "--- TGC (truncated general cone: H, A, B, C, D) ---"
@@ -91,6 +103,10 @@ prim_edit_check tgc_pe.s "Set B" 3 B 3 1
prim_edit_check tgc_pe.s "Set C" 3 C 3 0
prim_edit_check tgc_pe.s "Set D" 4 D 4 1
prim_edit_mouse_check tgc_pe.s "Set H" H 8 2
prim_edit_mouse_check tgc_pe.s "Set A" A 4 0
prim_edit_mouse_check tgc_pe.s "Set B" B 3 1
prim_edit_mouse_check tgc_pe.s "Set C" C 3 0
prim_edit_mouse_check tgc_pe.s "Set D" D 4 1
kill tgc_pe.s
puts "--- ETO (elliptical torus: r, C, D) ---"
@@ -100,6 +116,7 @@ prim_edit_check eto_pe.s "Set r" 8 r 8 -1
prim_edit_check eto_pe.s "Set D" 1.5 r_d 1.5 -1
prim_edit_mouse_check eto_pe.s "Set r" r 8 -1
prim_edit_mouse_check eto_pe.s "Set C" C 5 0
prim_edit_mouse_check eto_pe.s "Set D" r_d 1.5 -1
kill eto_pe.s
puts "--- HYP (one-sheet hyperboloid: H, A, B, c) ---"
@@ -111,6 +128,9 @@ prim_edit_check hyp_pe.s "Set A" 2 A 10 1
prim_edit_check hyp_pe.s "Set B" 2 b 4 -1
prim_edit_check hyp_pe.s "Set c" 0.5 bnr 0.25 -1
prim_edit_mouse_check hyp_pe.s "Set H" H 20 2
prim_edit_mouse_check hyp_pe.s "Set A" A 10 1
prim_edit_mouse_check hyp_pe.s "Set B" b 4 -1
prim_edit_mouse_check hyp_pe.s "Set c" bnr 0.25 -1
kill hyp_pe.s
puts "--- SUPERELL (superellipsoid: A, B, C) ---"
@@ -119,6 +139,8 @@ prim_edit_check superell_pe.s "Set A" 5 A 5 0
prim_edit_check superell_pe.s "Set B" 4 B 4 1
prim_edit_check superell_pe.s "Set C" 3 C 3 2
prim_edit_mouse_check superell_pe.s "Set A" A 5 0
prim_edit_mouse_check superell_pe.s "Set B" B 4 1
prim_edit_mouse_check superell_pe.s "Set C" C 3 2
kill superell_pe.s
puts "--- CLINE (cylinder line: H, R, plate thickness) ---"
@@ -129,6 +151,7 @@ prim_edit_check cline_pe.s "Set R" 4 R 4 -1
prim_edit_check cline_pe.s "Set plate thickness" 0.4 T 0.4 -1
prim_edit_mouse_check cline_pe.s "Set H" H 8 2
prim_edit_mouse_check cline_pe.s "Set R" R 4 -1
prim_edit_mouse_check cline_pe.s "Set plate thickness" T 0.4 -1
kill cline_pe.s
puts "--- NMG (non-manifold geometry: Pick Edge, Move Edge, Next EU) ---"
+64
View File
@@ -0,0 +1,64 @@
puts "*** Testing 'sed_reset' command ***"
proc sed_reset_check {primitive edit_commands} {
e $primitive
sed $primitive
if {[status state] ne "SOL EDIT"} {
error "$primitive entered [status state], not SOL EDIT"
}
set original [get_sed]
foreach command $edit_commands {
uplevel #0 $command
}
if {[get_sed] eq $original} {
error "$primitive edit did not change the working geometry"
}
sed_reset
if {[status state] ne "SOL EDIT"} {
error "$primitive reset entered [status state], not SOL EDIT"
}
if {[get_sed] ne $original} {
error "$primitive reset did not restore the original geometry"
}
press reject
if {[status state] ne "VIEWING"} {
error "$primitive reject entered [status state], not VIEWING"
}
d $primitive
}
if {[catch {
in sed_reset_arb8.s arb8 \
0 0 0 10 0 0 10 10 0 0 10 0 \
0 0 10 10 0 10 10 10 10 0 10 10
sed_reset_check sed_reset_arb8.s {
{press {Move Faces}}
{press {Move Face 1234}}
{p 0 0 -1}
}
} failure]} {
puts "FAIL: ARB8 face move reset ($failure)"
catch {press reject}
catch {Z}
} else {
puts "PASS: ARB8 face move reset"
}
if {[catch {
make sed_reset_cline.s cline
sed_reset_check sed_reset_cline.s {
{press {Move End H}}
{p 3 4 12}
}
} failure]} {
puts "FAIL: CLINE edit reset ($failure)"
catch {press reject}
catch {Z}
} else {
puts "PASS: CLINE edit reset"
}
puts "PASS: 'sed_reset' testing completed"
+76 -66
View File
@@ -1,18 +1,18 @@
if(BRLCAD_X11_PROVIDER_RESOLVED STREQUAL "XMIN" AND
Xmin_RUN_EXECUTABLE AND SH_EXEC AND TARGET m35.g)
set(_xmin_smoke "${CMAKE_CURRENT_SOURCE_DIR}/xmin_gui_smoke.sh")
set(_xmin_smoke_environment
set(_gui_smoke "${CMAKE_SOURCE_DIR}/regress/gui/gui_smoke.sh")
set(_gui_smoke_environment
"CMAKE_COMMAND=${CMAKE_COMMAND}"
"LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/${LIB_DIR}"
"XMIN_TEST_SHELL=${CMAKE_CURRENT_SOURCE_DIR}/xmin_test.sh"
"GUI_TEST_SHELL=${CMAKE_SOURCE_DIR}/regress/gui/gui_test.sh"
)
set(_xmin_test_db "${CMAKE_BINARY_DIR}/${DATA_DIR}/db/m35.g")
set(_xmin_gui_library "${CMAKE_CURRENT_SOURCE_DIR}/xmin_gui_test.tcl")
set(_xmin_tcl_runner "${CMAKE_CURRENT_SOURCE_DIR}/xmin_tcl_gui_test.sh")
set(_gui_test_db "${CMAKE_BINARY_DIR}/${DATA_DIR}/db/m35.g")
set(_gui_test_library "${CMAKE_SOURCE_DIR}/regress/gui/gui_test.tcl")
set(_gui_tcl_runner "${CMAKE_SOURCE_DIR}/regress/gui/gui_tcl_test.sh")
if(TARGET mged AND TARGET dm-tkswrast AND TARGET dm-X AND TARGET dm-ogl
AND TARGET icv AND TARGET pixcrop AND TARGET rt)
brlcad_add_xmin_test(
brlcad_add_gui_test(
NAME regress-mged-xmin-gui-edit
TIMEOUT 600
ENVIRONMENT
@@ -25,11 +25,10 @@ if(BRLCAD_X11_PROVIDER_RESOLVED STREQUAL "XMIN" AND
"MGED_GUI_MANIFEST=${CMAKE_CURRENT_SOURCE_DIR}/mged/mged_gui_menu_manifest.txt"
"MGED_PIPE_ORACLE=${CMAKE_CURRENT_SOURCE_DIR}/mged/xmin_gui_pipe_oracle.tcl"
"MGED_RT_BIN=$<TARGET_FILE:rt>"
"MGED_XMIN_ACTIVE_SESSION=1"
"MGED_TEST_SHELL=${SH_EXEC}"
"MGED_XMIN_RC=${CMAKE_CURRENT_SOURCE_DIR}/mged/xmin_gui_edit.tcl"
"GUI_TEST_SHELL=${CMAKE_SOURCE_DIR}/regress/gui/gui_test.sh"
"MGED_GUI_RC=${CMAKE_CURRENT_SOURCE_DIR}/mged/xmin_gui_edit.tcl"
"PIXCROP_BIN=$<TARGET_FILE:pixcrop>"
"XMIN_GUI_LIBRARY=${CMAKE_SOURCE_DIR}/regress/xmin/xmin_gui_test.tcl"
"GUI_TEST_LIBRARY=${_gui_test_library}"
COMMAND "${SH_EXEC}" "${CMAKE_CURRENT_SOURCE_DIR}/mged/mged_xmin_gui.sh"
)
brlcad_regression_test(regress-mged-xmin-gui-edit
@@ -38,48 +37,48 @@ if(BRLCAD_X11_PROVIDER_RESOLVED STREQUAL "XMIN" AND
endif()
if(TARGET mged AND TARGET dm-tkswrast)
brlcad_add_xmin_test(
brlcad_add_gui_test(
NAME regress-mged-xmin-gui-controls
TIMEOUT 180
ENVIRONMENT ${_xmin_smoke_environment}
"XMIN_GUI_LIBRARY=${_xmin_gui_library}"
COMMAND "${SH_EXEC}" "${_xmin_tcl_runner}"
ENVIRONMENT ${_gui_smoke_environment}
"GUI_TEST_LIBRARY=${_gui_test_library}"
COMMAND "${SH_EXEC}" "${_gui_tcl_runner}"
mged-controls $<TARGET_FILE:mged> --gui --dm-type tkswrast
--rcfile "${CMAKE_CURRENT_SOURCE_DIR}/mged/xmin_gui_controls.tcl"
--geom 680x520+0+0 --ggeom 512x512+700+0
"${_xmin_test_db}"
"${_gui_test_db}"
)
brlcad_regression_test(regress-mged-xmin-gui-controls
"mged;dm-tkswrast;m35.g" STAND_ALONE TEST_DEFINED)
brlcad_add_xmin_test(
brlcad_add_gui_test(
NAME regress-mged-xmin-gui-workflows
TIMEOUT 300
ENVIRONMENT ${_xmin_smoke_environment}
"XMIN_GUI_LIBRARY=${_xmin_gui_library}"
COMMAND "${SH_EXEC}" "${_xmin_tcl_runner}"
ENVIRONMENT ${_gui_smoke_environment}
"GUI_TEST_LIBRARY=${_gui_test_library}"
COMMAND "${SH_EXEC}" "${_gui_tcl_runner}"
mged-workflows $<TARGET_FILE:mged> --gui --dm-type tkswrast
--rcfile "${CMAKE_CURRENT_SOURCE_DIR}/mged/xmin_gui_workflows.tcl"
--geom 680x520+0+0 --ggeom 512x512+700+0
"${_xmin_test_db}"
"${_gui_test_db}"
)
brlcad_regression_test(regress-mged-xmin-gui-workflows
"mged;dm-tkswrast;m35.g" STAND_ALONE TEST_DEFINED)
function(mged_add_xmin_gui_fixture test_name dependencies)
string(REPLACE "-" "_" script_name "${test_name}")
brlcad_add_xmin_test(
brlcad_add_gui_test(
NAME regress-mged-xmin-gui-${test_name}
TIMEOUT 180
ENVIRONMENT ${_xmin_smoke_environment}
"MGED_XMIN_GUI_LIBRARY=${CMAKE_CURRENT_SOURCE_DIR}/mged/xmin_gui_test.tcl"
"XMIN_GUI_LIBRARY=${_xmin_gui_library}"
ENVIRONMENT ${_gui_smoke_environment}
"MGED_GUI_TEST_LIBRARY=${CMAKE_CURRENT_SOURCE_DIR}/mged/xmin_gui_test.tcl"
"GUI_TEST_LIBRARY=${_gui_test_library}"
${ARGN}
COMMAND "${SH_EXEC}" "${_xmin_tcl_runner}"
COMMAND "${SH_EXEC}" "${_gui_tcl_runner}"
mged-${test_name} $<TARGET_FILE:mged> --gui --dm-type tkswrast
--rcfile "${CMAKE_CURRENT_SOURCE_DIR}/mged/xmin_gui_${script_name}.tcl"
--geom 680x520+0+0 --ggeom 512x512+700+0
"${_xmin_test_db}"
"${_gui_test_db}"
)
brlcad_regression_test(regress-mged-xmin-gui-${test_name}
"${dependencies}" STAND_ALONE TEST_DEFINED)
@@ -94,6 +93,7 @@ if(BRLCAD_X11_PROVIDER_RESOLVED STREQUAL "XMIN" AND
"PLOT3_ASC_BIN=$<TARGET_FILE:plot3-asc>"
)
mged_add_xmin_gui_fixture(help "mged;dm-tkswrast;m35.g")
mged_add_xmin_gui_fixture(edit-interaction "mged;dm-tkswrast;m35.g")
mged_add_xmin_gui_fixture(bot "mged;dm-tkswrast;m35.g")
mged_add_xmin_gui_fixture(editors "mged;dm-tkswrast;m35.g")
mged_add_xmin_gui_fixture(query-pattern "mged;dm-tkswrast;m35.g")
@@ -105,70 +105,82 @@ if(BRLCAD_X11_PROVIDER_RESOLVED STREQUAL "XMIN" AND
endif()
if(TARGET archer)
brlcad_add_xmin_test(
brlcad_add_gui_test(
NAME regress-archer-xmin-smoke
TIMEOUT 180
ENVIRONMENT ${_xmin_smoke_environment}
"XMIN_SMOKE_ACTION=${CMAKE_CURRENT_SOURCE_DIR}/archer_action.sh"
"XMIN_MIN_CHANGED_BYTES=10000"
COMMAND "${SH_EXEC}" "${_xmin_smoke}" "Archer ${BRLCAD_VERSION}"
ENVIRONMENT ${_gui_smoke_environment}
"GUI_SMOKE_ACTION=${CMAKE_CURRENT_SOURCE_DIR}/archer_action.sh"
"GUI_MIN_CHANGED_BYTES=10000"
COMMAND "${SH_EXEC}" "${_gui_smoke}" "Archer ${BRLCAD_VERSION}"
"${CMAKE_CURRENT_SOURCE_DIR}/archer_smoke.sh"
$<TARGET_FILE:archer> "${_xmin_test_db}"
$<TARGET_FILE:archer> "${_gui_test_db}"
)
brlcad_regression_test(regress-archer-xmin-smoke
"archer;m35.g" STAND_ALONE TEST_DEFINED)
if(TARGET bwish)
brlcad_add_xmin_test(
brlcad_add_gui_test(
NAME regress-archer-xmin-gui
TIMEOUT 180
ENVIRONMENT ${_xmin_smoke_environment}
"XMIN_GUI_LIBRARY=${_xmin_gui_library}"
ENVIRONMENT ${_gui_smoke_environment}
"GUI_TEST_LIBRARY=${_gui_test_library}"
"ARCHER_LAUNCH=${CMAKE_BINARY_DIR}/${DATA_DIR}/tclscripts/archer/init/archer_launch.tcl"
"ARCHER_TEST_DATABASE=${_xmin_test_db}"
"ARCHER_TEST_DATABASE=${_gui_test_db}"
"ARCHER_MENU_MANIFEST=${CMAKE_CURRENT_SOURCE_DIR}/archer_menu_manifest.txt"
COMMAND "${SH_EXEC}" "${_xmin_tcl_runner}" archer
COMMAND "${SH_EXEC}" "${_gui_tcl_runner}" archer
$<TARGET_FILE:bwish> "${CMAKE_CURRENT_SOURCE_DIR}/archer_xmin_gui.tcl"
)
brlcad_regression_test(regress-archer-xmin-gui
"archer;bwish;m35.g" STAND_ALONE TEST_DEFINED)
brlcad_add_xmin_test(
brlcad_add_gui_test(
NAME regress-archer-embedded-xmin-gui
TIMEOUT 180
ENVIRONMENT ${_xmin_smoke_environment}
"XMIN_GUI_LIBRARY=${_xmin_gui_library}"
COMMAND "${SH_EXEC}" "${_xmin_tcl_runner}" archer-embedded
ENVIRONMENT ${_gui_smoke_environment}
"GUI_TEST_LIBRARY=${_gui_test_library}"
COMMAND "${SH_EXEC}" "${_gui_tcl_runner}" archer-embedded
$<TARGET_FILE:bwish>
"${CMAKE_CURRENT_SOURCE_DIR}/archer_embedded_xmin_gui.tcl"
)
brlcad_regression_test(regress-archer-embedded-xmin-gui
"archer;bwish" STAND_ALONE TEST_DEFINED)
brlcad_add_gui_test(
NAME regress-archer-geometry-xmin-gui
TIMEOUT 120
ENVIRONMENT ${_gui_smoke_environment}
"GUI_TEST_LIBRARY=${_gui_test_library}"
COMMAND "${SH_EXEC}" "${_gui_tcl_runner}" archer-geometry
$<TARGET_FILE:bwish>
"${CMAKE_CURRENT_SOURCE_DIR}/archer_geometry_xmin_gui.tcl"
)
brlcad_regression_test(regress-archer-geometry-xmin-gui
"archer;bwish" STAND_ALONE TEST_DEFINED)
endif()
endif()
if(TARGET rtwizard)
brlcad_add_xmin_test(
brlcad_add_gui_test(
NAME regress-rtwizard-xmin-smoke
TIMEOUT 180
ENVIRONMENT ${_xmin_smoke_environment}
"XMIN_SMOKE_ACTION=${CMAKE_CURRENT_SOURCE_DIR}/rtwizard_action.sh"
"XMIN_MIN_CHANGED_BYTES=5000"
COMMAND "${SH_EXEC}" "${_xmin_smoke}" RtWizard
$<TARGET_FILE:rtwizard> --gui -i "${_xmin_test_db}" -t A
ENVIRONMENT ${_gui_smoke_environment}
"GUI_SMOKE_ACTION=${CMAKE_CURRENT_SOURCE_DIR}/rtwizard_action.sh"
"GUI_MIN_CHANGED_BYTES=5000"
COMMAND "${SH_EXEC}" "${_gui_smoke}" RtWizard
$<TARGET_FILE:rtwizard> --gui -i "${_gui_test_db}" -t A
)
brlcad_regression_test(regress-rtwizard-xmin-smoke
"rtwizard;m35.g" STAND_ALONE TEST_DEFINED)
if(TARGET bwish)
brlcad_add_xmin_test(
brlcad_add_gui_test(
NAME regress-rtwizard-xmin-gui
TIMEOUT 180
ENVIRONMENT ${_xmin_smoke_environment}
"XMIN_GUI_LIBRARY=${_xmin_gui_library}"
"RTWIZARD_TEST_DATABASE=${_xmin_test_db}"
ENVIRONMENT ${_gui_smoke_environment}
"GUI_TEST_LIBRARY=${_gui_test_library}"
"RTWIZARD_TEST_DATABASE=${_gui_test_db}"
"RTWIZARD_MENU_MANIFEST=${CMAKE_CURRENT_SOURCE_DIR}/rtwizard_menu_manifest.txt"
COMMAND "${SH_EXEC}" "${_xmin_tcl_runner}" rtwizard
COMMAND "${SH_EXEC}" "${_gui_tcl_runner}" rtwizard
$<TARGET_FILE:bwish> "${CMAKE_CURRENT_SOURCE_DIR}/rtwizard_xmin_gui.tcl"
)
brlcad_regression_test(regress-rtwizard-xmin-gui
@@ -179,15 +191,15 @@ if(BRLCAD_X11_PROVIDER_RESOLVED STREQUAL "XMIN" AND
# qged is still evolving, so keep this fixture deliberately narrow: prove
# that Qt starts, the console accepts a command, and OpenGL redraws.
if(TARGET qged)
brlcad_add_xmin_test(
brlcad_add_gui_test(
NAME regress-qged-xmin-smoke
TIMEOUT 180
ENVIRONMENT ${_xmin_smoke_environment}
"XMIN_SMOKE_ACTION=${CMAKE_CURRENT_SOURCE_DIR}/qged_action.sh"
"XMIN_MIN_CHANGED_BYTES=5000"
COMMAND "${SH_EXEC}" "${_xmin_smoke}" QGED
ENVIRONMENT ${_gui_smoke_environment}
"GUI_SMOKE_ACTION=${CMAKE_CURRENT_SOURCE_DIR}/qged_action.sh"
"GUI_MIN_CHANGED_BYTES=5000"
COMMAND "${SH_EXEC}" "${_gui_smoke}" QGED
"${CMAKE_CURRENT_SOURCE_DIR}/qged_smoke.sh"
$<TARGET_FILE:qged> "${_xmin_test_db}"
$<TARGET_FILE:qged> "${_gui_test_db}"
)
brlcad_regression_test(regress-qged-xmin-smoke
"qged;m35.g" STAND_ALONE TEST_DEFINED)
@@ -197,10 +209,11 @@ endif()
cmakefiles(
CMakeLists.txt
README.md
xmin_gui_smoke.sh
xmin_gui_ctl.sh
archer_action.sh
archer_smoke.sh
archer_embedded_xmin_gui.tcl
archer_geometry_xmin_gui.tcl
archer_menu_manifest.txt
archer_xmin_gui.tcl
qged_action.sh
@@ -208,27 +221,24 @@ cmakefiles(
rtwizard_action.sh
rtwizard_menu_manifest.txt
rtwizard_xmin_gui.tcl
xmin_gui_test.tcl
xmin_test.sh
xmin_test.tcl
xmin_tcl_gui_test.sh
mged/MGED_GUI_TEST_COVERAGE.md
mged/mged_gui_menu_manifest.txt
mged/mged_xmin_gui.sh
mged/xmin_gui_bot.tcl
mged/xmin_gui_controls.tcl
mged/xmin_gui_edit.tcl
mged/xmin_gui_edit_interaction.tcl
mged/xmin_gui_editors.tcl
mged/xmin_gui_help.tcl
mged/xmin_gui_lod.tcl
mged/xmin_gui_overlaps.tcl
mged/xmin_gui_pipe_oracle.tcl
mged/xmin_gui_query_pattern.tcl
mged/xmin_gui_render_outputs.tcl
mged/xmin_gui_search_exec.tcl
mged/xmin_gui_shotvis.tcl
mged/xmin_gui_test.tcl
mged/xmin_gui_workflows.tcl
mged/xmin_gui_edit.tcl
mged/xmin_gui_pipe_oracle.tcl
)
# Local Variables:
+11 -14
View File
@@ -13,16 +13,13 @@ and toolkit code must interpret consistently.
## Shared architecture
The support has three layers:
1. `brlcad_add_xmin_test` owns the private-server lifecycle, fixed screen,
environment, timeout, and CTest registration.
2. `xmin_gui_smoke.sh` owns the application lifecycle: launch, resolve the
mapped top-level to a stable window ID, wait for rendering to settle,
capture, run an optional action, compare captures, and close cleanly.
3. Application fixtures own their semantic oracle. Tk applications source
`xmin_gui_test.tcl` for widget and menu discovery. XTEST action scripts
drive paths that must traverse the actual X input protocol.
The platform-neutral helpers and controller contract are documented in
[GUI regression support](../gui/README.md). `brlcad_add_gui_test` currently
selects the Xmin backend, which starts a private server at a fixed screen
size. `xmin_gui_ctl.sh` translates controller commands to `xminctl`.
Application fixtures supply their own semantic checks; XTEST action scripts
exercise real input dispatch. MGED's deep fixture includes X11 and GLX
display managers and remains specific to this backend.
Resolving a window name once is important for Qt, which may create mapped and
unmapped helper windows with the same title. Repeating a title lookup can
@@ -114,13 +111,13 @@ widget-state assertion.
For a conventional executable:
```
brlcad_add_xmin_test(
brlcad_add_gui_test(
NAME regress-example-xmin-smoke
TIMEOUT 180
ENVIRONMENT
"XMIN_TEST_SHELL=${CMAKE_CURRENT_SOURCE_DIR}/xmin_test.sh"
"XMIN_SMOKE_ACTION=${CMAKE_CURRENT_SOURCE_DIR}/example_action.sh"
COMMAND "${SH_EXEC}" "${CMAKE_CURRENT_SOURCE_DIR}/xmin_gui_smoke.sh"
"GUI_TEST_SHELL=${CMAKE_SOURCE_DIR}/regress/gui/gui_test.sh"
"GUI_SMOKE_ACTION=${CMAKE_CURRENT_SOURCE_DIR}/example_action.sh"
COMMAND "${SH_EXEC}" "${CMAKE_SOURCE_DIR}/regress/gui/gui_smoke.sh"
"Expected title" $<TARGET_FILE:example>
)
```
+7 -7
View File
@@ -2,12 +2,12 @@
set -eu
: "${XMIN_TEST_SHELL:?XMIN_TEST_SHELL is required}"
. "$XMIN_TEST_SHELL"
: "${GUI_TEST_SHELL:?GUI_TEST_SHELL is required}"
. "$GUI_TEST_SHELL"
window=$1
geometry=$("$XMIN_CTL" geometry "$window") ||
xmin_fail "could not query Archer window geometry"
geometry=$("$GUI_TEST_CTL" geometry "$window") ||
gui_fail "could not query Archer window geometry"
set -- $geometry
width=$3
height=$4
@@ -16,9 +16,9 @@ height=$4
# relative to the live geometry so the action is independent of screen size.
command_x=$((width / 4))
command_y=$((height - 27))
"$XMIN_CTL" click "$window" "$command_x" "$command_y" 1
"$XMIN_CTL" type "draw all.g"
"$XMIN_CTL" key enter
"$GUI_TEST_CTL" click "$window" "$command_x" "$command_y" 1
"$GUI_TEST_CTL" type "draw all.g"
"$GUI_TEST_CTL" key enter
ARCHER_DRAW_SETTLE_SECONDS=${ARCHER_DRAW_SETTLE_SECONDS:-1}
sleep "$ARCHER_DRAW_SETTLE_SECONDS"
+13 -13
View File
@@ -18,12 +18,12 @@
# information.
#
###
if {![info exists ::env(XMIN_GUI_LIBRARY)]} {
puts stderr "XMIN_GUI_LIBRARY is required"
if {![info exists ::env(GUI_TEST_LIBRARY)]} {
puts stderr "GUI_TEST_LIBRARY is required"
exit 2
}
source $::env(XMIN_GUI_LIBRARY)
set ::env(ARCHER_PREFS_FILE) [file join $::env(XMIN_TEST_DIR) .archerrc]
source $::env(GUI_TEST_LIBRARY)
set ::env(ARCHER_PREFS_FILE) [file join $::env(GUI_TEST_DIR) .archerrc]
# ArcherCore supports embedding in another Itk widget. Its constructor
# currently performs a synchronous database load after one update, so inspect
@@ -41,16 +41,16 @@ if {[catch {package require Archer 1.0} message options]} {
}
exit 1
}
::xmin::test::capture_background_errors
::gui::test::capture_background_errors
proc ::archer_embedded_check {} {
if {[catch {
set application .embedded
::xmin::test::require {[winfo exists $application]} \
::gui::test::require {[winfo exists $application]} \
"embedded Archer widget was not created"
set inventory [::xmin::test::menu_inventory $application]
::xmin::test::write embedded_menu_inventory $inventory
set inventory [::gui::test::menu_inventory $application]
::gui::test::write embedded_menu_inventory $inventory
foreach labels {
{File Save}
@@ -66,8 +66,8 @@ proc ::archer_embedded_check {} {
{Raytrace rt 512x512}
{Help {About Archer...}}
} {
::xmin::test::require {
[::xmin::test::find_menu_entry $application $labels] ne ""
::gui::test::require {
[::gui::test::find_menu_entry $application $labels] ne ""
} "missing embedded Archer menu entry: [join $labels { > }]"
}
@@ -76,8 +76,8 @@ proc ::archer_embedded_check {} {
{File Revert}
{File Raytrace}
} {
::xmin::test::require {
[::xmin::test::find_menu_entry $application $labels] eq ""
::gui::test::require {
[::gui::test::find_menu_entry $application $labels] eq ""
} "unexpected embedded Archer menu entry: [join $labels { > }]"
}
} message options]} {
@@ -90,7 +90,7 @@ proc ::archer_embedded_check {} {
}
catch {update}
lassign [::xmin::test::check_background_errors 0 \
lassign [::gui::test::check_background_errors 0 \
"PASS: embedded Archer menu construction"] status result
puts $result
if {$status != 0} {
+134
View File
@@ -0,0 +1,134 @@
# A R C H E R _ G E O M E T R Y _ X M I N _ G U I . T C L
# BRL-CAD
#
# Copyright (c) 2026 United States Government as represented by
# the U.S. Army Research Laboratory.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# version 2.1 as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this file; see the file named COPYING for more
# information.
#
###
if {![info exists ::env(GUI_TEST_LIBRARY)]} {
puts stderr "GUI_TEST_LIBRARY is required"
exit 2
}
source $::env(GUI_TEST_LIBRARY)
set ::env(ARCHER_PREFS_FILE) [file join $::env(GUI_TEST_DIR) .archerrc]
proc archer_geometry_preferences {{geometry ""}} {
set channel [open $::env(ARCHER_PREFS_FILE) w]
if {$geometry ne ""} {
puts $channel [list set mWindowGeometry $geometry]
}
close $channel
}
proc archer_geometry_saved {} {
set channel [open $::env(ARCHER_PREFS_FILE) r]
set contents [read $channel]
close $channel
if {[regexp -line {^set mWindowGeometry (.+)$} $contents -> geometry]} {
return $geometry
}
return ""
}
proc archer_geometry_settle {} {
# Allow MapNotify and the deferred geometry restore to reach the event loop.
set settle_delay_ms 100
after $settle_delay_ms [list set ::archer_geometry_settled 1]
vwait ::archer_geometry_settled
update
::gui::test::require_no_background_errors
}
if {[catch {
package require Archer 1.0
::gui::test::capture_background_errors
wm withdraw .
set saved_geometry 900x650+120+90
set startup_geometry 1000x700+20+30
set updated_geometry 950x680+60+70
set default_geometry 920x660+40+50
archer_geometry_preferences $saved_geometry
Archer .unmapped
::gui::test::require {[wm state .unmapped] eq "withdrawn"} \
"startup fixture unexpectedly showed its window"
::itcl::delete object .unmapped
archer_geometry_settle
::gui::test::require {[archer_geometry_saved] eq $saved_geometry} \
"closing an unmapped Archer replaced its saved geometry"
archer_geometry_preferences
Archer .unmapped_new
::itcl::delete object .unmapped_new
archer_geometry_settle
::gui::test::require {[archer_geometry_saved] eq ""} \
"closing an unmapped Archer saved an unfinished layout size"
archer_geometry_preferences $saved_geometry
Archer .restore
.restore configure -geometry $startup_geometry
wm geometry .restore $startup_geometry
event generate [.restore component hpane] <Map>
archer_geometry_settle
::gui::test::require {[wm geometry .restore] eq $startup_geometry} \
"a child Map event restored the main window's geometry prematurely"
wm deiconify .restore
archer_geometry_settle
::gui::test::require {[wm geometry .restore] eq $saved_geometry} \
"mapping the main window did not restore its saved geometry"
wm geometry .restore $updated_geometry
event generate [.restore component hpane] <Map>
archer_geometry_settle
::gui::test::require {[wm geometry .restore] eq $updated_geometry} \
"a later child Map event reset the resized main window"
wm withdraw .restore
::itcl::delete object .restore
archer_geometry_settle
::gui::test::require {[archer_geometry_saved] eq $updated_geometry} \
"closing a previously mapped window did not save its latest geometry"
archer_geometry_preferences
Archer .default
wm geometry .default $default_geometry
wm deiconify .default
archer_geometry_settle
::gui::test::require {[wm geometry .default] eq $default_geometry} \
"an empty geometry option reset the window to its layout size"
wm withdraw .default
::itcl::delete object .default
archer_geometry_settle
} message options]} {
puts stderr $message
if {[dict exists $options -errorinfo]} {
puts stderr [dict get $options -errorinfo]
}
puts "FAIL: Archer window geometry regression"
exit 1
}
puts "PASS: Archer window geometry restoration and startup cancellation"
exit 0
# Local Variables:
# tab-width: 8
# mode: Tcl
# tcl-indent-level: 4
# indent-tabs-mode: t
# End:
# ex: shiftwidth=4 tabstop=8
+2 -2
View File
@@ -2,14 +2,14 @@
set -eu
: "${XMIN_ARTIFACT_DIR:?XMIN_ARTIFACT_DIR is required}"
: "${GUI_ARTIFACT_DIR:?GUI_ARTIFACT_DIR is required}"
if [ "$#" -lt 1 ]; then
echo "Usage: $0 archer [argument ...]" >&2
exit 2
fi
ARCHER_PREFS_FILE="$XMIN_ARTIFACT_DIR/.archerrc"
ARCHER_PREFS_FILE="$GUI_ARTIFACT_DIR/.archerrc"
export ARCHER_PREFS_FILE
exec "$@"
+63 -62
View File
@@ -18,14 +18,15 @@
# information.
#
###
if {![info exists ::env(XMIN_GUI_LIBRARY)] ||
if {![info exists ::env(GUI_TEST_LIBRARY)] ||
![info exists ::env(ARCHER_LAUNCH)] ||
![info exists ::env(ARCHER_TEST_DATABASE)]} {
puts stderr "XMIN_GUI_LIBRARY, ARCHER_LAUNCH, and ARCHER_TEST_DATABASE are required"
puts stderr "GUI_TEST_LIBRARY, ARCHER_LAUNCH, and ARCHER_TEST_DATABASE are required"
exit 2
}
source $::env(XMIN_GUI_LIBRARY)
set ::env(ARCHER_PREFS_FILE) [file join $::env(XMIN_TEST_DIR) .archerrc]
source $::env(GUI_TEST_LIBRARY)
source [file join [file dirname $::env(GUI_TEST_LIBRARY)] sketch_test.tcl]
set ::env(ARCHER_PREFS_FILE) [file join $::env(GUI_TEST_DIR) .archerrc]
namespace eval ::archer::xmin {
variable application ""
@@ -44,7 +45,7 @@ proc ::archer::xmin::finish {status message} {
}
catch {destroy .}
catch {update}
lassign [::xmin::test::check_background_errors $status $message] \
lassign [::gui::test::check_background_errors $status $message] \
status message
puts $message
if {$status != 0} {
@@ -55,7 +56,7 @@ proc ::archer::xmin::finish {status message} {
proc ::archer::xmin::toplevels {} {
set toplevels {}
foreach widget [linsert [::xmin::test::descendants .] 0 .] {
foreach widget [linsert [::gui::test::descendants .] 0 .] {
if {[winfo toplevel $widget] eq $widget} {
lappend toplevels $widget
}
@@ -88,18 +89,18 @@ proc ::archer::xmin::exercise_dialog {root labels {expected_title ""}} {
variable dialog_timeout_ms
set dialog_seen ""
after $dialog_poll_delay_ms ::archer::xmin::dismiss_dialog
::xmin::test::invoke_menu_entry $root $labels
::gui::test::invoke_menu_entry $root $labels
if {$dialog_seen eq ""} {
set timeout [after $dialog_timeout_ms \
[list set ::archer::xmin::dialog_seen $dialog_timeout_marker]]
vwait ::archer::xmin::dialog_seen
after cancel $timeout
}
::xmin::test::require {
::gui::test::require {
$dialog_seen ne "" && $dialog_seen ne $dialog_timeout_marker} \
"menu entry did not display a dialog: [join $labels { > }]"
if {$expected_title ne ""} {
::xmin::test::require {$dialog_seen eq $expected_title} \
::gui::test::require {$dialog_seen eq $expected_title} \
"unexpected dialog title '$dialog_seen', expected '$expected_title'"
}
}
@@ -112,7 +113,7 @@ proc ::archer::xmin::compare_manifest {actual} {
set expected [string trim [read $channel]]
close $channel
if {$actual ne $expected} {
::xmin::test::write menu_inventory_actual $actual
::gui::test::write menu_inventory_actual $actual
error "live Archer menu inventory differs from its manifest"
}
}
@@ -138,7 +139,7 @@ proc ::archer::xmin::exercise_object_lifecycle {
error "$class $cycle initialization failed: $message"
}
update
::xmin::test::require {
::gui::test::require {
[llength [info commands $object]] == 1 &&
[winfo exists $object]
} "$class $cycle construction did not retain its object and window"
@@ -149,7 +150,7 @@ proc ::archer::xmin::exercise_object_lifecycle {
error "$class $cycle destruction failed: $message"
}
update
::xmin::test::require {
::gui::test::require {
[llength [info commands $object]] == 0 &&
![winfo exists $object]
} "$class $cycle destruction retained its object or window"
@@ -182,8 +183,8 @@ proc ::archer::xmin::require_arb_standard_storage {ged geometry_name primitive}
set expected [$ged get $geometry_name [lindex $group 0]]
foreach attribute [lrange $group 1 end] {
set actual [$ged get $geometry_name $attribute]
::xmin::test::require {
[::xmin::test::equivalent_values $actual $expected]
::gui::test::require {
[::gui::test::equivalent_values $actual $expected]
} "$primitive storage is nonstandard: [lindex $group 0]=$expected, $attribute=$actual"
}
}
@@ -208,8 +209,8 @@ proc ::archer::xmin::exercise_arb_editor_fields {
set storage_attribute [arb_storage_attribute $primitive $logical_vertex]
set actual [lindex [$ged get $geometry_name $storage_attribute] $component_index]
::xmin::test::require {
[::xmin::test::equivalent_values $actual $requested]
::gui::test::require {
[::gui::test::equivalent_values $actual $requested]
} "$primitive $component_name wrote $actual instead of $requested to $storage_attribute"
require_arb_standard_storage $ged $geometry_name $primitive
@@ -228,8 +229,8 @@ proc ::archer::xmin::exercise_editor_update {
set original [$ged get $geometry_name]
$object updateGeometry
set updated [$ged get $geometry_name]
::xmin::test::require \
[::xmin::test::equivalent_values $updated $original] \
::gui::test::require \
[::gui::test::equivalent_values $updated $original] \
"$class changed geometry during an unmodified update: original={$original}, updated={$updated}"
if {[regexp {^Arb([4-8])EditFrame$} $class unused arb_type]} {
exercise_arb_editor_fields $object $ged $geometry_name \
@@ -308,29 +309,29 @@ proc ::archer::xmin::exercise_wizard_build {
error "$class geometry generation failed: $result"
}
::xmin::test::require {$result eq $top} "$class returned '$result' instead of its top object '$top'"
::xmin::test::require {[$ged exists $top]} "$class did not create its top database object '$top'"
::xmin::test::require {
::gui::test::require {$result eq $top} "$class returned '$result' instead of its top object '$top'"
::gui::test::require {[$ged exists $top]} "$class did not create its top database object '$top'"
::gui::test::require {
[$ged attr get $top WizardClass] eq $class
} "$class did not identify its generated database object"
::xmin::test::require {
::gui::test::require {
[llength [$object getWizardState]] > 0
} "$class did not retain its generation parameters"
::xmin::test::require {
::gui::test::require {
[lsearch -exact [$ged who] $top] >= 0
} "$class did not draw its generated database object"
if {$class eq "TankWizard"} {
::xmin::test::require {
::gui::test::require {
[$ged exists ${top}_gun_tube.r]
} "TankWizard omitted its transformed gun-barrel region"
set xml [$object buildTankXML]
::xmin::test::require {
::gui::test::require {
[string first "<Name>$top</Name>" $xml] >= 0 &&
[string first "<Name>Gun Barrel</Name>" $xml] >= 0
} "TankWizard XML omitted its top system or gun component"
set open_systems [llength [regexp -all -inline {<System>} $xml]]
set close_systems [llength [regexp -all -inline {</System>} $xml]]
::xmin::test::require {
::gui::test::require {
$open_systems > 10 && $open_systems == $close_systems
} "TankWizard XML has unbalanced system elements"
}
@@ -385,22 +386,22 @@ proc ::archer::xmin::exercise_attribute_groups_utility {application} {
AttrGroupsDisplayUtilityP $object $application
update
set group_list [$object component glist]
::xmin::test::require {
::gui::test::require {
[$group_list get 0 end] eq "Xmin"
} "attribute-groups utility did not load its database definition"
$group_list selection set 0
uplevel #0 [$group_list cget -selectioncommand]
::xmin::test::require {
::gui::test::require {
[$object getCurrentGroup] eq "Xmin"
} "attribute-groups utility did not select its group"
set attribute_list [$object component alist]
::xmin::test::require {
::gui::test::require {
[$attribute_list get 0 end] eq "alpha beta"
} "attribute-groups utility did not load the grouped values"
$attribute_list selection set 0
set highlighted [$object highlightSelectedAttr]
::xmin::test::require {
::gui::test::require {
[lsearch -exact [lindex $highlighted 0] xmin-attr-alpha.s] >= 0
} "attribute-groups utility did not resolve and highlight the selected value"
::itcl::delete object $object
@@ -416,7 +417,7 @@ proc ::archer::xmin::exercise_lod_utility {application} {
update
set dialog "$object.lodDialog"
::xmin::test::require {
::gui::test::require {
[llength [info commands $dialog]] == 1 && [winfo exists $dialog]
} "LOD utility did not create its configuration dialog"
set frame "$dialog.lodFrame"
@@ -428,7 +429,7 @@ proc ::archer::xmin::exercise_lod_utility {application} {
update
set updated_points [$ged lod scale points]
set updated_curves [$ged lod scale curves]
::xmin::test::require {
::gui::test::require {
abs($updated_points - 0.7) < 1.0e-9 &&
abs($updated_curves - 9.0) < 1.0e-9
} "LOD utility controls set points=$updated_points and curves=$updated_curves"
@@ -457,7 +458,7 @@ proc ::archer::xmin::exercise_bot_utility {application} {
BotUtilityP $object $application
update
set selector [$object component combo]
::xmin::test::require {
::gui::test::require {
[lsearch -exact [$selector cget -values] $bot] >= 0
} "BoT utility did not list its available mesh"
$object configure -selectedbot $bot
@@ -471,7 +472,7 @@ proc ::archer::xmin::exercise_bot_utility {application} {
lappend editors $editor
}
}
::xmin::test::require {
::gui::test::require {
[llength $editors] == 1 && [$ged exists "$bot.edit"]
} "BoT utility did not launch an Archer-backed editor with a working copy"
set editor [lindex $editors 0]
@@ -507,11 +508,11 @@ proc ::archer::xmin::exercise_combination_edit {application} {
set combination [lrange [$ged get xmin-tree.c] 1 end]
set original_tree [bu_get_value_by_keyword tree $combination]
set flattened_tree [ArcherCore::unpackTree $original_tree]
::xmin::test::require {
::gui::test::require {
[ArcherCore::packTree $flattened_tree] ne $original_tree
} "Archer combination fixture does not exercise a lossy tree grouping"
set spaced_leaf [list l [lindex $members 1]]
::xmin::test::require {
::gui::test::require {
[ArcherCore::packTree [ArcherCore::unpackTree $spaced_leaf]] eq $spaced_leaf
} "Archer tree editor did not preserve a member name containing spaces"
@@ -527,9 +528,9 @@ proc ::archer::xmin::exercise_combination_edit {application} {
set updated [lrange [$ged get xmin-tree.c] 1 end]
set updated_tree [bu_get_value_by_keyword tree $updated]
set updated_rgb [bu_get_value_by_keyword rgb $updated]
::xmin::test::require {$updated_tree eq $original_tree} \
::gui::test::require {$updated_tree eq $original_tree} \
"editing a combination attribute changed its Boolean tree"
::xmin::test::require {$updated_rgb eq "17 34 51"} \
::gui::test::require {$updated_rgb eq "17 34 51"} \
"Archer did not apply the requested combination color"
::itcl::delete object $editor
exercise_object_lifecycle CombEditFrame $editor \
@@ -547,7 +548,7 @@ proc ::archer::xmin::exercise_combination_edit {application} {
break
}
}
::xmin::test::require {$combination_node ne ""} \
::gui::test::require {$combination_node ne ""} \
"Archer hierarchy omitted the test combination"
$tree focus $combination_node
$tree item $combination_node -open true
@@ -557,7 +558,7 @@ proc ::archer::xmin::exercise_combination_edit {application} {
foreach child [$tree children $combination_node] {
lappend child_names [$tree item $child -text]
}
::xmin::test::require {[lsort $child_names] eq [lsort $members]} \
::gui::test::require {[lsort $child_names] eq [lsort $members]} \
"Archer hierarchy reported the wrong combination members: $child_names"
}
@@ -586,7 +587,7 @@ proc ::archer::xmin::exercise_raytrace_abort {application} {
set raytrace_button [$toolbar component raytrace]
set launch_command [$toolbar itemcget raytrace -command]
::xmin::test::require {
::gui::test::require {
[string first raytracePlus $launch_command] >= 0
} "Archer raytrace toolbar button does not start a raytrace"
@@ -597,14 +598,14 @@ proc ::archer::xmin::exercise_raytrace_abort {application} {
$raytrace_button invoke
set abort_command [$toolbar itemcget raytrace -command]
::xmin::test::require {
::gui::test::require {
$abort_command ne $launch_command &&
[string first abort $abort_command] >= 0
} "Archer did not turn its raytrace toolbar button into Abort"
$raytrace_button invoke
wait_for {$raytrace_aborted ne ""} "RtWizard abort callback"
::xmin::test::require {$raytrace_aborted} \
::gui::test::require {$raytrace_aborted} \
"Archer reported normal completion after the Abort action"
wait_for {
[string first raytracePlus [$toolbar itemcget raytrace -command]] >= 0
@@ -614,22 +615,22 @@ proc ::archer::xmin::exercise_raytrace_abort {application} {
proc ::archer::xmin::run {} {
variable application
set application $::ArcherCore::application
::xmin::test::require {[llength [info commands $application]] == 1} \
::gui::test::require {[llength [info commands $application]] == 1} \
"Archer application object was not created"
::xmin::test::require {[winfo ismapped $application]} \
::gui::test::require {[winfo ismapped $application]} \
"Archer main window is not mapped"
::xmin::test::require {[string match {Archer *} [wm title $application]]} \
::gui::test::require {[string match {Archer *} [wm title $application]]} \
"unexpected Archer main-window title"
set opened_database [$application WhatsOpen]
::xmin::test::require {
::gui::test::require {
[file normalize $opened_database] eq [file normalize $::env(ARCHER_WORK_DATABASE)]
} "Archer did not open the relative database argument"
set widget_inventory [::xmin::test::widget_inventory $application]
set menu_inventory [::xmin::test::menu_inventory $application]
::xmin::test::write widget_inventory $widget_inventory
::xmin::test::write menu_inventory $menu_inventory
set widget_inventory [::gui::test::widget_inventory $application]
set menu_inventory [::gui::test::menu_inventory $application]
::gui::test::write widget_inventory $widget_inventory
::gui::test::write menu_inventory $menu_inventory
compare_manifest $menu_inventory
foreach labels {
@@ -641,27 +642,27 @@ proc ::archer::xmin::run {} {
{Help {Archer Help...}}
{Help {About Archer...}}
} {
::xmin::test::require {
[::xmin::test::find_menu_entry $application $labels] ne ""
::gui::test::require {
[::gui::test::find_menu_entry $application $labels] ne ""
} "missing Archer menu entry: [join $labels { > }]"
}
$application draw all.g
update
::xmin::test::require {
::gui::test::require {
[lsearch -exact [$application gedCmd who] all.g] >= 0
} "Archer did not draw all.g"
::xmin::test::invoke_menu_entry $application \
::gui::test::invoke_menu_entry $application \
{Display {Standard Views} Front}
set aet [$application gedCmd aet]
::xmin::test::require {
::gui::test::require {
abs([lindex $aet 0]) < 0.001 && abs([lindex $aet 1]) < 0.001
} "Front menu entry did not set the expected view: $aet"
::xmin::test::invoke_menu_entry $application \
::gui::test::invoke_menu_entry $application \
{Display {Background Color} Black}
::xmin::test::require {
::gui::test::require {
[$application gedCmd bg] eq "0 0 0"
} "Black background menu entry did not update the display"
@@ -672,7 +673,7 @@ proc ::archer::xmin::run {} {
exercise_dialog $application {Help {About Archer...}} {About Archer}
exercise_combination_edit $application
::xmin::test::exercise_sketch_segments SketchCArc SketchBezier Archer ::archer::xmin
::gui::test::exercise_sketch_segments SketchCArc SketchBezier Archer ::archer::xmin
exercise_wizard_builds $application
exercise_editor_lifecycles $application
exercise_plugin_lifecycles $application
@@ -692,10 +693,10 @@ proc ::archer::xmin::run_checked {} {
}
}
set work_database [file join $::env(XMIN_TEST_DIR) archer-relative.g]
set work_database [file join $::env(GUI_TEST_DIR) archer-relative.g]
file copy -force $::env(ARCHER_TEST_DATABASE) $work_database
set ::env(ARCHER_WORK_DATABASE) $work_database
cd $::env(XMIN_TEST_DIR)
cd $::env(GUI_TEST_DIR)
set argv [list [file tail $work_database]]
set argc 1
set argv0 [info nameofexecutable]
@@ -707,7 +708,7 @@ if {[catch {source $::env(ARCHER_LAUNCH)} message options]} {
}
exit 1
}
::xmin::test::capture_background_errors
::gui::test::capture_background_errors
# Let the splash timer finish so it cannot obscure dialog discovery.
after 1800 ::archer::xmin::run_checked
+231 -264
View File
@@ -17,25 +17,16 @@ MIN_RENDER_CHANGED_CHANNELS=100
MIN_REFERENCE_EXACT_PERCENT=90
MAX_RAYTRACE_ELAPSED_MS=5000
RGB_CHANNELS=3
SCREEN_GEOMETRY=1280x960x24
SCREEN_WIDTH=${SCREEN_GEOMETRY%%x*}
screen_height_depth=${SCREEN_GEOMETRY#*x}
SCREEN_HEIGHT=${screen_height_depth%%x*}
COMMAND_GEOMETRY=680x520+0+0
GRAPHICS_GEOMETRY=512x512+700+0
MGED_TEST_SHELL=${MGED_TEST_SHELL:-sh}
: "${GUI_TEST_SHELL:?GUI_TEST_SHELL is required}"
. "$GUI_TEST_SHELL"
GUI_STABLE_QUIET_MS=$STABLE_QUIET
GUI_STABLE_TIMEOUT_MS=$STABLE_TIMEOUT
TOP_LEVEL_MENUS="file:File edit:Edit create:Create view:View viewring:ViewRing settings:Settings modes:Modes misc:Misc tools:Tools help:Help"
MGED_DM_TYPES=${MGED_DM_TYPES:-tkswrast}
MGED_GUI_APNG_DIR=${MGED_GUI_APNG_DIR:-.}
MGED_PIPE_ORACLE=${MGED_PIPE_ORACLE:-${MGED_XMIN_RC%/*}/xmin_gui_pipe_oracle.tcl}
require_executable()
{
if [ ! -x "$1" ]; then
echo "FAIL: required executable is unavailable: $1" >&2
exit 1
fi
}
MGED_PIPE_ORACLE=${MGED_PIPE_ORACLE:-${MGED_GUI_RC%/*}/xmin_gui_pipe_oracle.tcl}
wait_for_file()
{
@@ -51,7 +42,7 @@ wait_for_file_with_limit()
if [ -s "$path" ]; then
return 0
fi
if [ -s "$MGED_XMIN_TEST_DIR/result" ]; then
if [ -s "$MGED_GUI_TEST_DIR/result" ]; then
return 1
fi
if [ -n "${MGED_PID:-}" ] && ! kill -0 "$MGED_PID" 2>/dev/null; then
@@ -70,7 +61,7 @@ wait_for_value()
if [ -f "$1" ] && [ "$(sed -n '1p' "$1")" = "$2" ]; then
return 0
fi
if [ -s "$MGED_XMIN_TEST_DIR/result" ]; then
if [ -s "$MGED_GUI_TEST_DIR/result" ]; then
return 1
fi
sleep "$WAIT_DELAY"
@@ -86,7 +77,7 @@ wait_for_not_value()
if [ -s "$1" ] && [ "$(sed -n '1p' "$1")" != "$2" ]; then
return 0
fi
if [ -s "$MGED_XMIN_TEST_DIR/result" ]; then
if [ -s "$MGED_GUI_TEST_DIR/result" ]; then
return 1
fi
sleep "$WAIT_DELAY"
@@ -100,17 +91,17 @@ start_raytrace()
# xminctl can return before Tk handles the click. Wait for the button
# callback before enabling the monitor's MGED command polling.
click_target raytrace_button
if ! wait_for_value "$MGED_XMIN_TEST_DIR/raytrace_invocations" "$1"; then
if ! wait_for_value "$MGED_GUI_TEST_DIR/raytrace_invocations" "$1"; then
fail "Raytrace Control Panel did not process button click $1"
fi
printf '%s\n' "$1" > "$MGED_XMIN_TEST_DIR/raytrace_request"
printf '%s\n' "$1" > "$MGED_GUI_TEST_DIR/raytrace_request"
}
query_database()
{
database=$1
query=$2
error_file="$MGED_XMIN_TEST_DIR/database_query_error"
error_file="$MGED_GUI_TEST_DIR/database_query_error"
count=0
while [ "$count" -lt "$DATABASE_QUERY_LIMIT" ]; do
if DATABASE_VALUE=$("$MGED_BIN" -c "$database" "$query" 2>"$error_file"); then
@@ -137,24 +128,24 @@ read_point()
read_target()
{
TARGET_WINDOW=$(sed -n '1p' "$MGED_XMIN_TEST_DIR/$1_window")
read_point "$MGED_XMIN_TEST_DIR/$1"
TARGET_WINDOW=$(sed -n '1p' "$MGED_GUI_TEST_DIR/$1_window")
read_point "$MGED_GUI_TEST_DIR/$1"
}
click_target()
{
read_target "$1"
"$XMIN_CTL" click --delay "$CLICK_DELAY" "$TARGET_WINDOW" "$POINT_X" "$POINT_Y" "${2:-1}"
"$GUI_TEST_CTL" click --delay "$CLICK_DELAY" "$TARGET_WINDOW" "$POINT_X" "$POINT_Y" "${2:-1}"
}
activate_menu_target()
{
read_target "$1"
"$XMIN_CTL" mouse-move "$TARGET_WINDOW" "$POINT_X" "$POINT_Y"
"$XMIN_CTL" wait-stable --quiet "$STABLE_QUIET" \
"$GUI_TEST_CTL" mouse-move "$TARGET_WINDOW" "$POINT_X" "$POINT_Y"
"$GUI_TEST_CTL" wait-stable --quiet "$STABLE_QUIET" \
--timeout "$STABLE_TIMEOUT" root >/dev/null 2>&1 || true
"$XMIN_CTL" button 1 down
"$XMIN_CTL" button 1 up
"$GUI_TEST_CTL" button 1 down
"$GUI_TEST_CTL" button 1 up
}
replace_entry_text()
@@ -165,14 +156,14 @@ replace_entry_text()
expected_value=$4
click_target "$target"
"$XMIN_CTL" key end
"$GUI_TEST_CTL" key end
remaining=${#initial_value}
while [ "$remaining" -gt 0 ]; do
"$XMIN_CTL" key backspace
"$GUI_TEST_CTL" key backspace
remaining=$((remaining - 1))
done
wait_for_value "$current_file" "" || return 1
"$XMIN_CTL" type "$expected_value"
"$GUI_TEST_CTL" type "$expected_value"
wait_for_value "$current_file" "$expected_value"
}
@@ -183,8 +174,8 @@ capture_failure()
capture_frame()
{
frames_dir="$MGED_XMIN_RUN_DIR/frames"
counter_file="$MGED_XMIN_RUN_DIR/frame_counter"
frames_dir="$MGED_GUI_RUN_DIR/frames"
counter_file="$MGED_GUI_RUN_DIR/frame_counter"
"$CMAKE_COMMAND" -E make_directory "$frames_dir"
frame_number=0
@@ -194,14 +185,14 @@ capture_frame()
frame_number=$((frame_number + 1))
frame_name=$(printf '%06d.ppm' "$frame_number")
"$XMIN_CTL" wait-stable --quiet "$STABLE_QUIET" \
"$GUI_TEST_CTL" wait-stable --quiet "$STABLE_QUIET" \
--timeout "$STABLE_TIMEOUT" root >/dev/null 2>&1 || true
if ! "$XMIN_CTL" capture-root "$frames_dir/$frame_name" >/dev/null 2>&1; then
if ! "$GUI_TEST_CTL" capture-screen "$frames_dir/$frame_name" >/dev/null 2>&1; then
return 1
fi
printf '%s\n' "$frame_number" > "$counter_file"
printf '%06d %s %s\n' "$frame_number" "$MGED_DM_TYPE" "$1" \
>> "$MGED_XMIN_RUN_DIR/frames.log"
>> "$MGED_GUI_RUN_DIR/frames.log"
}
record_state()
@@ -213,29 +204,13 @@ record_state()
capture_dm_snapshot()
{
snapshot="$MGED_XMIN_TEST_DIR/$1.ppm"
root_snapshot="$MGED_XMIN_TEST_DIR/$1-root.ppm"
root_pixels="$MGED_XMIN_TEST_DIR/$1-root.pix"
cropped_pixels="$MGED_XMIN_TEST_DIR/$1-cropped.pix"
snapshot="$MGED_GUI_TEST_DIR/$1.ppm"
read -r dm_x dm_y dm_width dm_height \
< "$MGED_XMIN_TEST_DIR/active_dm_geometry"
lower_y=$((SCREEN_HEIGHT - dm_y - dm_height))
upper_y=$((lower_y + dm_height - 1))
right_x=$((dm_x + dm_width - 1))
"$XMIN_CTL" wait-stable --quiet "$STABLE_QUIET" \
--timeout "$STABLE_TIMEOUT" root >/dev/null 2>&1 || true
if ! "$XMIN_CTL" capture-root "$root_snapshot" >/dev/null 2>&1 ||
! "$ICV_BIN" "$root_snapshot" "$root_pixels" >/dev/null 2>&1 ||
! "$PIXCROP_BIN" "$root_pixels" "$cropped_pixels" \
"$SCREEN_WIDTH" "$dm_width" "$dm_height" \
"$dm_x" "$upper_y" "$right_x" "$upper_y" \
"$right_x" "$lower_y" "$dm_x" "$lower_y" >/dev/null 2>&1 ||
! "$ICV_BIN" -w "$dm_width" -n "$dm_height" \
"$cropped_pixels" "$snapshot" >/dev/null 2>&1; then
< "$MGED_GUI_TEST_DIR/active_dm_geometry"
if ! gui_capture_region "$snapshot" "$dm_x" "$dm_y" \
"$dm_width" "$dm_height"; then
fail "could not capture display-manager snapshot '$1'"
fi
"$CMAKE_COMMAND" -E rm -f "$root_snapshot" "$root_pixels" "$cropped_pixels"
}
assert_raw_images_equal()
@@ -315,7 +290,7 @@ wait_for_changed_dm_snapshot()
description=$1
baseline=$2
snapshot_name=$3
snapshot="$MGED_XMIN_TEST_DIR/$snapshot_name.ppm"
snapshot="$MGED_GUI_TEST_DIR/$snapshot_name.ppm"
count=0
changed_channels=0
@@ -341,7 +316,7 @@ assert_raytrace_duration()
{
request=$1
description=$2
elapsed_file="$MGED_XMIN_TEST_DIR/raytrace_elapsed_${request}_ms"
elapsed_file="$MGED_GUI_TEST_DIR/raytrace_elapsed_${request}_ms"
if ! wait_for_file "$elapsed_file"; then
fail "$description did not report its elapsed time"
fi
@@ -358,8 +333,8 @@ assert_raytrace_duration()
toggle_renderer_setting()
{
setting=$1
initial=$(sed -n '1p' "$MGED_XMIN_TEST_DIR/renderer_${setting}_initial")
mutable=$(sed -n '1p' "$MGED_XMIN_TEST_DIR/renderer_${setting}_mutable")
initial=$(sed -n '1p' "$MGED_GUI_TEST_DIR/renderer_${setting}_initial")
mutable=$(sed -n '1p' "$MGED_GUI_TEST_DIR/renderer_${setting}_mutable")
if [ "$initial" -eq 0 ]; then
expected=1
else
@@ -367,13 +342,13 @@ toggle_renderer_setting()
fi
click_target main_misc_menu
if ! wait_for_file "$MGED_XMIN_TEST_DIR/renderer_${setting}" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/renderer_${setting}_window"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/renderer_${setting}" ||
! wait_for_file "$MGED_GUI_TEST_DIR/renderer_${setting}_window"; then
fail "Misc menu did not expose $setting"
fi
record_state "Misc menu $setting"
activate_menu_target "renderer_${setting}"
if ! wait_for_value "$MGED_XMIN_TEST_DIR/renderer_${setting}_gui_current" "$expected"; then
if ! wait_for_value "$MGED_GUI_TEST_DIR/renderer_${setting}_gui_current" "$expected"; then
fail "$setting menu state did not change to $expected"
fi
backend_expected=$expected
@@ -382,7 +357,7 @@ toggle_renderer_setting()
backend_expected=$initial
state_description="requested state $expected (backend unavailable)"
fi
if ! wait_for_value "$MGED_XMIN_TEST_DIR/renderer_${setting}_current" \
if ! wait_for_value "$MGED_GUI_TEST_DIR/renderer_${setting}_current" \
"$backend_expected"; then
fail "$setting backend state did not become $backend_expected"
fi
@@ -391,17 +366,17 @@ toggle_renderer_setting()
click_target main_misc_menu
record_state "Misc menu $setting restore"
activate_menu_target "renderer_${setting}"
if ! wait_for_value "$MGED_XMIN_TEST_DIR/renderer_${setting}_gui_current" "$initial"; then
if ! wait_for_value "$MGED_GUI_TEST_DIR/renderer_${setting}_gui_current" "$initial"; then
fail "$setting menu state did not return to $initial"
fi
if ! wait_for_value "$MGED_XMIN_TEST_DIR/renderer_${setting}_current" "$initial"; then
if ! wait_for_value "$MGED_GUI_TEST_DIR/renderer_${setting}_current" "$initial"; then
fail "$setting did not return to $initial"
fi
}
create_recording()
{
frames_dir="$MGED_XMIN_RUN_DIR/frames"
frames_dir="$MGED_GUI_RUN_DIR/frames"
set -- "$frames_dir"/*.ppm
if [ ! -f "$1" ]; then
echo "FAIL: MGED GUI run did not produce recording frames" >&2
@@ -417,14 +392,14 @@ create_recording()
return 1
fi
validation_dir="$MGED_XMIN_RUN_DIR/apng_validation"
validation_dir="$MGED_GUI_RUN_DIR/apng_validation"
"$CMAKE_COMMAND" -E make_directory "$validation_dir"
if ! "$ICV_BIN" anim extract "$apng" "$validation_dir/frame_" \
>/dev/null 2>&1; then
echo "FAIL: could not reopen MGED GUI recording $apng" >&2
return 1
fi
expected_frames=$(sed -n '1p' "$MGED_XMIN_RUN_DIR/frame_counter")
expected_frames=$(sed -n '1p' "$MGED_GUI_RUN_DIR/frame_counter")
actual_frames=$(find "$validation_dir" -type f -name '*.png' | wc -l | tr -d ' ')
if [ "$actual_frames" -ne "$expected_frames" ]; then
echo "FAIL: APNG has $actual_frames frames; expected $expected_frames" >&2
@@ -448,32 +423,28 @@ fail()
MGED_PID=""
echo "MGED exited with status $mged_status" >&2
fi
if [ -f "$MGED_XMIN_TEST_DIR/result" ]; then
sed -n '1,20p' "$MGED_XMIN_TEST_DIR/result" >&2
if [ -f "$MGED_GUI_TEST_DIR/result" ]; then
sed -n '1,20p' "$MGED_GUI_TEST_DIR/result" >&2
fi
for diagnostic in "$MGED_XMIN_TEST_DIR"/*_debug; do
for diagnostic in "$MGED_GUI_TEST_DIR"/*_debug; do
if [ -f "$diagnostic" ]; then
echo "$(basename "$diagnostic"): $(sed -n '1,20p' "$diagnostic")" >&2
fi
done
if [ -f "$MGED_XMIN_TEST_DIR/mged.log" ]; then
if [ -f "$MGED_GUI_TEST_DIR/mged.log" ]; then
echo "MGED log follows:" >&2
sed -n '1,240p' "$MGED_XMIN_TEST_DIR/mged.log" >&2
sed -n '1,240p' "$MGED_GUI_TEST_DIR/mged.log" >&2
fi
exit 1
}
if [ "${MGED_XMIN_INNER:-0}" -eq 0 ]; then
require_executable "$MGED_BIN"
require_executable "$XMIN_CTL"
if [ "${MGED_XMIN_ACTIVE_SESSION:-0}" -eq 0 ]; then
require_executable "$XMIN_RUN"
require_executable "$XMIN_SERVER"
fi
require_executable "$ICV_BIN"
require_executable "$PIXCROP_BIN"
if [ ! -f "$MGED_XMIN_RC" ]; then
echo "FAIL: MGED Xmin rc file is unavailable: $MGED_XMIN_RC" >&2
if [ "${MGED_GUI_INNER:-0}" -eq 0 ]; then
gui_require_executable "$MGED_BIN"
gui_require_executable "$GUI_TEST_CTL"
gui_require_executable "$ICV_BIN"
gui_require_executable "$PIXCROP_BIN"
if [ ! -f "$MGED_GUI_RC" ]; then
echo "FAIL: MGED GUI rc file is unavailable: $MGED_GUI_RC" >&2
exit 1
fi
if [ ! -f "$MGED_PIPE_ORACLE" ]; then
@@ -481,40 +452,36 @@ if [ "${MGED_XMIN_INNER:-0}" -eq 0 ]; then
exit 1
fi
MGED_XMIN_RUN_DIR=$(mktemp -d /tmp/mged-xmin-gui.XXXXXX)
export MGED_XMIN_RUN_DIR
MGED_GUI_RUN_DIR=$(mktemp -d "${TMPDIR:-/tmp}/mged-gui.XXXXXX")
export MGED_GUI_RUN_DIR
run_status=0
cleanup()
{
if [ -n "${MGED_PID:-}" ]; then
kill "$MGED_PID" >/dev/null 2>&1 || true
fi
if [ "${MGED_XMIN_KEEP:-0}" -eq 1 ]; then
echo "MGED Xmin test artifacts: $MGED_XMIN_RUN_DIR" >&2
if [ "${MGED_GUI_KEEP:-0}" -eq 1 ]; then
echo "MGED GUI test artifacts: $MGED_GUI_RUN_DIR" >&2
else
"$CMAKE_COMMAND" -E remove_directory "$MGED_XMIN_RUN_DIR"
"$CMAKE_COMMAND" -E remove_directory "$MGED_GUI_RUN_DIR"
fi
}
trap cleanup EXIT INT TERM
MGED_XMIN_INNER=1
export MGED_XMIN_INNER
MGED_GUI_INNER=1
export MGED_GUI_INNER
for MGED_DM_TYPE in $MGED_DM_TYPES; do
export MGED_DM_TYPE
MGED_XMIN_TEST_DIR="$MGED_XMIN_RUN_DIR/cases/$MGED_DM_TYPE"
export MGED_XMIN_TEST_DIR
"$CMAKE_COMMAND" -E make_directory "$MGED_XMIN_TEST_DIR"
XMIN_TEST_DIR=$MGED_XMIN_TEST_DIR
export XMIN_TEST_DIR
test_db="$MGED_XMIN_TEST_DIR/gui-edit.g"
MGED_GUI_TEST_DIR="$MGED_GUI_RUN_DIR/cases/$MGED_DM_TYPE"
export MGED_GUI_TEST_DIR
"$CMAKE_COMMAND" -E make_directory "$MGED_GUI_TEST_DIR"
GUI_TEST_DIR=$MGED_GUI_TEST_DIR
export GUI_TEST_DIR
test_db="$MGED_GUI_TEST_DIR/gui-edit.g"
"$MGED_BIN" -c "$test_db" "in gui.s sph 0 0 0 10" \
>"$MGED_XMIN_TEST_DIR/create.log" 2>&1
>"$MGED_GUI_TEST_DIR/create.log" 2>&1
set +e
if [ "${MGED_XMIN_ACTIVE_SESSION:-0}" -eq 1 ]; then
"$MGED_TEST_SHELL" "$0"
else
"$XMIN_RUN" --server "$XMIN_SERVER" --screen "$SCREEN_GEOMETRY" -- "$0"
fi
sh "$0"
dm_status=$?
set -e
if [ "$dm_status" -ne 0 ]; then
@@ -528,7 +495,7 @@ if [ "${MGED_XMIN_INNER:-0}" -eq 0 ]; then
fi
if [ "$sphere_vertex" != "5 0 0" ]; then
echo "FAIL: $MGED_DM_TYPE primitive edit stored V {$sphere_vertex}, expected {5 0 0}" >&2
sed -n '1,20p' "$MGED_XMIN_TEST_DIR/database_query_error" >&2
sed -n '1,20p' "$MGED_GUI_TEST_DIR/database_query_error" >&2
run_status=1
break
fi
@@ -540,7 +507,7 @@ if [ "${MGED_XMIN_INNER:-0}" -eq 0 ]; then
run_status=1
break
fi
read -r matrix_x matrix_y < "$MGED_XMIN_TEST_DIR/matrix_expected"
read -r matrix_x matrix_y < "$MGED_GUI_TEST_DIR/matrix_expected"
if query_database "$test_db" "get matrix.c tree"; then
matrix_tree=$DATABASE_VALUE
else
@@ -559,13 +526,13 @@ if [ "${MGED_XMIN_INNER:-0}" -eq 0 ]; then
recording_status=$?
set -e
if [ "$run_status" -ne 0 ] || [ "$recording_status" -ne 0 ]; then
MGED_XMIN_KEEP=1
MGED_GUI_KEEP=1
exit 1
fi
exit 0
fi
test_db="$MGED_XMIN_TEST_DIR/gui-edit.g"
test_db="$MGED_GUI_TEST_DIR/gui-edit.g"
inner_cleanup()
{
if [ -n "${MGED_PID:-}" ]; then
@@ -574,213 +541,213 @@ inner_cleanup()
}
trap inner_cleanup EXIT INT TERM
"$MGED_BIN" --gui --dm-type "$MGED_DM_TYPE" --rcfile "$MGED_XMIN_RC" \
"$MGED_BIN" --gui --dm-type "$MGED_DM_TYPE" --rcfile "$MGED_GUI_RC" \
--geom "$COMMAND_GEOMETRY" --ggeom "$GRAPHICS_GEOMETRY" "$test_db" \
>"$MGED_XMIN_TEST_DIR/mged.log" 2>&1 &
>"$MGED_GUI_TEST_DIR/mged.log" 2>&1 &
MGED_PID=$!
if ! wait_for_file "$MGED_XMIN_TEST_DIR/main_window"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/main_window"; then
fail "MGED main window did not become ready"
fi
main_window=$(sed -n '1p' "$MGED_XMIN_TEST_DIR/main_window")
"$XMIN_CTL" activate "$main_window"
main_window=$(sed -n '1p' "$MGED_GUI_TEST_DIR/main_window")
"$GUI_TEST_CTL" activate "$main_window"
record_state "MGED ready"
for menu in $TOP_LEVEL_MENUS; do
menu_name=${menu%%:*}
menu_label=${menu#*:}
if ! wait_for_file "$MGED_XMIN_TEST_DIR/main_${menu_name}_menu" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/main_${menu_name}_menu_window"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/main_${menu_name}_menu" ||
! wait_for_file "$MGED_GUI_TEST_DIR/main_${menu_name}_menu_window"; then
fail "MGED $menu_label menu target did not become ready"
fi
click_target "main_${menu_name}_menu"
record_state "$menu_label menu"
if [ "$menu_name" = misc ]; then
if ! wait_for_file "$MGED_XMIN_TEST_DIR/faceplate_toggle" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/faceplate_toggle_window" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/orig_gui_toggle" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/orig_gui_toggle_window"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/faceplate_toggle" ||
! wait_for_file "$MGED_GUI_TEST_DIR/faceplate_toggle_window" ||
! wait_for_file "$MGED_GUI_TEST_DIR/orig_gui_toggle" ||
! wait_for_file "$MGED_GUI_TEST_DIR/orig_gui_toggle_window"; then
fail "Misc menu Faceplate targets did not become ready"
fi
fi
"$XMIN_CTL" key escape
"$GUI_TEST_CTL" key escape
done
"$XMIN_CTL" click --delay "$CLICK_DELAY" "$main_window" 100 100 1
"$XMIN_CTL" activate "$main_window"
"$GUI_TEST_CTL" click --delay "$CLICK_DELAY" "$main_window" 100 100 1
"$GUI_TEST_CTL" activate "$main_window"
if [ "$MGED_DM_TYPE" = "tkswrast" ] && [ -n "${MGED_GUI_MANIFEST:-}" ]; then
if ! wait_for_file "$MGED_XMIN_TEST_DIR/menu_inventory"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/menu_inventory"; then
fail "MGED menu inventory did not become ready"
fi
if ! "$CMAKE_COMMAND" -E compare_files \
"$MGED_XMIN_TEST_DIR/menu_inventory" "$MGED_GUI_MANIFEST"; then
"$MGED_GUI_TEST_DIR/menu_inventory" "$MGED_GUI_MANIFEST"; then
fail "MGED menu inventory differs from $MGED_GUI_MANIFEST"
fi
fi
for setting in faceplate orig_gui; do
if ! wait_for_file "$MGED_XMIN_TEST_DIR/${setting}_current"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/${setting}_current"; then
fail "MGED did not report the current $setting state"
fi
if [ "$(sed -n '1p' "$MGED_XMIN_TEST_DIR/${setting}_current")" -ne 1 ]; then
if [ "$(sed -n '1p' "$MGED_GUI_TEST_DIR/${setting}_current")" -ne 1 ]; then
click_target main_misc_menu
record_state "Misc menu $setting"
if ! wait_for_file "$MGED_XMIN_TEST_DIR/${setting}_toggle" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/${setting}_toggle_window"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/${setting}_toggle" ||
! wait_for_file "$MGED_GUI_TEST_DIR/${setting}_toggle_window"; then
fail "Misc menu did not expose $setting"
fi
activate_menu_target "${setting}_toggle"
if ! wait_for_value "$MGED_XMIN_TEST_DIR/${setting}_current" 1; then
if ! wait_for_value "$MGED_GUI_TEST_DIR/${setting}_current" 1; then
fail "$setting did not enable the in-scene Faceplate"
fi
record_state "$setting enabled"
fi
done
if ! wait_for_file "$MGED_XMIN_TEST_DIR/faceplate_header" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/faceplate_header_window" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/faceplate_3525" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/faceplate_3525_window" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/faceplate_view_initial"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/faceplate_header" ||
! wait_for_file "$MGED_GUI_TEST_DIR/faceplate_header_window" ||
! wait_for_file "$MGED_GUI_TEST_DIR/faceplate_3525" ||
! wait_for_file "$MGED_GUI_TEST_DIR/faceplate_3525_window" ||
! wait_for_file "$MGED_GUI_TEST_DIR/faceplate_view_initial"; then
fail "Faceplate targets did not become ready"
fi
faceplate_view_initial=$(sed -n '1p' "$MGED_XMIN_TEST_DIR/faceplate_view_initial")
faceplate_view_initial=$(sed -n '1p' "$MGED_GUI_TEST_DIR/faceplate_view_initial")
click_target faceplate_header 2
if ! wait_for_file "$MGED_XMIN_TEST_DIR/faceplate_general_ready"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/faceplate_general_ready"; then
fail "Faceplate general menu did not expand"
fi
record_state "Faceplate general menu"
click_target faceplate_3525 2
if ! wait_for_not_value "$MGED_XMIN_TEST_DIR/faceplate_view_current" \
if ! wait_for_not_value "$MGED_GUI_TEST_DIR/faceplate_view_current" \
"$faceplate_view_initial"; then
fail "Faceplate 35,25 did not change the view"
fi
record_state "Faceplate 35,25 view"
click_target faceplate_header 2
if ! wait_for_file "$MGED_XMIN_TEST_DIR/renderer_capabilities" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/main_misc_menu" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/main_misc_menu_window"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/renderer_capabilities" ||
! wait_for_file "$MGED_GUI_TEST_DIR/main_misc_menu" ||
! wait_for_file "$MGED_GUI_TEST_DIR/main_misc_menu_window"; then
fail "renderer capability inventory did not become ready"
fi
renderer_capabilities=$(sed -n '1p' "$MGED_XMIN_TEST_DIR/renderer_capabilities")
renderer_capabilities=$(sed -n '1p' "$MGED_GUI_TEST_DIR/renderer_capabilities")
if [ "$renderer_capabilities" != "none" ]; then
for setting in $renderer_capabilities; do
if ! wait_for_file "$MGED_XMIN_TEST_DIR/renderer_${setting}_initial"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/renderer_${setting}_initial"; then
fail "renderer did not report initial $setting state"
fi
if ! wait_for_file "$MGED_XMIN_TEST_DIR/renderer_${setting}_mutable"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/renderer_${setting}_mutable"; then
fail "renderer did not report $setting mutability"
fi
toggle_renderer_setting "$setting"
done
fi
"$CMAKE_COMMAND" -E touch "$MGED_XMIN_TEST_DIR/stop_general_monitors"
if ! wait_for_file "$MGED_XMIN_TEST_DIR/renderer_monitor_stopped" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/faceplate_monitor_stopped"; then
"$CMAKE_COMMAND" -E touch "$MGED_GUI_TEST_DIR/stop_general_monitors"
if ! wait_for_file "$MGED_GUI_TEST_DIR/renderer_monitor_stopped" ||
! wait_for_file "$MGED_GUI_TEST_DIR/faceplate_monitor_stopped"; then
fail "MGED general-interface monitors did not stop"
fi
if ! wait_for_file "$MGED_XMIN_TEST_DIR/main_edit_menu" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/main_edit_menu_window"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/main_edit_menu" ||
! wait_for_file "$MGED_GUI_TEST_DIR/main_edit_menu_window"; then
fail "MGED Edit menu did not become ready"
fi
click_target main_edit_menu
record_state "Edit menu"
if ! wait_for_file "$MGED_XMIN_TEST_DIR/primitive_editor_menu" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/primitive_editor_menu_window"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/primitive_editor_menu" ||
! wait_for_file "$MGED_GUI_TEST_DIR/primitive_editor_menu_window"; then
fail "MGED Primitive Editor menu entry did not become ready"
fi
activate_menu_target primitive_editor_menu
if ! wait_for_file "$MGED_XMIN_TEST_DIR/editor_window"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/editor_window"; then
fail "Primitive Editor did not open"
fi
record_state "Primitive Editor"
editor_window=$(sed -n '1p' "$MGED_XMIN_TEST_DIR/editor_window")
"$XMIN_CTL" activate "$editor_window"
editor_window=$(sed -n '1p' "$MGED_GUI_TEST_DIR/editor_window")
"$GUI_TEST_CTL" activate "$editor_window"
if ! wait_for_file "$MGED_XMIN_TEST_DIR/editor_name" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/editor_name_window" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/editor_name_initial" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/editor_reset" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/editor_reset_window"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/editor_name" ||
! wait_for_file "$MGED_GUI_TEST_DIR/editor_name_window" ||
! wait_for_file "$MGED_GUI_TEST_DIR/editor_name_initial" ||
! wait_for_file "$MGED_GUI_TEST_DIR/editor_reset" ||
! wait_for_file "$MGED_GUI_TEST_DIR/editor_reset_window"; then
fail "Primitive Editor controls did not become ready"
fi
editor_name=$(sed -n '1p' "$MGED_XMIN_TEST_DIR/editor_name_initial")
editor_name=$(sed -n '1p' "$MGED_GUI_TEST_DIR/editor_name_initial")
if ! replace_entry_text editor_name "$editor_name" \
"$MGED_XMIN_TEST_DIR/editor_name_current" gui.s; then
"$MGED_GUI_TEST_DIR/editor_name_current" gui.s; then
fail "Primitive Editor name entry did not receive gui.s"
fi
record_state "primitive name entered"
click_target editor_reset
record_state "primitive load dispatched"
"$CMAKE_COMMAND" -E touch "$MGED_XMIN_TEST_DIR/editor_loaded"
if ! wait_for_file_with_limit "$MGED_XMIN_TEST_DIR/sphere_vx" \
"$CMAKE_COMMAND" -E touch "$MGED_GUI_TEST_DIR/editor_loaded"
if ! wait_for_file_with_limit "$MGED_GUI_TEST_DIR/sphere_vx" \
"$PRIMITIVE_LOAD_RETRY_LIMIT"; then
click_target editor_name
"$XMIN_CTL" key enter
"$GUI_TEST_CTL" key enter
record_state "primitive load keyboard retry"
fi
if ! wait_for_file "$MGED_XMIN_TEST_DIR/sphere_vx" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/sphere_vx_window" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/sphere_vx_initial" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/apply_button_window" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/apply_button"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/sphere_vx" ||
! wait_for_file "$MGED_GUI_TEST_DIR/sphere_vx_window" ||
! wait_for_file "$MGED_GUI_TEST_DIR/sphere_vx_initial" ||
! wait_for_file "$MGED_GUI_TEST_DIR/apply_button_window" ||
! wait_for_file "$MGED_GUI_TEST_DIR/apply_button"; then
fail "Primitive Editor did not load gui.s"
fi
initial_value=$(sed -n '1p' "$MGED_XMIN_TEST_DIR/sphere_vx_initial")
initial_value=$(sed -n '1p' "$MGED_GUI_TEST_DIR/sphere_vx_initial")
if [ "$initial_value" != "0.0000" ]; then
fail "unexpected initial sphere V-x value '$initial_value'"
fi
record_state "sphere loaded"
if ! replace_entry_text sphere_vx "$initial_value" \
"$MGED_XMIN_TEST_DIR/sphere_vx_current" 5; then
"$MGED_GUI_TEST_DIR/sphere_vx_current" 5; then
fail "sphere V-x entry did not receive the expected value"
fi
record_state "sphere vertex edited"
click_target apply_button
record_state "sphere Apply dispatched"
"$CMAKE_COMMAND" -E touch "$MGED_XMIN_TEST_DIR/primitive_applied"
"$CMAKE_COMMAND" -E touch "$MGED_GUI_TEST_DIR/primitive_applied"
if ! wait_for_file "$MGED_XMIN_TEST_DIR/primitive_result"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/primitive_result"; then
fail "MGED did not report a primitive edit result"
fi
primitive_result=$(sed -n '1p' "$MGED_XMIN_TEST_DIR/primitive_result")
primitive_result=$(sed -n '1p' "$MGED_GUI_TEST_DIR/primitive_result")
record_state "sphere edit applied"
"$CMAKE_COMMAND" -E touch "$MGED_XMIN_TEST_DIR/begin_pipe"
if ! wait_for_file "$MGED_XMIN_TEST_DIR/pipe_ready" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/pipe_select" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/pipe_select_window" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/pipe_next" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/pipe_next_window" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/pipe_split" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/pipe_split_window" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/pipe_split_point" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/pipe_split_point_window" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/pipe_point" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/pipe_point_window"; then
"$CMAKE_COMMAND" -E touch "$MGED_GUI_TEST_DIR/begin_pipe"
if ! wait_for_file "$MGED_GUI_TEST_DIR/pipe_ready" ||
! wait_for_file "$MGED_GUI_TEST_DIR/pipe_select" ||
! wait_for_file "$MGED_GUI_TEST_DIR/pipe_select_window" ||
! wait_for_file "$MGED_GUI_TEST_DIR/pipe_next" ||
! wait_for_file "$MGED_GUI_TEST_DIR/pipe_next_window" ||
! wait_for_file "$MGED_GUI_TEST_DIR/pipe_split" ||
! wait_for_file "$MGED_GUI_TEST_DIR/pipe_split_window" ||
! wait_for_file "$MGED_GUI_TEST_DIR/pipe_split_point" ||
! wait_for_file "$MGED_GUI_TEST_DIR/pipe_split_point_window" ||
! wait_for_file "$MGED_GUI_TEST_DIR/pipe_point" ||
! wait_for_file "$MGED_GUI_TEST_DIR/pipe_point_window"; then
fail "pipe Faceplate edit did not become ready"
fi
record_state "pipe contextual Faceplate"
click_target pipe_select 2
record_state "pipe Select Point mode"
click_target pipe_point 2
"$CMAKE_COMMAND" -E touch "$MGED_XMIN_TEST_DIR/pipe_point_clicked"
if ! wait_for_file "$MGED_XMIN_TEST_DIR/pipe_selected"; then
"$CMAKE_COMMAND" -E touch "$MGED_GUI_TEST_DIR/pipe_point_clicked"
if ! wait_for_file "$MGED_GUI_TEST_DIR/pipe_selected"; then
fail "pipe point was not selected through the viewport"
fi
pipe_keypoint=$(sed -n '1p' "$MGED_XMIN_TEST_DIR/pipe_keypoint_current")
pipe_keypoint=$(sed -n '1p' "$MGED_GUI_TEST_DIR/pipe_keypoint_current")
record_state "pipe point selected"
click_target pipe_next 2
if ! wait_for_not_value "$MGED_XMIN_TEST_DIR/pipe_keypoint_current" \
if ! wait_for_not_value "$MGED_GUI_TEST_DIR/pipe_keypoint_current" \
"$pipe_keypoint"; then
fail "pipe Next Point did not change the edit keypoint"
fi
@@ -789,75 +756,75 @@ click_target pipe_split 2
record_state "pipe Split Segment mode"
click_target pipe_split_point 2
record_state "pipe segment split"
"$CMAKE_COMMAND" -E touch "$MGED_XMIN_TEST_DIR/pipe_finish"
if ! wait_for_file "$MGED_XMIN_TEST_DIR/pipe_done"; then
"$CMAKE_COMMAND" -E touch "$MGED_GUI_TEST_DIR/pipe_finish"
if ! wait_for_file "$MGED_GUI_TEST_DIR/pipe_done"; then
fail "pipe edit did not accept cleanly"
fi
"$CMAKE_COMMAND" -E touch "$MGED_XMIN_TEST_DIR/begin_sketch"
if ! wait_for_file "$MGED_XMIN_TEST_DIR/sketch_ready" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/sketch_create_line" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/sketch_create_line_window" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/sketch_zoom_in" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/sketch_zoom_in_window" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/sketch_reset" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/sketch_reset_window" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/sketch_dismiss" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/sketch_dismiss_window" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/sketch_canvas_start" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/sketch_canvas_start_window" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/sketch_canvas_end" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/sketch_canvas_end_window" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/sketch_scale_current" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/sketch_vertex_count_current"; then
"$CMAKE_COMMAND" -E touch "$MGED_GUI_TEST_DIR/begin_sketch"
if ! wait_for_file "$MGED_GUI_TEST_DIR/sketch_ready" ||
! wait_for_file "$MGED_GUI_TEST_DIR/sketch_create_line" ||
! wait_for_file "$MGED_GUI_TEST_DIR/sketch_create_line_window" ||
! wait_for_file "$MGED_GUI_TEST_DIR/sketch_zoom_in" ||
! wait_for_file "$MGED_GUI_TEST_DIR/sketch_zoom_in_window" ||
! wait_for_file "$MGED_GUI_TEST_DIR/sketch_reset" ||
! wait_for_file "$MGED_GUI_TEST_DIR/sketch_reset_window" ||
! wait_for_file "$MGED_GUI_TEST_DIR/sketch_dismiss" ||
! wait_for_file "$MGED_GUI_TEST_DIR/sketch_dismiss_window" ||
! wait_for_file "$MGED_GUI_TEST_DIR/sketch_canvas_start" ||
! wait_for_file "$MGED_GUI_TEST_DIR/sketch_canvas_start_window" ||
! wait_for_file "$MGED_GUI_TEST_DIR/sketch_canvas_end" ||
! wait_for_file "$MGED_GUI_TEST_DIR/sketch_canvas_end_window" ||
! wait_for_file "$MGED_GUI_TEST_DIR/sketch_scale_current" ||
! wait_for_file "$MGED_GUI_TEST_DIR/sketch_vertex_count_current"; then
fail "Sketch Editor controls did not become ready"
fi
record_state "Sketch Editor ready"
sketch_scale=$(sed -n '1p' "$MGED_XMIN_TEST_DIR/sketch_scale_current")
sketch_scale=$(sed -n '1p' "$MGED_GUI_TEST_DIR/sketch_scale_current")
click_target sketch_zoom_in
if ! wait_for_not_value "$MGED_XMIN_TEST_DIR/sketch_scale_current" \
if ! wait_for_not_value "$MGED_GUI_TEST_DIR/sketch_scale_current" \
"$sketch_scale"; then
fail "Sketch Editor Zoom In did not change the canvas scale"
fi
record_state "Sketch Editor zoomed"
sketch_vertex_count=$(sed -n '1p' \
"$MGED_XMIN_TEST_DIR/sketch_vertex_count_current")
"$MGED_GUI_TEST_DIR/sketch_vertex_count_current")
click_target sketch_create_line
record_state "Sketch Editor Create Line mode"
click_target sketch_canvas_start
record_state "Sketch Editor line start"
click_target sketch_canvas_end
if ! wait_for_not_value "$MGED_XMIN_TEST_DIR/sketch_vertex_count_current" \
if ! wait_for_not_value "$MGED_GUI_TEST_DIR/sketch_vertex_count_current" \
"$sketch_vertex_count"; then
fail "Sketch Editor did not add vertices for the new line"
fi
record_state "Sketch Editor line created"
click_target sketch_reset
if ! wait_for_value "$MGED_XMIN_TEST_DIR/sketch_vertex_count_current" \
if ! wait_for_value "$MGED_GUI_TEST_DIR/sketch_vertex_count_current" \
"$sketch_vertex_count"; then
fail "Sketch Editor Reset Sketch did not restore the fixture"
fi
record_state "Sketch Editor reset"
click_target sketch_dismiss
if ! wait_for_file "$MGED_XMIN_TEST_DIR/sketch_closed"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/sketch_closed"; then
fail "Sketch Editor did not dismiss cleanly"
fi
"$CMAKE_COMMAND" -E touch "$MGED_XMIN_TEST_DIR/begin_matrix"
if ! wait_for_file "$MGED_XMIN_TEST_DIR/matrix_dm_window" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/matrix_dm"; then
"$CMAKE_COMMAND" -E touch "$MGED_GUI_TEST_DIR/begin_matrix"
if ! wait_for_file "$MGED_GUI_TEST_DIR/matrix_dm_window" ||
! wait_for_file "$MGED_GUI_TEST_DIR/matrix_dm"; then
fail "MGED did not enter matrix edit mode"
fi
record_state "matrix edit ready"
click_target matrix_dm 2
record_state "matrix edit moved"
"$CMAKE_COMMAND" -E touch "$MGED_XMIN_TEST_DIR/matrix_clicked"
"$CMAKE_COMMAND" -E touch "$MGED_GUI_TEST_DIR/matrix_clicked"
if ! wait_for_file "$MGED_XMIN_TEST_DIR/matrix_result"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/matrix_result"; then
fail "MGED did not report a matrix edit result"
fi
matrix_result=$(sed -n '1p' "$MGED_XMIN_TEST_DIR/matrix_result")
matrix_result=$(sed -n '1p' "$MGED_GUI_TEST_DIR/matrix_result")
case "$matrix_result" in
PASS:*) ;;
*)
@@ -870,39 +837,39 @@ capture_dm_snapshot raytrace_baseline
click_target main_tools_menu
record_state "Tools menu embedded raytrace"
if ! wait_for_file "$MGED_XMIN_TEST_DIR/raytrace_control_menu" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/raytrace_control_menu_window"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/raytrace_control_menu" ||
! wait_for_file "$MGED_GUI_TEST_DIR/raytrace_control_menu_window"; then
fail "Tools menu did not expose the Raytrace Control Panel"
fi
activate_menu_target raytrace_control_menu
if ! wait_for_file "$MGED_XMIN_TEST_DIR/raytrace_ready" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/raytrace_window" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/raytrace_size" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/raytrace_size_window" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/raytrace_destination" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/raytrace_destination_window" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/raytrace_button" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/raytrace_button_window" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/raytrace_active" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/raytrace_active_window" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/raytrace_dismiss" ||
! wait_for_file "$MGED_XMIN_TEST_DIR/raytrace_dismiss_window"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/raytrace_ready" ||
! wait_for_file "$MGED_GUI_TEST_DIR/raytrace_window" ||
! wait_for_file "$MGED_GUI_TEST_DIR/raytrace_size" ||
! wait_for_file "$MGED_GUI_TEST_DIR/raytrace_size_window" ||
! wait_for_file "$MGED_GUI_TEST_DIR/raytrace_destination" ||
! wait_for_file "$MGED_GUI_TEST_DIR/raytrace_destination_window" ||
! wait_for_file "$MGED_GUI_TEST_DIR/raytrace_button" ||
! wait_for_file "$MGED_GUI_TEST_DIR/raytrace_button_window" ||
! wait_for_file "$MGED_GUI_TEST_DIR/raytrace_active" ||
! wait_for_file "$MGED_GUI_TEST_DIR/raytrace_active_window" ||
! wait_for_file "$MGED_GUI_TEST_DIR/raytrace_dismiss" ||
! wait_for_file "$MGED_GUI_TEST_DIR/raytrace_dismiss_window"; then
fail "Raytrace Control Panel controls did not become ready"
fi
record_state "Raytrace Control Panel"
raytrace_size=$(sed -n '1p' "$MGED_XMIN_TEST_DIR/raytrace_size_initial")
raytrace_size=$(sed -n '1p' "$MGED_GUI_TEST_DIR/raytrace_size_initial")
if ! replace_entry_text raytrace_size "$raytrace_size" \
"$MGED_XMIN_TEST_DIR/raytrace_size_current" "$RAYTRACE_SIZE"; then
"$MGED_GUI_TEST_DIR/raytrace_size_current" "$RAYTRACE_SIZE"; then
fail "Raytrace Control Panel size entry did not accept $RAYTRACE_SIZE"
fi
record_state "embedded raytrace size $RAYTRACE_SIZE"
"$CMAKE_COMMAND" -E touch "$MGED_XMIN_TEST_DIR/raytrace_prepare_reference"
if ! wait_for_file "$MGED_XMIN_TEST_DIR/raytrace_reference_ready"; then
"$CMAKE_COMMAND" -E touch "$MGED_GUI_TEST_DIR/raytrace_prepare_reference"
if ! wait_for_file "$MGED_GUI_TEST_DIR/raytrace_reference_ready"; then
fail "MGED did not prepare the standalone raytrace reference"
fi
reference_script=$(sed -n '1p' "$MGED_XMIN_TEST_DIR/raytrace_reference_script")
reference_image=$(sed -n '1p' "$MGED_XMIN_TEST_DIR/raytrace_reference_image")
reference_script=$(sed -n '1p' "$MGED_GUI_TEST_DIR/raytrace_reference_script")
reference_image=$(sed -n '1p' "$MGED_GUI_TEST_DIR/raytrace_reference_image")
if ! /bin/sh "$reference_script"; then
fail "standalone reference raytrace failed"
fi
@@ -912,7 +879,7 @@ fi
record_state "standalone raytrace reference complete"
start_raytrace 1
record_state "embedded raytrace started"
if ! wait_for_value "$MGED_XMIN_TEST_DIR/raytrace_complete" 1; then
if ! wait_for_value "$MGED_GUI_TEST_DIR/raytrace_complete" 1; then
fail "embedded raytrace did not complete"
fi
assert_raytrace_duration 1 "embedded raytrace"
@@ -927,7 +894,7 @@ for mode in overlay interlay underlay; do
click_target raytrace_framebuffer_menu
record_state "Raytrace Framebuffer menu $mode"
activate_menu_target "raytrace_$mode"
if ! wait_for_value "$MGED_XMIN_TEST_DIR/raytrace_overlay_current" "$layer"; then
if ! wait_for_value "$MGED_GUI_TEST_DIR/raytrace_overlay_current" "$layer"; then
fail "embedded framebuffer did not enter $mode mode"
fi
record_state "embedded framebuffer $mode"
@@ -935,14 +902,14 @@ for mode in overlay interlay underlay; do
done
assert_images_differ "embedded raytrace overlay" \
"$MGED_XMIN_TEST_DIR/raytrace_baseline.ppm" \
"$MGED_XMIN_TEST_DIR/raytrace_overlay.ppm"
"$MGED_GUI_TEST_DIR/raytrace_baseline.ppm" \
"$MGED_GUI_TEST_DIR/raytrace_overlay.ppm"
"$CMAKE_COMMAND" -E touch "$MGED_XMIN_TEST_DIR/raytrace_export_requested"
if ! wait_for_file "$MGED_XMIN_TEST_DIR/raytrace_export_ready"; then
"$CMAKE_COMMAND" -E touch "$MGED_GUI_TEST_DIR/raytrace_export_requested"
if ! wait_for_file "$MGED_GUI_TEST_DIR/raytrace_export_ready"; then
fail "MGED did not export the embedded framebuffer"
fi
embedded_image=$(sed -n '1p' "$MGED_XMIN_TEST_DIR/raytrace_export_image")
embedded_image=$(sed -n '1p' "$MGED_GUI_TEST_DIR/raytrace_export_image")
if [ ! -s "$embedded_image" ]; then
fail "MGED exported an empty embedded framebuffer image"
fi
@@ -955,42 +922,42 @@ record_state "embedded framebuffer matches standalone rt"
# visible framebuffer image to remove.
click_target raytrace_framebuffer_menu
activate_menu_target raytrace_overlay
if ! wait_for_value "$MGED_XMIN_TEST_DIR/raytrace_overlay_current" 2; then
if ! wait_for_value "$MGED_GUI_TEST_DIR/raytrace_overlay_current" 2; then
fail "embedded framebuffer did not return to overlay mode"
fi
capture_dm_snapshot raytrace_active
if ! wait_for_value "$MGED_XMIN_TEST_DIR/raytrace_fb_current" 1; then
if ! wait_for_value "$MGED_GUI_TEST_DIR/raytrace_fb_current" 1; then
fail "embedded framebuffer was not active after raytracing"
fi
click_target raytrace_active
if ! wait_for_value "$MGED_XMIN_TEST_DIR/raytrace_fb_current" 0; then
if ! wait_for_value "$MGED_GUI_TEST_DIR/raytrace_fb_current" 0; then
fail "Raytrace Control Panel did not deactivate the framebuffer"
fi
record_state "embedded framebuffer inactive"
wait_for_changed_dm_snapshot "framebuffer active toggle" \
"$MGED_XMIN_TEST_DIR/raytrace_active.ppm" raytrace_inactive
"$MGED_GUI_TEST_DIR/raytrace_active.ppm" raytrace_inactive
click_target raytrace_active
if ! wait_for_value "$MGED_XMIN_TEST_DIR/raytrace_fb_current" 1; then
if ! wait_for_value "$MGED_GUI_TEST_DIR/raytrace_fb_current" 1; then
fail "Raytrace Control Panel did not reactivate the framebuffer"
fi
record_state "embedded framebuffer reactivated"
file_destination=$(sed -n '1p' "$MGED_XMIN_TEST_DIR/raytrace_file_destination")
embedded_destination=$(sed -n '1p' "$MGED_XMIN_TEST_DIR/raytrace_destination_initial")
file_destination=$(sed -n '1p' "$MGED_GUI_TEST_DIR/raytrace_file_destination")
embedded_destination=$(sed -n '1p' "$MGED_GUI_TEST_DIR/raytrace_destination_initial")
if ! replace_entry_text raytrace_destination "$embedded_destination" \
"$MGED_XMIN_TEST_DIR/raytrace_destination_current" "$file_destination"; then
"$MGED_GUI_TEST_DIR/raytrace_destination_current" "$file_destination"; then
fail "Raytrace Control Panel did not accept a file destination"
fi
record_state "raytrace file destination"
file_render_size=$(sed -n '1p' "$MGED_XMIN_TEST_DIR/raytrace_size_current")
file_render_size=$(sed -n '1p' "$MGED_GUI_TEST_DIR/raytrace_size_current")
if ! replace_entry_text raytrace_size "$file_render_size" \
"$MGED_XMIN_TEST_DIR/raytrace_size_current" "$RAYTRACE_SIZE"; then
"$MGED_GUI_TEST_DIR/raytrace_size_current" "$RAYTRACE_SIZE"; then
fail "Raytrace Control Panel did not restore size $RAYTRACE_SIZE for the file render"
fi
record_state "raytrace file size $RAYTRACE_SIZE"
start_raytrace 2
record_state "GUI file raytrace started"
if ! wait_for_value "$MGED_XMIN_TEST_DIR/raytrace_complete" 2; then
if ! wait_for_value "$MGED_GUI_TEST_DIR/raytrace_complete" 2; then
fail "GUI file raytrace did not complete"
fi
assert_raytrace_duration 2 "GUI file raytrace"
@@ -1000,25 +967,25 @@ fi
assert_raw_images_equal "GUI file raytrace" "$reference_image" "$file_destination"
record_state "GUI raytrace matches standalone rt"
if ! replace_entry_text raytrace_destination "$file_destination" \
"$MGED_XMIN_TEST_DIR/raytrace_destination_current" "$embedded_destination"; then
"$MGED_GUI_TEST_DIR/raytrace_destination_current" "$embedded_destination"; then
fail "Raytrace Control Panel did not restore the embedded destination"
fi
record_state "embedded raytrace destination restored"
click_target raytrace_dismiss
if ! wait_for_file "$MGED_XMIN_TEST_DIR/raytrace_closed"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/raytrace_closed"; then
fail "Raytrace Control Panel did not dismiss cleanly"
fi
"$XMIN_CTL" activate "$main_window"
"$GUI_TEST_CTL" activate "$main_window"
click_target main_view_menu
record_state "post-raytrace View menu responsiveness"
"$XMIN_CTL" key escape
"$CMAKE_COMMAND" -E touch "$MGED_XMIN_TEST_DIR/raytrace_responsive"
"$GUI_TEST_CTL" key escape
"$CMAKE_COMMAND" -E touch "$MGED_GUI_TEST_DIR/raytrace_responsive"
if ! wait_for_file "$MGED_XMIN_TEST_DIR/result"; then
if ! wait_for_file "$MGED_GUI_TEST_DIR/result"; then
fail "MGED did not remain responsive after embedded raytrace"
fi
result=$(sed -n '1p' "$MGED_XMIN_TEST_DIR/result")
result=$(sed -n '1p' "$MGED_GUI_TEST_DIR/result")
case "$result" in
PASS:*) ;;
*)
@@ -1026,7 +993,7 @@ case "$result" in
;;
esac
"$CMAKE_COMMAND" -E touch "$MGED_XMIN_TEST_DIR/finish"
"$CMAKE_COMMAND" -E touch "$MGED_GUI_TEST_DIR/finish"
wait "$MGED_PID"
MGED_PID=""
+24 -24
View File
@@ -20,35 +20,35 @@
###
# Exercise MGED's BoT editor through its live controls.
source $::env(MGED_XMIN_GUI_LIBRARY)
source $::env(MGED_GUI_TEST_LIBRARY)
namespace eval ::mged::xmin::bot {}
proc ::mged::xmin::bot::find_combobox {root first_value} {
foreach widget [::xmin::test::descendants $root] {
foreach widget [::gui::test::descendants $root] {
if {[winfo class $widget] eq "TCombobox" &&
[lindex [$widget cget -values] 0] eq $first_value} {
return $widget
}
}
::mged::xmin::test::fail \
::mged::gui::test::fail \
"$root has no combobox beginning with '$first_value'"
}
proc ::mged::xmin::bot::confirm_action {editor button_text} {
set button [::mged::xmin::test::find_widget_by_text $editor $button_text]
set button [::mged::gui::test::find_widget_by_text $editor $button_text]
$button invoke
::mged::xmin::test::settle
::mged::gui::test::settle
set confirmation $editor.confirmDialog
::mged::xmin::test::require_mapped $confirmation \
::mged::gui::test::require_mapped $confirmation \
"$button_text confirmation"
[::mged::xmin::test::find_widget_by_text $confirmation Yes] invoke
::mged::xmin::test::settle
[::mged::gui::test::find_widget_by_text $confirmation Yes] invoke
::mged::gui::test::settle
}
proc ::mged::xmin::bot::require_counts {bot vertices faces description} {
::xmin::test::require {
::gui::test::require {
[llength [get $bot V]] == $vertices &&
[llength [get $bot F]] == $faces
} "$description does not have $vertices vertices and $faces faces"
@@ -59,17 +59,17 @@ proc ::mged::xmin::bot::exercise_editor {id top} {
{0 0 0} {100 0 0} {0 100 0} {0 0 0} {999 999 999}
} F {{0 1 2} {3 1 2}}
::mged::xmin::test::with_dialog_answer .$id.botname "BoT to Edit" \
::mged::gui::test::with_dialog_answer .$id.botname "BoT to Edit" \
.$id.botname.mid.ent xmin_bot.s .$id.botname.bot.button0 \
[list ::mged::xmin::test::invoke $top {Tools {BoT Edit Tool}}]
[list ::mged::gui::test::invoke $top {Tools {BoT Edit Tool}}]
set editor .botedit
::mged::xmin::test::require_mapped $editor "BoT Edit Tool"
::mged::gui::test::require_mapped $editor "BoT Edit Tool"
require_counts xmin_bot.s.edit 5 2 "initial working BoT"
set mode [find_combobox $editor Surface]
set orientation [find_combobox $editor Unoriented]
::xmin::test::require {
::gui::test::require {
[$mode current] == 0 && [$orientation current] == 0
} "BoT Editor did not display the initial mode and orientation"
@@ -77,18 +77,18 @@ proc ::mged::xmin::bot::exercise_editor {id top} {
event generate $mode <<ComboboxSelected>>
$orientation current 1
event generate $orientation <<ComboboxSelected>>
::xmin::test::require {
::gui::test::require {
[bot get type xmin_bot.s.edit] eq "solid" &&
[bot get orientation xmin_bot.s.edit] eq "ccw"
} "BoT Editor did not apply mode and orientation changes"
[::mged::xmin::test::find_widget_by_text $editor {Remove Selected}] invoke
::mged::xmin::test::settle
[::mged::gui::test::find_widget_by_text $editor {Remove Selected}] invoke
::mged::gui::test::settle
require_counts xmin_bot.s.edit 3 1 "simplified working BoT"
confirm_action $editor {Start Over}
require_counts xmin_bot.s.edit 5 2 "reverted working BoT"
::xmin::test::require {
::gui::test::require {
[bot get type xmin_bot.s.edit] eq "surface" &&
[bot get orientation xmin_bot.s.edit] eq "none" &&
[$mode current] == 0 && [$orientation current] == 0
@@ -102,13 +102,13 @@ proc ::mged::xmin::bot::exercise_editor {id top} {
{Remove Unused Vertices} {Remove Duplicate Vertices}
{Remove Duplicate Faces}
} {
[::mged::xmin::test::find_widget_by_text $editor $option] invoke
[::mged::gui::test::find_widget_by_text $editor $option] invoke
}
[::mged::xmin::test::find_widget_by_text $editor {Remove Selected}] invoke
::mged::xmin::test::settle
[::mged::gui::test::find_widget_by_text $editor {Remove Selected}] invoke
::mged::gui::test::settle
confirm_action $editor Accept
::xmin::test::require {
::gui::test::require {
![winfo exists $editor] && ![exists xmin_bot.s.edit] &&
[bot get type xmin_bot.s] eq "solid" &&
[bot get orientation xmin_bot.s] eq "ccw"
@@ -117,8 +117,8 @@ proc ::mged::xmin::bot::exercise_editor {id top} {
}
proc ::mged::xmin::bot::run {id top} {
set database [file join $::env(XMIN_TEST_DIR) bot.g]
cd $::env(XMIN_TEST_DIR)
set database [file join $::env(GUI_TEST_DIR) bot.g]
cd $::env(GUI_TEST_DIR)
file delete -force $database
opendb $database y
title {Xmin MGED BoT editor regression}
@@ -126,7 +126,7 @@ proc ::mged::xmin::bot::run {id top} {
exercise_editor $id $top
}
::mged::xmin::test::start ::mged::xmin::bot::run \
::mged::gui::test::start ::mged::xmin::bot::run \
{MGED BoT editor} {MGED BoT editor regression}
# Local Variables:

Some files were not shown because too many files have changed in this diff Show More