-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Description
Polygon has to store the information of it`s points position. But in our case it isn`t enough. For example, if the result of a boolean operation is a nonconvex polygon, we will be unable to reconstruct the polygon`s shape correctly because we don`t know how the points are connected to each other.
Proposed solution
We can use line segment to store relation between points. The line segment can be represented by two points - the beginning and the ending of a segment.
require_relative 'elementary/point'
class LineSegment
attr_reader :begins_at
attr_reader :ends_at
# Your implementation goes here...
end
line_segment = LineSegment.new(Point.new(1.0, 2.0), Point.new(3.0, 4.0))callmekeypuncher
Metadata
Metadata
Assignees
Labels
No labels