Skip to content

Conversation

@kaczowkad
Copy link
Contributor

Ran into an issue where intersection_point_with was not working with points that were BigDecimal. The issue was a conversion to float inside of intersection_point_with.

t = numerator.to_f / denominator;

This only appears necessary if both the numerator and denominator are integers. Limiting the conversion to this case allowed the BigDecimals to work.

…uld only convert

the numerator to a float if both numerator and denominator are integers.
@@ -1,5 +1,6 @@
require 'minitest/autorun'
require 'geometry'
require 'bigdecimal'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

(segment.point1.y - segment.point2.y) * (segment.point1.x - point1.x);
denominator = (point2.y - point1.y) * (segment.point1.x - segment.point2.x) -
denominator = (point2.y - point1.y) *
(segment.point1.x - segment.point2.x) -
Copy link
Collaborator

Choose a reason for hiding this comment

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

Align the operands of an expression in an assignment spanning multiple lines.

denominator = (point2.y - point1.y) *
(segment.point1.x - segment.point2.x) -
(segment.point1.y - segment.point2.y) *
(point2.x - point1.x);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do not use semicolons to terminate expressions.

@DanielVartanov
Copy link
Owner

@kaczowkad Perfect, thank you for your contribution!

@DanielVartanov DanielVartanov merged commit 4a39041 into DanielVartanov:master Aug 14, 2016
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.

3 participants