« Return to Thread: trans_affine question
----- Original Message -----From: georgios_vlachakis@...Newsgroups: gmane.comp.graphics.aggSent: Wednesday, March 11, 2009 7:51 PMSubject: trans_affine questionSo here's a something I can't figure out while trying to pick a transformed path's bounds ....
agg::rect_i bounds_rect = glyph->bounds;
bounds_rect.normalize();
double x1, x2, y1, y2;
x1 = bounds_rect.x1;
y1 = bounds_rect.y1 + _offsetY;
x2 = bounds_rect.x2;
y2 = bounds_rect.y2 + _offsetY;
matrix.transform(&x1,&y1);
matrix.transform(&x2,&y2);
double minx = min(x1,x2);
double miny = min(y1,y2);
double maxx = max(x1,x2);
double maxy = max(y1,y2);
The above produces different mins and maxs on the y axis:
typedef conv_transform<path_storage, trans_affine> pathTransform;
double x1, x2, y1, y2, sx, sy;
agg::rect_i bounds_rect = glyph->bounds;
bounds_rect.normalize();
agg::path_storage bounds_path;
bounds_path.move_to( bounds_rect.x1, bounds_rect.y1 + _offsetY );
bounds_path.line_to( bounds_rect.x1, bounds_rect.y2 + _offsetY );
bounds_path.line_to( bounds_rect.x2, bounds_rect.y2 + _offsetY );
bounds_path.line_to( bounds_rect.x2, bounds_rect.y1 + _offsetY );
bounds_path.close_polygon();
pathTransform transpath( bounds_path, matrix );
transpath.rewind(0);
unsigned subcmd = transpath.vertex(&sx,&sy);
minx=sx;
maxx=sx;
miny=sy;
maxy=sy;
while (!agg::is_close(subcmd))
{
minx = min(minx,sx);
maxx = max(maxx,sx);
miny = min(miny,sy);
maxy = max(maxy,sy);
subcmd = transpath.vertex(&sx,&sy);
}
« Return to Thread: trans_affine question
| Free embeddable forum powered by Nabble | Forum Help |