final SVGElement root = new SVGGElement(doc);
SVGElement elt;
root.setAttribute(LNamespace.LATEXDRAW_NAMESPACE+':'+LNamespace.XML_TYPE, LNamespace.XML_TYPE_TRIANGLE);
root.setAttribute(SVGAttributes.SVG_ID, getSVGID());
final double gap = getPositionGap()/2.;
final IPoint pt1 = shape.getTopLeftPoint();
final IPoint pt2 = shape.getBottomRightPoint();
final IPoint p1 = ShapeFactory.createPoint((pt1.getX()+pt2.getX())/2., pt1.getY());
final IPoint p2 = ShapeFactory.createPoint(pt2.getX(), pt2.getY());
final IPoint p3 = ShapeFactory.createPoint(pt1.getX(), pt2.getY());
final double p1x = p1.getX();
final double p1y = p1.getY();
final double p2x = p2.getX();
final double p2y = p2.getY();
final double p3x = p3.getX();
double cornerGap1 = GLibUtilities.getCornerGap(ShapeFactory.createPoint(p1x, p2y), p1, p2, gap);
double cornerGap2 = GLibUtilities.getCornerGap(shape.getGravityCentre(), p2, p3, gap);
if(p2x>p3x)
cornerGap2*=-1;