Skip to content

Add regions - #9

Open
timj wants to merge 56 commits into
u/timj/phase6-resamplefrom
u/timj/phase7-regions
Open

timj wants to merge 56 commits into
u/timj/phase6-resamplefrom
u/timj/phase7-regions

Conversation

@timj

@timj timj commented Nov 19, 2026

Copy link
Copy Markdown
Member

No description provided.

timj and others added 30 commits November 18, 2026 22:29
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Port the Frame machinery the Region classes call: lineDef, lineOffset,
lineCrossing and lineContains (straight lines in a Frame, great circles
on a SkyFrame), normBox (a SkyFrame takes in the poles, a CmpFrame asks
each component, a FrameSet its current Frame) and frameGrid, with the
package-private PointSet that holds a Region's defining points in its
description, registered for loading.

Expected values come from the new C probe frame_line_probe.c; the four
CmpFrame NormBox tests of test_cmpframe.rs are translated, and the
deferred lists no longer name PointSet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Region is the abstract Frame of every Region shape: it encapsulates a
FrameSet and forwards Frame behaviour to its current Frame as region.c
does, with the Region attributes, attribute setting that remaps only an
Adaptive Region, the uncertainty (SetUnc, GetUnc, GetUncFrm, GetDefUnc),
bounds, points, mesh and grid, the protected and public MapRegion, the
generic Simplify, Equal, Cast, PickAxes, dump and load. Box is ported
from box.c without its own Simplify and MapMerge. Overlap, the masks
and ShowMesh are declared and raise AST__INTER.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
The fixtures that needed only Box now read, round-trip and transform as
C's do, and leave the deferred lists; the lists' reasons no longer name
Box. Rust tests translated with Box leave rust-tests.txt, those that
need SelectorMap say so, and the Box tests that expect the Box's own
simplification are listed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Port region.c's generic Overlap/OverlapX and BndBaseMesh (RegionOverlap),
Mask<X> through phase 6's Resample (RegionMask), and ShowMesh, replacing
the Region stubs. jniast's generic mask dispatches on the array type with
its IllegalArgumentException; the array and bound checks are Resample's.
As C does, OverlapX and Mask<X> negate a Region in place and back.

Tests: the region_overlap, region_mask, region_mapregion and
region_showmesh oracles (Box cases, counts asserted), the overlap column
of region_equal, mask argument rules, and a new C probe of Box overlap
and masking and of the negated copy an Adaptive Region keeps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Count the pixels of a mask grid exactly, so that a grid with more pixels
than a long holds gives AST__DIMIN for a short data array.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
NullRegion (nullregion.c), Interval (interval.c) and PointList
(pointlist.c), with their own Transform, bounds, mesh, uncertainty,
RegPins, RegBasePick, Overlap (NullRegion's OverlapX, Interval's
axis-by-axis comparison and BndBaseMesh) and PointList's Mask<X>;
Simplify is the Region-generic one until each class's own is added.
The tests translate test_nullregion.rs, test_interval.rs,
test_pointlist.rs and the region_interval, region_nulltran and
region_bounded oracles, raise the case counts of the shared oracles,
and take C's values for the constructors' checks, membership, masks,
overlaps and dumps from the new region_null_interval_pointlist_probe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
The deferred lists lose the fixtures and cases whose only missing
classes were NullRegion, Interval and PointList, and keep the rest
with those classes dropped from their reasons; rust-tests.txt gains the
Rust tests of these classes that still need Circle, Prism, the classes'
own simplification, astGetRegionDisc or astGetRegionMesh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
fixup! Add NullRegion, Interval and PointList

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Circle and Ellipse are ported from circle.c and ellipse.c: the jniast
constructors, with C's checks of form, axes and bad coordinates;
membership; bounds and boundary meshes made with the Frame's geodesics
(astOffset2, astAxDistance, astNormBox), so that sky Regions across RA 0
or round a pole match C; re-centring; the boundary test (RegPins); dump
and load. The best-fit conversions astBestCircle and astBestEllipse are
package-private for the classes' own simplification. A NullRegion's
default uncertainty is now C's zero-radius Circle.

New C probes, region_sky_probe.c (Boxes and Circles across RA 0 and
round the poles) and region_circle_ellipse_probe.c (linked with
ellipse.c's RegCentre indexing corrected, since C's crashes), give the
expected values; the region_ellipse and region_frame oracles are
converted; the shared oracles and the tests that skipped Circle now run
its cases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
The deferred lists lose the fixtures and cases whose only missing
classes were Circle and Ellipse, and keep the rest with those classes
dropped from their reasons; rust-tests.txt loses the Rust tests that
now run, and gains those of test_circle.rs and the disc and EllipsePars
oracles that need astCirclePars, astGetRegionDisc or astEllipsePars
(not in jniast), and the rotated-boundary test of test_ellipse.rs,
whose result the platform's last bit decides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Give the sky dump of RegionEllipseOracleTest its own tolerance, derived
for astOffset2's chain of sin, cos, atan2 and asin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
PointList RegPins checks each of its points when given more, as C intends

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Each Region class's own Simplify as C's: Box (PermMap slices to Box,
Interval or NullRegion; the best-fitting Box, the Polygon of the
corners, or a Prism of separable axes otherwise), Interval (its Box,
or redefined in the current Frame), PointList, Circle and Ellipse
(best-fit Circle or Ellipse), Prism (merged components, or each
component on its own axes) and CmpRegion (null, infinite, identical
and nested components). RegionMerge holds the MapMerge of Box,
Interval, NullRegion and PointList, which merges neighbouring Regions
in parallel (MergeBox, MergeInterval, MergeNullRegion,
MergePointList), and Prism gains astConvertToPrism.

