SphericalManifold<dim, spacedim>::SphericalManifold(
const Point<spacedim> center)
: center(center)
+ , p_center(center)
, polar_manifold(center)
{}
if (spacedim == 1)
return Point<spacedim>(w * p2 + (1 - w) * p1);
- const Tensor<1, spacedim> v1 = p1 - center;
- const Tensor<1, spacedim> v2 = p2 - center;
+ const Tensor<1, spacedim> v1 = p1 - p_center;
+ const Tensor<1, spacedim> v2 = p2 - p_center;
const double r1 = v1.norm();
const double r2 = v2.norm();
// Points are collinear with the center (allow for 8*eps as a tolerance)
if (cosgamma < -1 + 8. * std::numeric_limits<double>::epsilon())
- return center;
+ return p_center;
// Points are along a line, in which case e1 and e2 are essentially the same.
if (cosgamma > 1 - 8. * std::numeric_limits<double>::epsilon())
- return Point<spacedim>(center + w * v2 + (1 - w) * v1);
+ return Point<spacedim>(p_center + w * v2 + (1 - w) * v1);
// Find the angle sigma that corresponds to arclength equal to w. acos
// should never be undefined because we have ruled out the two special cases
const Tensor<1, spacedim> P = std::cos(sigma) * e1 + std::sin(sigma) * n;
// Project this point on the manifold.
- return Point<spacedim>(center + (w * r2 + (1.0 - w) * r1) * P);
+ return Point<spacedim>(p_center + (w * r2 + (1.0 - w) * r1) * P);
}
Assert(p1 != p2, ExcMessage("p1 and p2 should not concide."));
- const Tensor<1, spacedim> v1 = p1 - center;
- const Tensor<1, spacedim> v2 = p2 - center;
+ const Tensor<1, spacedim> v1 = p1 - p_center;
+ const Tensor<1, spacedim> v2 = p2 - p_center;
const double r1 = v1.norm();
const double r2 = v2.norm();
// (tangential to the sphere). In this case, the normal vector is
// easy to compute since it is proportional to the vector from the
// center to the point 'p'.
- if (spherical_face_is_horizontal<dim, spacedim>(face, center))
+ if (spherical_face_is_horizontal<dim, spacedim>(face, p_center))
{
// So, if this is a "horizontal" face, then just compute the normal
// vector as the one from the center to the point 'p', adequately
// scaled.
- const Tensor<1, spacedim> unnormalized_spherical_normal = p - center;
+ const Tensor<1, spacedim> unnormalized_spherical_normal = p - p_center;
const Tensor<1, spacedim> normalized_spherical_normal =
unnormalized_spherical_normal / unnormalized_spherical_normal.norm();
return normalized_spherical_normal;
// (tangential to the sphere). In this case, the normal vector is
// easy to compute since it is proportional to the vector from the
// center to the point 'p'.
- if (spherical_face_is_horizontal<dim, spacedim>(face, center))
+ if (spherical_face_is_horizontal<dim, spacedim>(face, p_center))
{
// So, if this is a "horizontal" face, then just compute the normal
// vector as the one from the center to the point 'p', adequately
for (unsigned int vertex = 0;
vertex < GeometryInfo<spacedim>::vertices_per_face;
++vertex)
- face_vertex_normals[vertex] = face->vertex(vertex) - center;
+ face_vertex_normals[vertex] = face->vertex(vertex) - p_center;
}
else
Manifold<dim, spacedim>::get_normals_at_vertices(face, face_vertex_normals);
double max_distance = 0.;
for (unsigned int i = 0; i < surrounding_points.size(); ++i)
{
- directions[i] = surrounding_points[i] - center;
+ directions[i] = surrounding_points[i] - p_center;
distances[i] = directions[i].norm();
if (distances[i] != 0.)
// the Newton iteration in step 2, which would crash.
if (new_candidates[row].first == 0.0)
{
- new_points[row] = center;
+ new_points[row] = p_center;
accurate_point_was_found[row] = true;
continue;
}
{
for (unsigned int row = 0; row < weight_rows; ++row)
new_points[row] =
- center + new_candidates[row].first * new_candidates[row].second;
+ p_center + new_candidates[row].first * new_candidates[row].second;
return;
}
new_candidates[merged_weights_index[row]].second;
new_points[row] =
- center + new_candidates[row].first * new_candidates[row].second;
+ p_center + new_candidates[row].first * new_candidates[row].second;
}
}
}