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

Implementation of the Line class #3

Open
raja-s opened this issue Nov 18, 2017 · 0 comments
Open

Implementation of the Line class #3

raja-s opened this issue Nov 18, 2017 · 0 comments

Comments

@raja-s
Copy link
Owner

raja-s commented Nov 18, 2017

So the Line class is implemented based on the equation: y = a x + b, where a is the slope of the line and b is its y-intercept. This is not ideal in my opinion. For example, in case of a vertical line, the slope is set to std::numeric_limits<double>::infinity() from the limits package.

A better implementation could be based on the equation: a x + b y + c = 0, which I think represents all orientations of a line in a cleaner way.

Another possibility to consider is to represent a line by a point and a vector, which is equivalent to a line parametrization:
x = x0 + vx t
y = y0 + vy t

As the whole implementation is still buggy, reimplementing the Line class and readapting all the other classes using it might help uncover bugs and hopefully fix them.

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

No branches or pull requests

1 participant