Assignment #3 Extra Task #1

Please note, this blog entry is from a previous course. You might want to check out the current one.

In the Hints section it is noted that you are allowed to draw your graph by drawing a line from each point to the next point. Clearly if your function were discontinuous (e.g. 1/x) or if you had zoomed out so far that drawing a line between points would be jumping over a lot of changes in y, this would give misleading results to the user. The best thing would probably be to simply draw dots at each coordinate you calculate. This would not help much with the zoomed-out-too-far problem, but it would certainly be more accurate on discontinuous functions. It is up to you to figure out how to draw a dot at a point with Core Graphics.

For the mandatory tasks we connected the dots of every calculated point. Now we must draws, where there is no such drawing function in iOS, thus we draw small rectangles:

    CGRectMake([self xPointFromPixel:xPixel inRect:area] - 0.5, 
    [self yPointFromValue:y inRect:area originAtPoint:origin scale:scale] - 0.5, 1.0 , 1.0)

Leave a Reply

Your email address will not be published.