/* -*-ePiX-*- */ #include "epix.h" using namespace ePiX; const double rad(0.5); const double th(M_PI/3), th0(-M_PI_2); void wts(const P& loc, const P& lbl, const P& offset, const std::string& msg, epix_label_posn al) { P ctr(loc + P(0, 0.75*rad)); path bd(ctr, rad*E_1, rad*E_2, th0-th, th0+th); bd += path(ctr + polar(rad, th0+th), ctr + polar(rad, th0-th)); bd.close().fill().draw(); label(lbl, offset, "\\textsf{\\itshape " + msg + "}", al); dashed(); dash_size(2); line(loc, lbl); solid(); } int main() { picture(P(-4,-3), P(4,1), "4 x 2in"); begin(); P water(-2, -2), weights(2, -0.875), sw(-1, -1), se(1, -1), ne(1, 0.5); fill(Black(0.2)); black(0.2); rect(water + sw, water + ne); black(); fill(White()); bbold(); line(water + sw, water + se); line(water + sw, water + sw + P(0, 2)); line(water + se, water + se + P(0, 2)); v_axis_tick(P(0, 0.75)); line(P(0, 1), P(0, 0)); line(P(-2, 0), P(2, 0)); line(P(-2, 0), water); line(P( 2, 0), weights); bold(); wts(water, water - P(1.5, 0), P(-2, 0), "The crown", l); wts(weights, weights + P(0.75, 0), P(2, 0), "Weights", r); label(water, P(0, -12), "\\textsf{\\itshape Water}", b); tikz_format(); end(); }