11 std::string indent(indentwidth,
' ');
12 std::string indent2(indentwidth + 8,
' ');
15 std::cout << indent <<
"ellipse, \n"
16 << indent2 <<
"w: " <<
width_m <<
", \n"
17 << indent2 <<
"h: " <<
height_m <<
", \n"
18 << indent2 <<
"origin: " << origin[0] <<
", " << origin[1] <<
",\n"
19 << indent2 <<
"angle: " << angle <<
"\n"
20 << indent2 << std::setw(14) <<
trafo_m(0, 0) << std::setw(14) <<
trafo_m(0, 1)
21 << std::setw(14) <<
trafo_m(0, 2) <<
"\n"
22 << indent2 << std::setw(14) <<
trafo_m(1, 0) << std::setw(14) <<
trafo_m(1, 1)
23 << std::setw(14) <<
trafo_m(1, 2) <<
"\n"
24 << indent2 << std::setw(14) <<
trafo_m(2, 0) << std::setw(14) <<
trafo_m(2, 1)
25 << std::setw(14) <<
trafo_m(2, 2) << std::endl;
29 const unsigned int N = 101;
31 const unsigned int colwidth = out.precision() + 8;
34 for (
unsigned int i = 0; i < N; ++i, phi += dp) {
36 pt[0] = std::copysign(
38 / (std::pow(
height_m * 0.5, 2) + std::pow(
width_m * 0.5 * tan(phi), 2))),
40 pt[1] = pt[0] * tan(phi);
43 out << std::setw(colwidth) << pt[0] << std::setw(colwidth) << pt[1] << std::endl;
48 item->writeGnuplot(out);
55 bfuncs.emplace_back(this->
clone());
59 std::shared_ptr<Ellipse> elps(
new Ellipse);
66 elps->divisor_m.emplace_back(item->clone());
69 return std::static_pointer_cast<Base>(elps);
78 const double& M11 = e_xp[0];
79 const double& M12 = e_yp[0];
80 const double& M21 = e_xp[1];
81 const double& M22 = e_yp[1];
84 double halfwidth = 0.5 * (M11 *
width_m * cos(t) + M12 *
height_m * sin(t));
85 llc[0] = center[0] - std::abs(halfwidth);
86 urc[0] = center[0] + std::abs(halfwidth);
90 double halfheight = 0.5 * (M21 *
width_m * cos(t) + M22 *
height_m * sin(t));
92 llc[1] = center[1] - std::abs(halfheight);
93 urc[1] = center[1] + std::abs(halfheight);
98 item->computeBoundingBox();
106 if (4 * (std::pow(X[0] /
width_m, 2) + std::pow(X[1] /
height_m, 2)) <= 1) {
108 if (item->isInside(R))
return false;
119 double width, height;
123 }
catch (std::runtime_error& e) {
124 std::cout << e.what() << std::endl;
133 std::cout <<
"Ellipse: a negative width provided '" << arguments.
get(0) <<
" = "
134 << elps->
width_m <<
"'" << std::endl;
138 std::cout <<
"Ellipse: a negative height provided '" << arguments.
get(1) <<
" = "
139 << elps->
height_m <<
"'" << std::endl;
ippl::Vector< T, Dim > Vector_t
constexpr double two_pi
The value of.
double parseMathExpression(const std::string &str)
std::string::iterator iterator
std::vector< std::shared_ptr< Base > > divisor_m
AffineTransformation trafo_m
bool isInside(const Vector_t< double, 3 > &X) const
virtual void computeBoundingBox()
virtual void print(int indentwidth)
virtual bool isInside(const Vector_t< double, 3 > &R) const
virtual std::shared_ptr< Base > clone() const
virtual void writeGnuplot(std::ofstream &out) const
virtual void apply(std::vector< std::shared_ptr< Base > > &bfuncs)
static bool parse_detail(iterator &it, const iterator &end, Function *fun)