Matt Gerrans
Posts: 1153
Nickname: matt
Registered: Feb, 2002
|
|
Re: Drawing negative rectangles?
|
Posted: Feb 5, 2003 1:31 PM
|
|
Well, I'd create a little CoordinateTransmogrifier class to convert between the coordinate system of your domain and the coordinates of the frame where you are drawing. This class would be initialized with the bounds of both coordinate sytems, then it could convert both ways with ease. It may seem like overkill, but it would make changing the mappings simpler.
For example, lets say you can draw points ranging from -100 to +100 in both dimensions (x and y) and your frame is 200 x 200 pixels (how convenient!). Then, whenever you want to draw a point from your function y = f(x), you just add 100 to the x value and 100 to the calculated y value, then draw that point.
|
|