Skip to content

fix(utils): keep ellipse intersections on the connection ray - #7689

Draft
cangen185-sudo wants to merge 1 commit into
antvis:v5from
cangen185-sudo:codex/fix-ellipse-ray-intersection
Draft

cangen185-sudo wants to merge 1 commit into
antvis:v5from
cangen185-sudo:codex/fix-ellipse-ray-intersection

Conversation

@cangen185-sudo

Copy link
Copy Markdown

Problem

getEllipseIntersectPoint() treats the direction's polar angle as the ellipse's parametric angle. For a non-circular ellipse, the returned boundary point is therefore off the connection ray. This affects ellipse node and elliptical port endpoints.

For an ellipse centered at (0, 0) with radii (100, 50) and a reference point (200, 150), the existing result is (80, 30). The ray intersection is approximately (55.470, 41.603).

Change

Convert the ray direction to the ellipse's parametric angle using both radii. Preserve the existing circular, coincident-center and zero-radius behavior. Add 16 ray regressions across both aspect ratios, all quadrants, translated centers and reversed connections, plus five degenerate-size compatibility cases. Expected points use an independent ray-scaling formula; tests also check collinearity and the ellipse equation.

Validation

  • Before the fix: 16 new tests failed; 27 existing/compatibility tests passed.
  • After the fix: all 239 utility tests passed, including 82 tests in the five geometry-related suites.
  • Existing circle and ellipse SVG golden comparisons passed with CI=true from packages/g6; the point suite plus these two render tests passed 45/45.
  • Package TypeScript check, ESLint on both changed files, Prettier and git diff --check passed.

Local environment: Windows, Node 24.16.0. The newly resolved SWC 1.16.18 carrier could not use this machine's cache ACLs. Tests used the same @swc/jest 0.2.39 with @swc/core 1.15.11 (within the repository's declared range), through an untracked local configuration. No dependency or test configuration changes are included. Full monorepo CI was not run locally.

Duplicate check: searched ellipse/intersection terms and inspected every open PR's file list. Historical #5485 handles circular/coincident-center behavior, which these changes preserve; it does not correct non-circular ray intersections.

AI-assisted contribution; the reproduction and validation above were run locally.

This branch has not been deployed

No deployments
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