Exemple #1
0
void
LPEMirrorSymmetry::doOnApply (SPLPEItem *lpeitem)
{
    using namespace Geom;

    SPItem *item = SP_ITEM(lpeitem);
    Geom::Matrix t = sp_item_i2d_affine(item);
    Geom::Rect bbox = *item->getBounds(t); // fixme: what happens if getBounds does not return a valid rect?

    Point A(bbox.left(), bbox.bottom());
    Point B(bbox.left(), bbox.top());
    A *= t;
    B *= t;
    Piecewise<D2<SBasis> > rline = Piecewise<D2<SBasis> >(D2<SBasis>(Linear(A[X], B[X]), Linear(A[Y], B[Y])));
    reflection_line.set_new_value(rline, true);
}
void
LPEMirrorSymmetry::doOnApply (SPLPEItem const* lpeitem)
{
    using namespace Geom;

    // fixme: what happens if the bbox is empty?
    // fixme: this is probably wrong
    Geom::Affine t = lpeitem->i2dt_affine();
    Geom::Rect bbox = *lpeitem->desktopVisualBounds();

    Point A(bbox.left(), bbox.bottom());
    Point B(bbox.left(), bbox.top());
    A *= t;
    B *= t;
    Piecewise<D2<SBasis> > rline = Piecewise<D2<SBasis> >(D2<SBasis>(SBasis(A[X], B[X]), SBasis(A[Y], B[Y])));
    reflection_line.set_new_value(rline, true);
}