← Workbench

Intersect — where two segments cross

Two segments, their parameter pair and the crossing of their lines.

Build the segments and cross them Segment.new!/2 builds both segments; Intersect returns the parameters and positions.

params {0.25, 0.5}
intersection 1.0, 0.0
true intersection 1.0, 0.0

Source unavailable.

frame 1

{:ok, first} = Girihelix.Engine.Geometry.Segment.new(Girihelix.Engine.Geometry.Point.new(0.0, 0.0), Girihelix.Engine.Geometry.Point.new(4.0, 0.0))
{:ok, second} = Girihelix.Engine.Geometry.Segment.new(Girihelix.Engine.Geometry.Point.new(1.0, -2.0), Girihelix.Engine.Geometry.Point.new(1.0, 2.0))
Girihelix.Engine.Geometry.Intersect.get_intersection(first, second)