// and transform it to yz
const double d = radius/std::sqrt(2.0);
const double a = d/(1+std::sqrt(2.0));
- const Point<3> vertices[24] = {
- Point<3>(-half_length, -d,-d),
- Point<3>(-half_length, d,-d),
- Point<3>(-half_length, -a,-a),
- Point<3>(-half_length, a,-a),
- Point<3>(-half_length, -a, a),
- Point<3>(-half_length, a, a),
- Point<3>(-half_length, -d, d),
- Point<3>(-half_length, d, d),
- Point<3>(0, -d,-d),
- Point<3>(0, d,-d),
- Point<3>(0, -a,-a),
- Point<3>(0, a,-a),
- Point<3>(0, -a, a),
- Point<3>(0, a, a),
- Point<3>(0, -d, d),
- Point<3>(0, d, d),
- Point<3>(half_length, -d,-d),
- Point<3>(half_length, d,-d),
- Point<3>(half_length, -a,-a),
- Point<3>(half_length, a,-a),
- Point<3>(half_length, -a, a),
- Point<3>(half_length, a, a),
- Point<3>(half_length, -d, d),
- Point<3>(half_length, d, d),
+ Point<3> vertices[24] = {
+ Point<3>(-d, -half_length,-d),
+ Point<3>( d, -half_length,-d),
+ Point<3>(-a, -half_length,-a),
+ Point<3>( a, -half_length,-a),
+ Point<3>(-a, -half_length, a),
+ Point<3>( a, -half_length, a),
+ Point<3>(-d, -half_length, d),
+ Point<3>( d, -half_length, d),
+ Point<3>(-d, 0,-d),
+ Point<3>( d, 0,-d),
+ Point<3>(-a, 0,-a),
+ Point<3>( a, 0,-a),
+ Point<3>(-a, 0, a),
+ Point<3>( a, 0, a),
+ Point<3>(-d, 0, d),
+ Point<3>( d, 0, d),
+ Point<3>(-d, half_length,-d),
+ Point<3>( d, half_length,-d),
+ Point<3>(-a, half_length,-a),
+ Point<3>( a, half_length,-a),
+ Point<3>(-a, half_length, a),
+ Point<3>( a, half_length, a),
+ Point<3>(-d, half_length, d),
+ Point<3>( d, half_length, d),
};
+ // Turn cylinder such that y->x
+ for (unsigned int i=0;i<24;++i)
+ {
+ const double h = vertices[i](1);
+ vertices[i](1) = -vertices[i](0);
+ vertices[i](0) = h;
+ }
int cell_vertices[10][8] = {
{0,1,3,2,8,9,11,10},
CylinderBoundary<dim>::get_new_point_on_line (const typename Triangulation<dim>::line_iterator &line) const
{
Point<dim> middle = StraightBoundary<dim>::get_new_point_on_line (line);
-
// project to boundary
- if (dim>=3)
- middle *= radius / std::sqrt(middle.square()-middle(0)*middle(0));
+ if (dim>=3
+ && line->vertex(0).square()-line->vertex(0)(0)*line->vertex(0)(0) >= radius*radius-1.e-12
+ && line->vertex(1).square()-line->vertex(1)(0)*line->vertex(1)(0) >= radius*radius-1.e-12)
+ {
+ const double f = radius / std::sqrt(middle.square()-middle(0)*middle(0));
+ for (unsigned int i=1;i<dim;++i)
+ middle(i) *= f;
+ }
return middle;
};
Point<dim> middle = StraightBoundary<dim>::get_new_point_on_quad (quad);
// project to boundary
- if (dim>=3)
- middle *= radius / std::sqrt(middle.square()-middle(0)*middle(0));
+ if (dim>=3
+ && quad->vertex(0).square()-quad->vertex(0)(0)*quad->vertex(0)(0) >= radius*radius-1.e-12
+ && quad->vertex(1).square()-quad->vertex(1)(0)*quad->vertex(1)(0) >= radius*radius-1.e-12
+ && quad->vertex(2).square()-quad->vertex(2)(0)*quad->vertex(2)(0) >= radius*radius-1.e-12
+ && quad->vertex(3).square()-quad->vertex(3)(0)*quad->vertex(3)(0) >= radius*radius-1.e-12)
+
+ {
+ const double f = radius / std::sqrt(middle.square()-middle(0)*middle(0));
+ for (unsigned int i=1;i<dim;++i)
+ middle(i) *= f;
+ }
return middle;
};
// code in HyperBall later.
Point<dim> ds = v1-v0;
ds /= n+1;
+
+ bool scale = (dim>=3
+ && v0.square()-v0(0)*v0(0) >= radius*radius-1.e-12
+ && v1.square()-v1(0)*v1(0) >= radius*radius-1.e-12);
for (unsigned int i=0; i<n; ++i)
{
points[i] = v0+ds;
else
points[i] = points[i-1]+ds;
-
- points[i] *= radius / std::sqrt(points[i].square()-points[i](0)*points[i](0));
+
+ if (scale)
+ {
+ const double f = radius / std::sqrt(points[i].square()-points[i](0)*points[i](0));
+ for (unsigned int d=1;d<dim;++d)
+ points[i](d) *= f;
+ }
}
}