EasyGeometry::D2::LinearEntity
A base class for all linear entities (Line, Ray and Segment) in 2-dimensional Euclidean space.
#direction
Parameters:
Returns:
Easy::Geometry::Vector
Errors:l1 = EasyGeometry::D2::Line.new([0, 0], [1, 1])
s2 = EasyGeometry::D2::Segment.new([0, 0], [-1, 1])
l1.direction # Vector(1, 1)
s2.direction # Vector(-1, 1)#angle_between(other)
Parameters:
other - EasyGeometry::D2::LinearEntity
Returns:
Numeric (angle in radians)
Errors:l1 = EasyGeometry::D2::Line.new([0, 0], [1, 1])
s2 = EasyGeometry::D2::Segment.new([0, 0], [-1, 1])
l1.angle_between(s2) # 90 * Math::PI / 180#parallel_to?(other)
Parameters:
other - EasyGeometry::D2::LinearEntity
Returns:
boolean (true or false)
Errors:
raise TypeError if other is not LinearEntityl1 = EasyGeometry::D2::Line.new([0, 0], [1, 1])
s2 = EasyGeometry::D2::Segment.new([0, 0], [-1, 1])
l1.parallel_to?(l1) # true
l1.parallel_to?(s2) # false#perpendicular_to?(other)
Parameters:
other - EasyGeometry::D2::LinearEntity
Returns:
boolean (true or false)
Errors:
raise TypeError if other is not LinearEntityl1 = EasyGeometry::D2::Line.new([0, 0], [1, 1])
s2 = EasyGeometry::D2::Segment.new([0, 0], [-1, 1])
l1.perpendicular_to?(l1) # false
l1.perpendicular_to?(s2) # true#similar_to?(other)
#intersection(entity)
#parallel_line(point)
#perpendicular_line(point)
#perpendicular_segment(point)
#slope
#span_test(point)
Last updated