 |
OpenMesh
|
52 #ifndef OPENMESH_POLYMESHT_HH
53 #define OPENMESH_POLYMESHT_HH
59 #include <OpenMesh/Core/System/config.h>
60 #include <OpenMesh/Core/Geometry/MathDefs.hh>
61 #include <OpenMesh/Core/Mesh/PolyConnectivity.hh>
62 #include <OpenMesh/Core/Mesh/FinalMeshItemsT.hh>
63 #include <OpenMesh/Core/Mesh/Tags.hh>
89 template <
class Kernel>
99 static constexpr
bool is_polymesh() {
return true; }
101 static constexpr
bool is_trimesh() {
return false; }
102 using ConnectivityTag = PolyConnectivityTag;
103 enum { IsPolyMesh = 1 };
104 enum { IsTriMesh = 0 };
109 typedef typename Kernel::Scalar
Scalar;
112 typedef typename Kernel::Point
Point;
128 typedef typename Kernel::Edge
Edge;
130 typedef typename Kernel::Face
Face;
202 {
return Kernel::new_vertex(); }
212 this->set_point(vh, _p);
230 this->set_point(vh, _p);
273 const Point& _p2)
const;
386 return this->point(this->to_vertex_handle(_heh)) -
387 this->point(this->from_vertex_handle(_heh));
406 return sqrnorm(edge_vec);
415 return 0.5 * (this->point(vh0) + this->point(vh1));
444 Scalar denom = norm(v0)*norm(v1);
450 if (this->is_boundary(_in_heh))
452 FaceHandle fh(this->face_handle(this->opposite_halfedge_handle(_in_heh)));
455 return angle(cos_a, sign_a);
489 _sector_normal = cross(vec0, vec1);
499 return norm(sector_normal)/2;
507 assert(Kernel::has_face_normals());
509 if (this->is_boundary(this->edge_handle(_heh)))
513 const Normal& n0 = this->normal(this->face_handle(_heh));
514 const Normal& n1 = this->normal(this->face_handle(this->opposite_halfedge_handle(_heh)));
519 Scalar da_sin_sign =
dot(cross(n0, n1), he);
520 return angle(da_cos, da_sin_sign);
531 if (this->is_boundary(this->edge_handle(_heh)))
539 Scalar denom = norm(n0)*norm(n1);
546 Scalar da_sin_sign =
dot(cross(n0, n1), he);
547 return angle(da_cos, da_sin_sign);
564 { Kernel::split(_fh, _vh); }
570 { Kernel::split_edge(_eh, _vh); }
573 struct PointIs3DTag {};
574 struct PointIsNot3DTag {};
606 template<
typename LHS,
typename KERNEL>
611 template<
typename LHS,
typename KERNEL>
613 return MeshCast<LHS, PolyMeshT<KERNEL>*>::cast(rhs);
616 template<
typename LHS,
typename KERNEL>
617 const LHS
mesh_cast(
const PolyMeshT<KERNEL> &rhs) {
618 return MeshCast<LHS, const PolyMeshT<KERNEL>&>::cast(rhs);
621 template<
typename LHS,
typename KERNEL>
622 const LHS
mesh_cast(
const PolyMeshT<KERNEL> *rhs) {
623 return MeshCast<LHS, const PolyMeshT<KERNEL>*>::cast(rhs);
629 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_POLYMESH_C)
630 # define OPENMESH_POLYMESH_TEMPLATES
631 # include "PolyMeshT_impl.hh"
634 #endif // OPENMESH_POLYMESHT_HH defined
Kernel::TexCoord2D TexCoord2D
TexCoord2D type.
Definition: PolyMeshT.hh:120
Kernel::FaceIter FaceIter
Scalar type.
Definition: PolyMeshT.hh:146
Normal calc_edge_vector(HalfedgeHandle _heh) const
Calculates the edge vector as the difference of the the points defined by to_vertex_handle() and from...
Definition: PolyMeshT.hh:384
void update_vertex_normals()
Update normal vectors for all vertices.
Definition: PolyMeshT_impl.hh:466
VertexHandle new_vertex(const Point &_p)
Adds a new vertex initialized to a custom position.
Definition: PolyMeshT.hh:209
Kernel::FaceFaceIter FaceFaceIter
Circulator.
Definition: PolyMeshT.hh:170
Cast a mesh with different but identical traits into each other.
Definition: FinalMeshItemsT.hh:178
void split(EdgeHandle _eh, const Point &_p)
Compute normals for all primitives.
Definition: PolyMeshT.hh:566
Kernel::ConstFaceEdgeIter ConstFaceEdgeIter
Circulator.
Definition: PolyMeshT.hh:179
Scalar calc_edge_sqr_length(HalfedgeHandle _heh) const
Compute normals for all primitives.
Definition: PolyMeshT.hh:402
void update_normal(VertexHandle _vh)
Update normal for vertex _vh.
Definition: PolyMeshT.hh:317
void calc_edge_vector(EdgeHandle _eh, Normal &_edge_vec) const
Calculates the edge vector as the vector defined by the halfedge with id #0 (see below)
Definition: PolyMeshT.hh:363
bool is_estimated_feature_edge(HalfedgeHandle _heh, const double _feature_angle) const
identifies feature edges w.r.t.
Definition: PolyMeshT_impl.hh:360
Kernel::Edge Edge
Edge type.
Definition: PolyMeshT.hh:128
void calc_vertex_normal_correct(VertexHandle _vh, Normal &_n) const
Compute normals for all primitives.
Definition: PolyMeshT_impl.hh:415
T angle(T _cos_angle, T _sin_angle)
returns the angle determined by its cos and the sign of its sin result is positive if the angle is in...
Definition: MathDefs.hh:140
Kernel::FaceEdgeIter FaceEdgeIter
Circulator.
Definition: PolyMeshT.hh:169
void update_normal(HalfedgeHandle _heh, const double _feature_angle=0.8)
Update normal for halfedge _heh.
Definition: PolyMeshT.hh:283
T sane_aarg(T _aarg)
Trigonometry/angles - related.
Definition: MathDefs.hh:122
Handle for a halfedge entity.
Definition: Handles.hh:127
Kernel::VertexIter VertexIter
Scalar type.
Definition: PolyMeshT.hh:143
Scalar calc_edge_length(HalfedgeHandle _heh) const
Calculates the length of the edge _heh.
Definition: PolyMeshT.hh:396
unsigned int find_feature_edges(Scalar _angle_tresh=OpenMesh::deg_to_rad(44.0))
tags an edge as a feature if its dihedral angle is larger than _angle_tresh returns the number of the...
Definition: PolyMeshT_impl.hh:74
Kernel::HalfedgeHandle HalfedgeHandle
Scalar type.
Definition: PolyMeshT.hh:137
Normal calc_vertex_normal(VertexHandle _vh) const
Calculate vertex normal for one specific vertex.
Definition: PolyMeshT_impl.hh:391
Kernel::VertexEdgeIter VertexEdgeIter
Circulator.
Definition: PolyMeshT.hh:165
Kernel::EdgeIter EdgeIter
Scalar type.
Definition: PolyMeshT.hh:145
Kernel::ConstEdgeIter ConstEdgeIter
Scalar type.
Definition: PolyMeshT.hh:150
Kernel::Halfedge Halfedge
Halfedge type.
Definition: PolyMeshT.hh:126
Scalar calc_edge_length(EdgeHandle _eh) const
Compute normals for all primitives.
Definition: PolyMeshT.hh:391
Scalar calc_edge_sqr_length(EdgeHandle _eh) const
Compute normals for all primitives.
Definition: PolyMeshT.hh:399
Kernel::Normal Normal
Normal type.
Definition: PolyMeshT.hh:114
VertexHandle new_vertex_dirty(const Point &_p)
Same as new_vertex(const Point&) but never shrinks, only enlarges the vertex property vectors.
Definition: PolyMeshT.hh:227
Kernel::Vertex Vertex
Vertex type.
Definition: PolyMeshT.hh:124
void calc_sector_vectors(HalfedgeHandle _in_heh, Normal &_vec0, Normal &_vec1) const
defines a consistent representation of a sector geometry: the halfedge _in_heh defines the sector ori...
Definition: PolyMeshT.hh:429
void calc_edge_vector(HalfedgeHandle _heh, Normal &_edge_vec) const
Calculates the edge vector as the difference of the the points defined by to_vertex_handle() and from...
Definition: PolyMeshT.hh:377
Kernel::HalfedgeIter HalfedgeIter
Scalar type.
Definition: PolyMeshT.hh:144
void calc_vertex_normal_loop(VertexHandle _vh, Normal &_n) const
Compute normals for all primitives.
Definition: PolyMeshT_impl.hh:443
PolyMeshT< Kernel > This
Self type. Used to specify iterators/circulators.
Definition: PolyMeshT.hh:95
Kernel::ConstVertexVertexIter ConstVertexVertexIter
Circulator.
Definition: PolyMeshT.hh:172
static constexpr bool is_polymesh()
Determine whether this is a PolyMeshT or TriMeshT (This function does not check the per face vertex c...
Definition: PolyMeshT.hh:100
Kernel::TexCoord1D TexCoord1D
TexCoord1D type.
Definition: PolyMeshT.hh:118
Kernel::FaceHandle FaceHandle
Scalar type.
Definition: PolyMeshT.hh:139
Add 3D texture coordinates (vertices, halfedges)
Definition: Attributes.hh:88
Point calc_edge_midpoint(HalfedgeHandle _heh) const
Calculates the midpoint of the halfedge _heh, defined by the positions of the two incident vertices.
Definition: PolyMeshT.hh:411
Kernel::ConstVertexOHalfedgeIter ConstVertexOHalfedgeIter
Circulator.
Definition: PolyMeshT.hh:173
PolyMeshT(const T &t)
Circulator.
Definition: PolyMeshT.hh:187
Point calc_edge_midpoint(EdgeHandle _eh) const
Calculates the midpoint of the edge _eh, defined by the positions of the two incident vertices.
Definition: PolyMeshT.hh:420
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Definition: PolyMeshT.hh:136
Add 1D texture coordinates (vertices, halfedges)
Definition: Attributes.hh:86
Scalar calc_sector_angle(HalfedgeHandle _in_heh) const
calculates the sector angle.
Definition: PolyMeshT.hh:440
Kernel::ConstVertexEdgeIter ConstVertexEdgeIter
Circulator.
Definition: PolyMeshT.hh:175
Kernel::ConstHalfedgeIter ConstHalfedgeIter
Scalar type.
Definition: PolyMeshT.hh:149
Handle for a face entity.
Definition: Handles.hh:141
Kernel::EdgeHandle EdgeHandle
Scalar type.
Definition: PolyMeshT.hh:138
Kernel::VertexIHalfedgeIter VertexIHalfedgeIter
Circulator.
Definition: PolyMeshT.hh:164
Kernel::ConstFaceVertexIter ConstFaceVertexIter
Circulator.
Definition: PolyMeshT.hh:177
Kernel::FaceHalfedgeIter FaceHalfedgeIter
Circulator.
Definition: PolyMeshT.hh:168
Scalar calc_sector_area(HalfedgeHandle _in_heh) const
calculates the area of the face sector defined by the angle <(_in_heh,next_halfedge(_in_heh)) NOTE: s...
Definition: PolyMeshT.hh:495
Scalar calc_dihedral_angle(EdgeHandle _eh) const
Compute normals for all primitives.
Definition: PolyMeshT.hh:551
void update_halfedge_normals(const double _feature_angle=0.8)
Update normal vectors for all halfedges.
Definition: PolyMeshT_impl.hh:292
Kernel::VertexVertexIter VertexVertexIter
Circulator.
Definition: PolyMeshT.hh:162
Kernel::ConstFaceIter ConstFaceIter
Scalar type.
Definition: PolyMeshT.hh:151
virtual Normal calc_halfedge_normal(HalfedgeHandle _heh, const double _feature_angle=0.8) const
Calculate halfedge normal for one specific halfedge.
Definition: PolyMeshT_impl.hh:307
Kernel::Point Point
Coordinate type.
Definition: PolyMeshT.hh:112
PolyMeshT()
Circulator.
Definition: PolyMeshT.hh:185
Kernel::FaceVertexIter FaceVertexIter
Circulator.
Definition: PolyMeshT.hh:167
Scalar calc_dihedral_angle_fast(EdgeHandle _eh) const
calculates the dihedral angle on the edge _eh
Definition: PolyMeshT.hh:525
void calc_face_centroid(FaceHandle _fh, Point &_pt) const
calculates the average of the vertices defining _fh
Definition: PolyMeshT.hh:275
Add 2D texture coordinates (vertices, halfedges)
Definition: Attributes.hh:87
void update_face_normals()
Update normal vectors for all faces.
Definition: PolyMeshT_impl.hh:277
Kernel::ConstFaceHalfedgeIter ConstFaceHalfedgeIter
Circulator.
Definition: PolyMeshT.hh:178
Scalar calc_dihedral_angle(HalfedgeHandle _heh) const
Compute normals for all primitives.
Definition: PolyMeshT.hh:529
LHS mesh_cast(PolyMeshT< KERNEL > &rhs)
Cast a mesh with different but identical traits into each other.
Definition: PolyMeshT.hh:607
void split(FaceHandle _fh, const Point &_p)
Face split (= 1-to-n split)
Definition: PolyMeshT.hh:560
void split(EdgeHandle _eh, VertexHandle _vh)
Compute normals for all primitives.
Definition: PolyMeshT.hh:569
Add colors to mesh item (vertices/faces/edges)
Definition: Attributes.hh:83
osg::Vec3f::ValueType dot(const osg::Vec3f &_v1, const osg::Vec3f &_v2)
Adapter for osg vector member computing a scalar product.
Definition: VectorAdapter.hh:176
Kernel::Color Color
Color type.
Definition: PolyMeshT.hh:116
Kernel::TexCoord3D TexCoord3D
TexCoord3D type.
Definition: PolyMeshT.hh:122
Kernel::ConstVertexFaceIter ConstVertexFaceIter
Circulator.
Definition: PolyMeshT.hh:176
Normal calc_edge_vector(EdgeHandle _eh) const
Calculates the edge vector as the vector defined by the halfedge with id #0 (see below)
Definition: PolyMeshT.hh:370
Kernel::VertexOHalfedgeIter VertexOHalfedgeIter
Circulator.
Definition: PolyMeshT.hh:163
Handle for a vertex entity.
Definition: Handles.hh:120
VertexHandle add_vertex_dirty(const Point &_p)
Alias for new_vertex_dirty().
Definition: PolyMeshT.hh:239
VertexHandle add_vertex(const Point &_p)
Alias for new_vertex(const Point&).
Definition: PolyMeshT.hh:235
Kernel::Face Face
Face type.
Definition: PolyMeshT.hh:130
virtual Normal calc_face_normal(FaceHandle _fh) const
Calculate normal vector for face _fh.
Definition: PolyMeshT_impl.hh:97
virtual ~PolyMeshT()
Circulator.
Definition: PolyMeshT.hh:188
Add normals to mesh item (vertices/faces)
Definition: Attributes.hh:82
void calc_sector_normal(HalfedgeHandle _in_heh, Normal &_sector_normal) const
calculates the normal (non-normalized) of the face sector defined by the angle <(_in_heh,...
Definition: PolyMeshT.hh:485
Definition: PolyMeshT.hh:90
void update_normals()
Compute normals for all primitives.
Definition: PolyMeshT_impl.hh:259
Kernel::VertexFaceIter VertexFaceIter
Circulator.
Definition: PolyMeshT.hh:166
Kernel::ConstVertexIter ConstVertexIter
Scalar type.
Definition: PolyMeshT.hh:148
Kernel::ConstFaceFaceIter ConstFaceFaceIter
Circulator.
Definition: PolyMeshT.hh:180
VertexHandle new_vertex()
Uses default copy and assignment operator.
Definition: PolyMeshT.hh:201
void split(FaceHandle _fh, VertexHandle _vh)
Compute normals for all primitives.
Definition: PolyMeshT.hh:563
void update_normal(FaceHandle _fh)
Update normal for face _fh.
Definition: PolyMeshT.hh:258
This file contains all code required to use Eigen3 vectors as Mesh vectors.
Definition: MeshItems.hh:59
void calc_vertex_normal_fast(VertexHandle _vh, Normal &_n) const
Different methods for calculation of the normal at _vh:
Definition: PolyMeshT_impl.hh:405
Scalar calc_dihedral_angle_fast(HalfedgeHandle _heh) const
calculates the dihedral angle on the halfedge _heh
Definition: PolyMeshT.hh:504
Kernel::Scalar Scalar
Scalar type.
Definition: PolyMeshT.hh:110
Kernel::ConstVertexIHalfedgeIter ConstVertexIHalfedgeIter
Circulator.
Definition: PolyMeshT.hh:174
Project OpenMesh,
© Computer Graphics Group, RWTH Aachen.
Documentation generated using
doxygen
.