8#include <kernel/geometry/atlas/chart.hpp> 
   41      template<
typename Mesh_>
 
   43        public ChartCRTP<Sphere<Mesh_>, Mesh_, SphereTraits>
 
   96          _midpoint.set_mat_vec_mult(rot, tmp) += offset;
 
  109          CoordType distance(grad_dist.norm_euclid());
 
  111          if(distance < Math::eps<CoordType>())
 
  134          auto& vtx = mesh.get_vertex_set();
 
  135          const auto& target_vtx = meshpart.template get_target_set<0>();
 
  157          grad_dist = (point - projected);
 
  158          grad_dist.normalize();
 
  177          grad_dist = (point - projected);
 
  178          grad_dist.normalize();
 
  185        virtual void write(std::ostream& os, 
const String& sindent)
 const override 
  187          os << sindent << 
"<Sphere";
 
  188          os << 
" radius=\"" << this->_radius << 
"\"";
 
  189          os << 
" midpoint=\"" << this->_midpoint[0] << 
" " << this->_midpoint[1] << 
" " << this->_midpoint[2] << 
"\"";
 
  194      template<
typename Mesh_, 
typename ChartReturn_ = ChartBase<Mesh_>>
 
  201        std::unique_ptr<ChartReturn_>& _chart;
 
  209        virtual bool attribs(std::map<String,bool>& attrs)
 const override 
  211          attrs.emplace(
"radius", 
true);
 
  212          attrs.emplace(
"midpoint", 
true);
 
  220          const std::map<String, String>& attrs,
 
  223          CoordType radius = CoordType(0);
 
  224          CoordType mid_x = CoordType(0);
 
  225          CoordType mid_y = CoordType(0);
 
  226          CoordType mid_z = CoordType(0);
 
  229          if(!attrs.find(
"radius")->second.parse(radius))
 
  231          if(radius < CoordType(1E-5))
 
  235          std::deque<String> mids = attrs.find(
"midpoint")->second.split_by_whitespaces();
 
  236          if(mids.size() != std::size_t(3))
 
  238          if(!mids.front().parse(mid_x) || !mids.at(1).parse(mid_y) || !mids.back().parse(mid_z))
 
  241          _chart.reset(
new ChartType(mid_x, mid_y, mid_z, radius));
 
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
Chart CRTP base-class template.
BaseClass::WorldPoint WorldPoint
our world point type
VertexSetType::CoordType CoordType
coordinate type
virtual void create(int iline, const String &sline, const String &, const std::map< String, String > &attrs, bool) override
Creates this markup parser node.
virtual void close(int, const String &) override
Closes this markup parser node.
virtual bool content(int, const String &) override
Called to process a content line.
virtual std::shared_ptr< Xml::MarkupParser > markup(int, const String &, const String &) override
Called to process a child markup node.
virtual bool attribs(std::map< String, bool > &attrs) const override
Specifies the mandatory and optional attributes.
Sphere chart class template.
BaseClass::WorldPoint WorldPoint
Vector type for world points, aka image points.
CoordType compute_signed_dist(const WorldPoint &point) const
Computes the signed distance of a point to this chart.
CoordType _radius
the sphere's radius
CoordType compute_dist(const WorldPoint &point) const
Computes the distance of a point to this chart.
WorldPoint _midpoint
the sphere's midpoint
CoordType compute_signed_dist(const WorldPoint &point, WorldPoint &grad_dist) const
Computes the signed distance of a point to this chart.
ChartCRTP< Sphere< Mesh_ >, Mesh_, SphereTraits > BaseClass
CRTP base class.
void project_point(WorldPoint &point) const
Projects a single world point.
void project_meshpart(Mesh_ &mesh, const MeshPart< Mesh_ > &meshpart) const
Projects all mesh points identified by a meshpart.
virtual String get_type() const override
Writes the type as String.
Sphere(CoordType mid_x, CoordType mid_y, CoordType mid_z, CoordType radius)
Constructor.
virtual void write(std::ostream &os, const String &sindent) const override
Writes the Chart into a stream in XML format.
BaseClass::ParamPoint ParamPoint
Vector type for parameter points, aka domain points.
CoordType compute_dist(const WorldPoint &point, WorldPoint &grad_dist) const
Computes the distance of a point to this chart.
virtual void transform(const WorldPoint &origin, const WorldPoint &angles, const WorldPoint &offset) override
BaseClass::CoordType CoordType
Floating point type.
Class template for partial meshes.
Index get_num_entities(int dim) const
Returns the number of entities.
String class implementation.
Tiny Matrix class template.
CUDA_HOST_DEVICE Matrix & set_rotation_3d(T_ yaw, T_ pitch, T_ roll)
Sets this matrix to a 3D yaw-pitch-roll rotation matrix.
Tiny Vector class template.
XML Markup Parser interface.
T_ abs(T_ x)
Returns the absolute value.
T_ signum(T_ x)
Returns the sign of a value.
std::uint64_t Index
Index data type.
static constexpr bool is_explicit
we support explicit map
static constexpr int param_dim
we have 1D parameters
static constexpr bool is_implicit
we support implicit projection
static constexpr int world_dim
this is a 2D object