Code: Select all
void DoublyConnectedEdgeList::MakeImage()
{
extern const double BOUNDBOX[4];
extern const int XPIXELS;
extern const int YPIXELS;
int gridWidthX;
int gridWidthY;
Image voronoiImage( Geometry(XPIXELS, YPIXELS), Color(MaxRGB, MaxRGB, MaxRGB, 0));
voronoiImage.strokeColor("black");
voronoiImage.fillColor("white");
voronoiImage.strokeWidth(10);
//calc pixels per grid
gridWidthX = XPIXELS / (BOUNDBOX[2] - BOUNDBOX[0]+2);
gridWidthY = YPIXELS / (BOUNDBOX[3] - BOUNDBOX[1]+2);
list<Coordinate> vorCoords;
list<Drawable> vorPolygon;
vorCoords.push_back(Coordinate(1*gridWidthX,1*gridWidthY));
vorCoords.push_back(Coordinate(9*gridWidthX,1*gridWidthY));
vorCoords.push_back(Coordinate(9*gridWidthX,9*gridWidthY));
vorCoords.push_back(Coordinate(1*gridWidthX,9*gridWidthY));
vorCoords.push_back(Coordinate(1*gridWidthX,1*gridWidthY));
vorPolygon.push_back(DrawablePolygon(vorCoords));
voronoiImage.draw(vorPolygon);
//since Magick upper left is 0,0 this will set it to a standard Cartesian
voronoiImage.flip();
cout << "Write Image..." << '\n';
voronoiImage.magick("png");
voronoiImage.write("voronoidiagram.png");
}
BOUNDBOX is [0,0,8,8] and YPIXELS = 480, XPIXELS = 640. I cant figure why this is happening and I hope its something someone else has had happen to them. Thanks for the help.