Line2: use T instead of double in APIs (backport #809) - #830
Merged
Conversation
1. Set with Vector2 parameters: Verified setting start/end points
using Vector2 instances.
2. CrossProduct: Added explicit tests for both Line2 and Vector2
cross products. Expect CrossProduct of parallel lines is 0.
3. OnSegment and Within: Tested points on segment, collinear points
outside bounds, non-collinear points within bounding box, and endpoints.
4. Intersect Branch Coverage:
• Parallel collinear non-overlapping line segments.
• Collinear lines where only the second endpoint lies on the segment.
• Line extensions that intersect outside X or Y bounding ranges.
• Intersect overload taking no output point.
5. Operators: Expanded operator== and operator!= self-comparison checks.
6. Template Types: Added test cases for Line2i (int) and Line2f (float).
Assisted-by: Gemini 3.6 Flash
Signed-off-by: Steve Peters <scpeters@intrinsic.ai>
(cherry picked from commit 59ed16c)
mergify
Bot
requested review from
adityapande-1995 and
scpeters
as code owners
August 25, 2026 14:12
20 tasks
ahcorde
approved these changes
Aug 25, 2026
Member
|
@ahcorde I marked the parent PR as unsure whether to backport it Did you investigate whether it is safe to do so? |
Member
I discussed with @caguero, who believes that it is safe |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎉 New feature
Fixes some windows compiler warnings noticed in #804 and #807
Summary
While testing support for python bindings on Windows in #804, I noticed a bunch of C4244 compiler warnings from
Line2.hh:Then I noticed that
Line2is a templated class but still usesdoublein many API arguments. This updates the API to useTmore consistently. There are still some instances ofdoublearguments in theSlopefunction and for tolerance arguments, sostatic_casts are added to handle these type conversions.Summary from Gemini edited by me:
Since these are template APIs, it might be safe to backport, but I'm not sure.
Backport Policy
Test it
I don't see any uses of this class outside of gz-math, so verifying that CI passes should be sufficient
Checklist
codecheckpassed (See contributing)Assisted-by: Gemini 3.6 Flash
Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-byandGenerated-bymessages.Backports: If this is a backport, please use Rebase and Merge instead.
This is an automatic backport of pull request #809 done by [Mergify](https://mergify.com).