[Pharo-dev] Fix in Athens-Cairo

Igor Stasenko siguctua at gmail.com
Wed Aug 7 08:07:12 EDT 2013


On 7 August 2013 10:03, Alexandre Bergel <alexandre.bergel at me.com> wrote:
> Hi Igor,
>
> I think have I found a bug when circle are drawn.
>
> I have added "(start = end) ifTrue: [ ^ self ]." in this method:
>

your change just makes it fool-proof.
The bug is in user code which specifies wrong data (drawing arc with
two coinciding points?)

Anyways, i added it.


> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>  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
>
>
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>



-- 
Best regards,
Igor Stasenko.




More information about the Pharo-dev mailing list