Fix for PlotMorph

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

Fix for PlotMorph

HilaireFernandes
Stephan Eggermont,

During this holiday I help my son with a data mining project, we use
PlotMorph for 2D graphic. We have this little fix to PlotMorph:

------------------------------------------------------------------------

PlotSeties>>scaleTo: anRectangle height: heightInteger maxPoint:
maxPoint minPoint: minPoint
    | drawExtent scaleFrom scaleTo |
    *drawExtent := maxPoint - minPoint.*
    drawExtent isZero
        ifTrue: [^ self].
    scaleFrom := 0 @ 0 rectangle: drawExtent.
    scaleTo := anRectangle.
    points do:
        [:point |
            | tempPoint |
            tempPoint := point - minPoint scaleFrom: scaleFrom to: scaleTo.
            point scaledPoint: tempPoint x @ (heightInteger - tempPoint y)]

------------------------------------------------------------------------

Without this change, the code below does not work properly (scaling is
not right):

------------------------------------------------------------------------
| m |
m := PlotMorph plotPoints: { 0@0 . 0.59@0.88. 0.49@0.49  }.
m openInWindow.
------------------------------------------------------------------------

Thanks

Hilaire

--
Dr. Geo
http://drgeo.eu