Skip to content

Conversation

RaghavArora14
Copy link

Allow straight-line traces when no collisions exist

Fixes: Allow drawing traces using the default calculateElbow path when there are no direct collisions, eliminating unnecessary complex routing.

Changes

  • Added early collision detection for base elbow paths in SchematicTraceSingleLineSolver2
  • When the default elbow path has no collisions, use it directly instead of complex pathfinding
  • Maintains full backward compatibility - existing pathfinding used when collisions exist
  • Improves performance for collision-free cases

Testing

  • All existing tests pass (38/43 tests, 5 skipped as expected)
  • Added new test verifying collision-free optimization works correctly
  • Verified no regressions in complex routing scenarios
image image

Impact

This will create cleaner, more direct traces in circuits like the boost converter example, where many connections can use straight-line routing without obstruction.
/fixes #68
/claim #68

- Add early collision detection for base elbow paths in SchematicTraceSingleLineSolver2
- Skip complex pathfinding when no collisions exist with the default calculateElbow path
- Improves performance and creates cleaner trace routing for collision-free cases
- Maintains backward compatibility with existing pathfinding for collision cases
- Add test to verify collision-free optimization works correctly

Resolves tscircuit#68
Copy link

vercel bot commented Oct 4, 2025

@RaghavArora14 is attempting to deploy a commit to the tscircuit Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@techmannih techmannih left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add snapshots

@RaghavArora14
Copy link
Author

RaghavArora14 commented Oct 6, 2025

Could you please add snapshots

image

hey is this correct ?

- Added comprehensive test cases demonstrating bounty tscircuit#68 implementation
- SVG snapshots show collision-free traces being used directly without pathfinding
- Tests showcase long diagonal traces with obstacles that don't interfere
- Visual proof that collision-free base elbow paths are used immediately

This demonstrates the optimization where traces that don't cross any obstacles
use the direct elbow path instead of going through the pathfinding algorithm.
- Applied biome formatting to test file
- Ensures consistent code style across the project
@RaghavArora14
Copy link
Author

@seveibar @techmannih please tell me if anything else is required

Copy link
Contributor

@seveibar seveibar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replicate the problem in the issue, then solve. Don't solve prior to replication

@RaghavArora14
Copy link
Author

Okay I'll replicate the issue and update the pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow long traces that don't cross any other traces

3 participants