Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Circle2D intersection with Line(Segment)2D #237

Merged
merged 25 commits into from
Dec 9, 2023

Conversation

f-frhs
Copy link
Contributor

@f-frhs f-frhs commented Nov 25, 2023

I implemented the code to calculate the intersection of the circle with the line, specifically,

  • intersection of Circle2D with Line2D
  • intersection of Circle2D with LineSegment2D

It will be nice if we can discuss whether the testcases are sufficient or not.

this task is based on the comment in #186:

I think it would be useful to have additional methods, like

  • intersection of sphere with line/ray
  • intersection of sphere with plane
  • intersection of sphere with another sphere
  • functions which check if a point lies inside/on/outside of the circle

Originally posted by @jkalias in #186 (comment)

src/Spatial/Euclidean/Circle2D.cs Outdated Show resolved Hide resolved
src/Spatial/Euclidean/Circle2D.cs Show resolved Hide resolved
src/Spatial/Euclidean/Circle2D.cs Outdated Show resolved Hide resolved
src/Spatial/Euclidean/Circle2D.cs Outdated Show resolved Hide resolved
src/Spatial/Euclidean/Line2D.cs Outdated Show resolved Hide resolved
src/Spatial/Euclidean/Line2D.cs Outdated Show resolved Hide resolved
src/Spatial/Extensions/DoubleExtensions.cs Outdated Show resolved Hide resolved
src/Spatial/Euclidean/Circle2D.cs Outdated Show resolved Hide resolved
src/Spatial/Euclidean/Circle2D.cs Outdated Show resolved Hide resolved
src/Spatial.Tests/Euclidean/Circle2DTests.cs Outdated Show resolved Hide resolved
src/Spatial.Tests/Euclidean/Circle2DTests.cs Outdated Show resolved Hide resolved
Copy link
Member

@jkalias jkalias left a comment

Choose a reason for hiding this comment

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

Naming

var d = line.Direction;
var r = this.Radius;

var a = 1d;
Copy link
Member

Choose a reason for hiding this comment

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

var a = 1.0;

Copy link
Contributor Author

@f-frhs f-frhs Dec 3, 2023

Choose a reason for hiding this comment

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

Could you tell me what the difference is between var a = 1.0 and var a = 1d?
If this repo has coding conventions, I failed to read the doc. I will read it and fix this.

Thanks for the comment.

Copy link
Member

Choose a reason for hiding this comment

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

I feel that var a = 1d; is a bit like C of Fortran, that's all. I wouldn't reject a PR based on this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the comment.
I respect your feeling, and I will fix this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in the commit f-frhs@0e7eb69

src/Spatial/Euclidean/Circle2D.cs Outdated Show resolved Hide resolved
- parallel to X-axis
- parallel to Y-axis
- general cases (eg. x-y+c=0)

test: rename method's name
@f-frhs f-frhs requested a review from jkalias December 9, 2023 10:54
@f-frhs
Copy link
Contributor Author

f-frhs commented Dec 9, 2023

Could you tell me which requrest remains?
I lost myself in this PR.

@jkalias jkalias merged commit 9a40b9f into mathnet:master Dec 9, 2023
1 check passed
@jkalias
Copy link
Member

jkalias commented Dec 9, 2023

Thank you for your effort and time!

@f-frhs
Copy link
Contributor Author

f-frhs commented Dec 9, 2023

Thank YOU for your patience.
It was a nice time for me.

@f-frhs f-frhs deleted the Circle2D_Intersection branch December 25, 2023 15:47
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.

2 participants