Skip to content

Use a clamped cubic for the line-line switchover - #23

Merged
nhz2 merged 1 commit into
mainfrom
cubic-switchover
Oct 26, 2026
Merged

nhz2 merged 1 commit into
mainfrom
cubic-switchover

Conversation

@nhz2

@nhz2 nhz2 commented Oct 26, 2026

Copy link
Copy Markdown
Member

Replace tanh in the line-line force switchover with 1 - (1 - x/3)^3 for x < 3 and 1 after. It has the same slope at zero and a similar shape, continuous first and second derivatives, and reaches exactly 1, so far from parallel segments use only the closest point energy. It also has no exp, which makes it easy to vectorize.

Replace `tanh` in the line-line force switchover with
`1 - (1 - x/3)^3` for `x < 3` and `1` after. It has the same slope at
zero and a similar shape, continuous first and second derivatives, and
reaches exactly 1, so far from parallel segments use only the closest
point energy. It also has no `exp`, which makes it easy to vectorize.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nhz2
nhz2 merged commit 2bee6e3 into main Oct 26, 2026
2 checks passed
@nhz2
nhz2 deleted the cubic-switchover branch October 26, 2026 04:08
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