/*private*/ void OffsetPointGenerator::computeOffsets(const Coordinate& p0, const Coordinate& p1) { double dx = p1.x - p0.x; double dy = p1.y - p0.y; double len = sqrt(dx * dx + dy * dy); // u is the vector that is the length of the offset, // in the direction of the segment double ux = offsetDistance * dx / len; double uy = offsetDistance * dy / len; double midX = (p1.x + p0.x) / 2; double midY = (p1.y + p0.y) / 2; Coordinate offsetLeft(midX - uy, midY + ux); Coordinate offsetRight(midX + uy, midY - ux); offsetPts->push_back(offsetLeft); offsetPts->push_back(offsetRight); }
int RenderBoxModelObject::pixelSnappedOffsetWidth() const { return snapSizeToPixel(offsetWidth(), offsetLeft()); }