-1

Plotting packages offer a variety of methods for displaying data. Write an interactive plotting application for two dimensionsional curves. Your application should be able to allow the user to choose the mode (line strip or polyline display of the data, bar chart or pie charts), colours, and line styles.

1 Answers1

0

You should start with the GUI editation like this:

and change it to your primitives (more points per primitive instead of one ... handle each point as (sub)object so you can change its position later).

Then just add tools like add object,del object,... For hand drawing tool use piece wise interpolation cubics

The grid can be done like this:

Mouse zooming/panning is also important

Putting all above together into simple editor looks like this:

my SVG editor

Using GPU for curve rendering might give you some nice speed and functionality boost:

Mouse selection of objects might be a speed problem if your scene contains too many objects so in such case its best to use index buffers where you can mouse select with pixel perfect precision for almost free in O(1):

The example is for 3D , in 2D is much simpler ...

Also do not forget to implement save/load functionality to some vector file format. I recommend using SVG it might be complicated to start with it but you can quickly check it contents in any SVG viewer or browser also in notepad as its just a text file. If you use just basic path elements and ignore the rest of SVG features you will see the parsing and creating SVG is not that hard for example See these:

For really big datasets you might want to use spatial subdivision techniques (Bounding (Volume)Area Hierarchy, or Quad tree) to ease up the operations...

More in depth implementation details about 2D vector gfx editors depends on language, OS, gfx api and GUI api you using and task you are aiming for ...

Spektre
  • 49,595
  • 11
  • 110
  • 380