Extension { #name : #BlPolylineGeometry }

{ #category : #'*Bloc-Alexandrie' }
BlPolylineGeometry >> aeApplyTo: aeCanvas element: aBlElement [

	aeCanvas drawOpenPathWith: [ :cairoContext |
		self vertices do: [ :each | cairoContext lineTo: each ] ]

]

{ #category : #'*Bloc-Alexandrie' }
BlPolylineGeometry >> aeContainsPoint: aPoint in: aBlElement [
	"Answer whether aPoint is contained by a this geometry."

	self flag: #todo. "This is wrong"
	^ BAOffscreen instance
		  is: aPoint
		  inFillOfVertices: self vertices
]

Extension { #name : #BlPolylineGeometry }

{ #category : #'*Bloc-Alexandrie' }
BlPolylineGeometry >> aeApplyTo: aeCanvas element: aBlElement [

	aeCanvas drawOpenPathWith: [ :cairoContext |
		self vertices do: [ :each | cairoContext lineTo: each ] ]

]

{ #category : #'*Bloc-Alexandrie' }
BlPolylineGeometry >> aeContainsPoint: aPoint in: aBlElement [
	"Answer whether aPoint is contained by this geometry.
	
	Based on RSPolyline>>#basicIncludesPoint:"

	vertices overlappingPairsDo: [ :a :b | 
		(aPoint onLineFrom: a to: b within: aBlElement border width / 2) 
			ifTrue: [ ^ true ] ].
	^ false
]

Improve hit testing and polyline using Math API
Improve hit testing and polyline using Math API

Based on the approach in RSPolyline>>#basicIncludesPoint:
pharo-graphics/Bloc