EasyGeometry::D2::Line
An infinite line in 2-dimensional Euclidean space. Line inherit from Linear Entity.
#contains?(entity)
Parameters:
entity - GeometryEntity(Point, Line etc.) or Array of Numeric(coordinates)
Returns:
boolean (true or false)
Errors:l1 = EasyGeometry::D2::Line.new([0, 0], [1, 1])
l1.contains?(EasyGeometry::D2::Line.new(0, 0)) # true
l1.contains?(EasyGeometry::D2::Line.new(2, 3)) # false#distance(point)
Parameters:
point - EasyGeometry::D2::Point or Array of Numeric(coordinates)
Returns:
Numeric
Errors:
raise TypeError if point is not Point or valid Arrayl1 = EasyGeometry::D2::Line.new([0, 0], [1, 1])
l1.distance([0, 0]) # 0
l1.distance([-1, 1]) # Math.sqrt(2)#==(other)
Parameters:
other - GeometryEntity(Point, Line etc.)
Returns:
boolean (true or false)
Errors:l1 = EasyGeometry::D2::Line.new([0, 0], [1, 1])
l2 = EasyGeometry::D2::Line.new([0, 0], [1, 0])
l1 == l2 # false
l1 == l1 # true#equation
Last updated