[Pharo-dev] Fix in Athens-Cairo

Alexandre Bergel alexandre.bergel at me.com
Wed Aug 7 04:03:28 EDT 2013


Hi Igor,

I think have I found a bug when circle are drawn.

I have added "(start = end) ifTrue: [ ^ self ]." in this method:

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 AthensCairoPathBuilder>>arcTo: newEndPoint angle: angle cw: aBool

	" Add a clockwise arc segment, starting from current path endpoint and
	ending at andPt. Angle should be specified in radians 
	"

	| start end center v radius startAngle endAngle cwAngle |	
		
	angle isZero ifTrue: [ ^ self lineTo: newEndPoint ].
	 
	start := endPoint.
	endPoint := end := self toAbsolute: newEndPoint.

	"we have to transform the input. because Cario expects 
	the center , radius, starting and ending angle,
	and we have the starting point, the ending point , and the angle.
	"
	aBool ifTrue: [cwAngle := angle] ifFalse: [cwAngle := angle negated].

	"Do nothing if the two points are the same"
	(start = end) ifTrue: [ ^ self ].
	center := self calcCenter: start end: end  angle: cwAngle.
	v := (start - center).
	radius := v r.
	startAngle := self angleOfVector: v.
	endAngle := self angleOfVector: (end-center).
	aBool ifTrue: [ self arcCenterX: center x centerY: center y  radius: radius  startAngle: startAngle endAngle: endAngle ]
		ifFalse: [ self arcNegativeCenterX: center x centerY: center y  radius: radius  startAngle: startAngle  endAngle: endAngle ]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

I have attached a new version of the package.  It simply defines this new method. 
It would be great to have a solution in case the start and end points are the same. 

Cheers,
Alexandre

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Athens-Cairo-AlexandreBergel.45.mcz
Type: application/octet-stream
Size: 61322 bytes
Desc: not available
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20130807/e975c691/attachment.mcz>
-------------- next part --------------

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.





More information about the Pharo-dev mailing list