DrGCirlceItem>>intersectionWith:flag: needs clarification

Bug #1798606 reported by Hannes Hirzel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Dr. Geo
Invalid
Undecided
Unassigned

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]

Changed in drgeo:
milestone: none → 19.03
Revision history for this message
hilaire (hilaire-fernandes) wrote :

As far as I can see, the argument aCurveItem belongs to this categories of items (2 dimensions).

I suggest you add at the beginning of the method:

 Transcript show: aCurveItem ;cr.

Or do you mean something else?

Changed in drgeo:
status: New → Triaged
Changed in drgeo:
status: Triaged → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.