Translates the Rust tests that waited for simplification and jniast's
own RegionTest, and compares a simplified Ellipse with the reference's
end of its primary axis, which rounding decides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
The 29 rows of fixtures/simplify/cases.txt and the 8 Rust tests that
needed Region simplification now match C and leave the deferred
lists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
The checks of testregions.c that the class tests do not cover, with
checkEllipse's Errors 15 to 17, which the Rust port excludes, giving
C's result. check_remove_regions waits for astRemoveRegions, and
region_gaps_still_differ checks a Rust gap Java does not have.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
RegionsTest holds the tests of test_regions.rs that exercise Region
simplification: the uncertainty a Prism carries to its simplification,
the MeshSize and FillFactor of a parallel merge, and a sky Circle in a
changed System simplified.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
RegionsTest now holds every test of test_regions.rs but those needing
astGetRegionDisc, astRemoveRegions or astConvex, which are listed in
deferred/rust-tests.txt. The probe regions_cross_probe.c records C's
results for the checks testregions.c does not make: C gives each overlap
and sky membership the Rust tests expect, its bounds replace the Rust
tests' looser ones, and for the negated CmpRegion whose square is given
by its bounds C keeps the boundary point (0, 0.5) the Rust test expects
to be bad.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
List every Rust test of the Moc, MocChan, Stc, SelectorMap and
astRemoveRegions files, and the Region trait checks, in rust-tests.txt;
name only SelectorMap where it was listed as a Region.
Translate test_frame_in_map_slot.rs's Region-in-CmpMap control and run
the CmpRegion and Prism cases of the object ID oracle.
Say in the remaining SelectorMap skips that only SelectorMap is missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
timj and others added 26 commits November 19, 2026 05:40
Report that the overlap cannot be determined where BndBaseMesh would make its own CmpRegion again, instead of overflowing the stack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Say that a Prism's boundary test keeps a component whose Closed is set false open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Report a Polygon whose vertices are all one point as bad input, AST__BADIN, rather than an internal error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Describe Mask<X>'s empty grid box for any Region whose grid bounds pass the int range, and pin a Box through a ZoomMap of 1e12 against C.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Fill the Final review section and count the BndBaseMesh recursion among the C defects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
A probe whose output moved from one form to the other left a copy of the .out among the compiled test resources, which ProbeOutput then took.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
FitsMakeIntWorld, TimeFrame and KeyMapConvert each had a copy of C's round, identical in behaviour; CmpFrame, RegionMask, SwitchMap and the FITS classes reached FitsMakeIntWorld's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Say which of FrameGridTest's truncated tick counts are exact and what they rely on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Pin setUnc on a Box given an uncertainty of three axes or an unbounded one against C, state the margins of RegionBoxOracleTest's exact comparison and of Box's truncated root, and record the loader, RegGrid, MapRegion and Cast departures in docs/rust-c-differences.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Pin against C the overlap of two-axis Intervals with an axis of code 6 (an error here) and of a PointList with a duplicated point, test a NullRegion's bounds with more base than current axes, and record the code-6 results, the PointList-Box asymmetry and the PointList's own Mask<X> in docs/rust-c-differences.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Guard the boundary test of the sheared-Ellipse fit, compare the fitted Ellipse's centre, import assertThrows, and record the bounds Circle's and Ellipse's RegBaseMesh take from their first mesh point in docs/rust-c-differences.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Pin LineIncludes' tolerance behind a line's start against C, correct FrameLineTest's tolerance derivation and RegionSkyTest's atan2 accuracy, name the class in Polywidth's messages, test a one-vertex sky Polygon's bounds, check that RegionErrorsOracleTest reads every oracle value, and record Polygon's non-finite vertices in docs/rust-c-differences.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Pin the overlap of a Circle and the AND of an open Prism and a Circle against C, assert the status of RegionMaskTest's errors, reflow long Javadoc lines, and record in docs/rust-c-differences.md that Negated is restored after an error, C's answer for a PointList with a duplicated point, and the codes OverlapX can still give where BndBaseMesh would recurse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Give Box's AST__OBJIN a message saying what happened, and make Circle's and Ellipse's identical fitting methods one, Circle.fittedCircleOrEllipse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Give the Interval, BestBox and Prism simplification entries a Rust bullet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Say which sky membership tests the probe makes, add asin and atan2 conditioning near a pole to the bounds tolerance, and say why C's checkCircle values hold for another header.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Say why FrameInMapSlotTest's count of fixtures read is a floor and its count refused is exact.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Cite the commits the final review's fixes amend, list the minors fixed after the final review, and remove them from Gaps and risks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
winmap.c PermGet and fitschan.c's readers of WCSAXES call round(), so
WinMapMerge and FitsWcsKeywords use CMath.roundHalfAway in place of
their private floor(x + 0.5) helpers. A header whose WCSAXES is
0.49999999999999994 now fails as WCSAXES = 0 does, as in C; the new
fitschan_wcsaxes_round_probe pins it. PermGet's values are whole axis
indices, so no input reaches the difference there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Masking a Region through a PermMap that drops an axis its inverse
leaves bad differs from C because region.c MapRegion releases the
split Mapping twice. The new region_mapregion_drop_axis_probe, linked
with a region.c whose second release is guarded, gives Java's mapped
Regions and masks for a Box and a PointList, which
RegionMapRegionDropAxisTest pins with Java's AST__INTER for a Circle.
docs/rust-c-differences.md records the C bug.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
@timj
timj added this pull request to stack #4 November 19, 2026 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant