[Bug 1798606] [NEW] DrGCirlceItem>>intersectionWith:flag: needs clarification

classic Classic list List threaded Threaded
1 message Options
HJH
Reply | Threaded
Open this post in threaded view
|

[Bug 1798606] [NEW] DrGCirlceItem>>intersectionWith:flag: needs clarification

HJH
Public bug reported:

The following method implements the distinction of different cases.

Thus parameter aCurveItem actually may be any item, not only a curveItem.
The code should show this. In addition the call to this code is protected by

on: Error do: [nil]

It was difficult to spot an error here.

OLD
----

DrGCircleItem>>

intersectionWith: aCurveItem flag: aFlag
|aPoint|
        aCurveItem isLineItem
                ifTrue: [^self intersectionWithDirection: aCurveItem  flag: aFlag].
        (aCurveItem isSegmentItem or: [aCurveItem isRayItem])
                ifTrue:
                        [aPoint := self intersectionWithDirection: aCurveItem  flag: aFlag.
                        aPoint ifNil: [^nil].
                        (aCurveItem contains: aPoint)
                                ifTrue: [^aPoint]
                                ifFalse: [^nil]].
        aCurveItem isCircleItem
                ifTrue: [^self intersectionWithCircle: aCurveItem flag: aFlag].
        aCurveItem isArcItem
                ifTrue: [^aCurveItem intersectionWith: self flag: aFlag]


New
---

intersectionWith: anItem flag: aFlag
|aPoint|
        anItem isLineItem
                ifTrue: [^self intersectionWithDirection: anItem  flag: aFlag].
        (anItem isSegmentItem or: [anItem isRayItem])
                ifTrue:
                        [aPoint := self intersectionWithDirection: anItem  flag: aFlag.
                        aPoint ifNil: [^nil].
                        (anItem contains: aPoint)
                                ifTrue: [^aPoint]
                                ifFalse: [^nil]].
        anItem isCircleItem
                ifTrue: [^self intersectionWithCircle: anItem flag: aFlag].
        anItem isArcItem
                ifTrue: [^anItem intersectionWith: self flag: aFlag]

** Affects: drgeo
     Importance: Undecided
         Status: New

--
You received this bug notification because you are a member of DrGeo
developers, which is subscribed to Dr. Geo II.
Matching subscriptions: Dr. Geo bug report
https://bugs.launchpad.net/bugs/1798606

Title:
  DrGCirlceItem>>intersectionWith:flag: needs clarification

Status in Dr. Geo II:
  New

Bug description:
  The following method implements the distinction of different cases.

  Thus parameter aCurveItem actually may be any item, not only a curveItem.
  The code should show this. In addition the call to this code is protected by

  on: Error do: [nil]

  It was difficult to spot an error here.

  OLD
  ----

  DrGCircleItem>>

  intersectionWith: aCurveItem flag: aFlag
  |aPoint|
  aCurveItem isLineItem
  ifTrue: [^self intersectionWithDirection: aCurveItem  flag: aFlag].
  (aCurveItem isSegmentItem or: [aCurveItem isRayItem])
  ifTrue:
  [aPoint := self intersectionWithDirection: aCurveItem  flag: aFlag.
  aPoint ifNil: [^nil].
  (aCurveItem contains: aPoint)
  ifTrue: [^aPoint]
  ifFalse: [^nil]].
  aCurveItem isCircleItem
  ifTrue: [^self intersectionWithCircle: aCurveItem flag: aFlag].
  aCurveItem isArcItem
  ifTrue: [^aCurveItem intersectionWith: self flag: aFlag]

 
  New
  ---

  intersectionWith: anItem flag: aFlag
  |aPoint|
  anItem isLineItem
  ifTrue: [^self intersectionWithDirection: anItem  flag: aFlag].
  (anItem isSegmentItem or: [anItem isRayItem])
  ifTrue:
  [aPoint := self intersectionWithDirection: anItem  flag: aFlag.
  aPoint ifNil: [^nil].
  (anItem contains: aPoint)
  ifTrue: [^aPoint]
  ifFalse: [^nil]].
  anItem isCircleItem
  ifTrue: [^self intersectionWithCircle: anItem flag: aFlag].
  anItem isArcItem
  ifTrue: [^anItem intersectionWith: self flag: aFlag]

To manage notifications about this bug go to:
https://bugs.launchpad.net/drgeo/+bug/1798606/+subscriptions