# openmesh元素的操作

## Vec3d运算符的操作

OpenMesh::Vec3d ps(xs0, ys0, zs0);
OpenMesh::Vec3d pt(xt0, yt0, zt0);
OpenMesh::Vec3d src_normal；
double AC_dist = (pt - ps) | src_normal / src_normal.sqrnorm();
ps%pt;

|:compute scalar product，数乘,点积，x1x2 + y1y2 + z1z2
%:叉积，(y1
z2-y2z1, x2z1-x1z2, x1y2-x2*y1)
/:component-wise division by with scalar,分量上用标量除

//提取网格的对应索引的点
mesh src_mesh_;
src_mesh_->vertex_handle(点的索引)//只是得到这个点的顶点句柄
//然后使用函数point（）根据点的句柄得到src中点的坐标
src_mesh_->point(src_mesh_->vertex_handle(点的索引)//或者使用函数normal（）根据点的句柄得到src中点的法式，返回值是vec3d
OpenMesh::Vec3d src_normal = src_mesh_->normal(src_mesh_->vertex_handle(点的索引);

## 向量长度的操作

n o r m = ( ( x 2 − x 1 ) 2 + ( y 2 − y 1 ) 2 ) ½ : norm =( (x2-x1)^2 + (y2-y1)^2 )^½:

Scalar length() const        //compute euclidean norm
Scalar norm() const         //compute euclidean norm

n o r m 2 norm^2

Scalar sqrnorm() const    //compute squared euclidean norm

Scalar l1_norm() const    //compute L1 (Manhattan) norm

Scalar l8_norm() const   //compute l8_norm

//提取tar_mesh_中第i个点的第一个坐标值，存到tar_points_（为[x0,x1,...,xn]）的第0行，i列中
MatrixXX tar_points_;
tar_points_.resize(3, n_tar_vertex_);
tar_points_(0, i) = tar_mesh_->point(tar_mesh_->vertex_handle(i))[0];
//correspondence_pairs_[i0].first的第一个值作为提取的索引
point(src_mesh_->vertex_handle(correspondence_pairs_[i0].first))

Mesh* src_mesh_;
Eigen::Matrix3Xd rig_src_v = Eigen::Matrix3Xd::Zero(3, n_src_vertex_);
rig_src_v.col(i0) = Eigen::Map<Eigen::Vector3d>(src_mesh_
->point(src_mesh_->vertex_handle(correspondence_pairs_[i0].first)).data(), 3, 1);

# openmesh的半边数据结构

openmesh官方说明文档的半边结构说明(https://mcoder.cc/2019/07/06/half_edge_data_structure/)
openmesh的半边数据结构，及相关几何元素的遍历

//迭代点的邻点
VertexVertexIter: iterate over all neighboring vertices.
VertexIHalfedgeIter: iterate over all incoming halfedges.
VertexOHalfedgeIter: iterate over all outgoing halfedges.
//迭代点的所有边
VertexEdgeIter: iterate over all incident edges.
VertexFaceIter: iterate over all adjacent faces.

FaceVertexIter: iterate over the face’s vertices.
FaceHalfedgeIter: iterate over the face’s halfedges.
FaceEdgeIter: iterate over the face’s edges.
FaceFaceIter: iterate over all edge-neighboring faces.
09-24
01-04

07-03 1万+
06-22 7340
01-08 9682
01-11 1万+
01-05 1万+
06-21 6271
03-06
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客