plotting many lines (>10^5 lines)
Posted: 2012-02-01T16:10:52-07:00
I want to use Magick++ to plot many lines (> 10^5 lines) at one time. The two plotting methods listed in the Magick++ documentation are:
1) drawing lines one at a time (e.g. image.draw( DrawableRectangle(200,200, 270,170)) )
2) drawing lines by using a linked list of Drawable opjects:
std::list<Magick::Drawable> drawList
drawList.push_back(DrawableRectangle(200,100, 270,170))
image.draw(drawList)
Are there any faster methods of plotting many lines at one time? Perhaps by plotting them "on the fly" and never saving the start and end coordinates? As I increase my line count about 10^4 it starts to take many seconds to plot from a linked list. I have included some code that plots a few hundred lines. This takes a few seconds to plot. I hope to find a method that plots upwards on 10^5 lines in only a few seconds. Any suggestions are much appreciated!
1) drawing lines one at a time (e.g. image.draw( DrawableRectangle(200,200, 270,170)) )
2) drawing lines by using a linked list of Drawable opjects:
std::list<Magick::Drawable> drawList
drawList.push_back(DrawableRectangle(200,100, 270,170))
image.draw(drawList)
Are there any faster methods of plotting many lines at one time? Perhaps by plotting them "on the fly" and never saving the start and end coordinates? As I increase my line count about 10^4 it starts to take many seconds to plot from a linked list. I have included some code that plots a few hundred lines. This takes a few seconds to plot. I hope to find a method that plots upwards on 10^5 lines in only a few seconds. Any suggestions are much appreciated!
Code: Select all
#include "Magick++.h"
#include <math.h>
using namespace Magick;
int main(){
Image image( Geometry(600,600), Color("white"));
std::list<Drawable> drawList;
drawList.push_back(DrawableStrokeColor("black"));
drawList.push_back(DrawableStrokeWidth(1));
for (int i=0;i<601; i += 30){
for (int j = 600; j > -1; j -= 30){
drawList.push_back(DrawableLine(i,0,j,600));
// can these lines be plotted on the fly within the for loop without creating a DrawableLine object?
}
}
image.draw(drawList);
image.write("track_prac.tiff");
return 0;
}