23#ifndef VCL_MESH_COMPONENTS_POSITION_H
24#define VCL_MESH_COMPONENTS_POSITION_H
26#include "base/component.h"
27#include "base/predicates.h"
29#include <vclib/space/core.h>
58template<Po
intConcept P,
typename ParentElemType =
void,
bool OPT = false>
61 Position<P, ParentElemType, OPT>,
65 !std::is_same_v<ParentElemType, void>,
68 using Base = Component<
73 !std::is_same_v<ParentElemType, void>,
95 const P&
position()
const {
return Base::data(); }
105 template<
typename Element>
106 void importFrom(
const Element& v,
bool =
true);
108 void serialize(std::ostream&
os)
const {
position().serialize(
os); }
110 void deserialize(std::istream& is) {
position().deserialize(is); }
127concept HasPosition = TTB::IsDerivedFromSpecializationOfV<T, Position>;
131template<Po
intConcept P,
typename ParentElemType,
bool OPT>
132template<
typename Element>
133void Position<P, ParentElemType, OPT>::importFrom(
const Element& v,
bool)
135 using ScalarType = PositionType::ScalarType;
137 if (isPositionAvailableOn(v)) {
138 position() = v.position().template cast<ScalarType>();
156bool isPositionAvailableOn(
const auto& element)
176template<
typename Scalar,
typename ElementType =
void,
bool OPT = false>
191template<
typename ElementType =
void,
bool OPT = false>
206template<
typename ElementType =
void,
bool OPT = false>
The Element class.
Definition element.h:75
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:41
The Position class represents a N-Dimensional point that will be part of an Element (e....
Definition position.h:67
P PositionType
Expose the type of the Position.
Definition position.h:80
const P & position() const
Returns a const reference of the position of the element.
Definition position.h:95
Position()=default
Initilizes the Position to (0, 0, 0).
P & position()
Returns a reference of the position of the element.
Definition position.h:101
A concept that checks whether a type T (that should be a Element) has the Position component (inherit...
Definition position.h:127