本文整理汇总了C#中GraphicResearchHuiZhao.TriMesh.DualGetVertexPosition方法的典型用法代码示例。如果您正苦于以下问题:C# TriMesh.DualGetVertexPosition方法的具体用法?C# TriMesh.DualGetVertexPosition怎么用?C# TriMesh.DualGetVertexPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GraphicResearchHuiZhao.TriMesh
的用法示例。
在下文中一共展示了TriMesh.DualGetVertexPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawDualPoint
public void DrawDualPoint(TriMesh mesh)
{
GL.PointSize(GlobalSetting.DisplaySetting.PointSize);
GL.Color3(Color.Red);
GL.Begin(BeginMode.Points);
for (int i = 0; i < mesh.Faces.Count; i++)
{
Vector3D center = mesh.DualGetVertexPosition(i);
GL.Vertex3(center.x, center.y, center.z);
}
GL.End();
GL.Flush();
}
示例2: BuildMatrixDual
public SparseMatrix BuildMatrixDual(TriMesh mesh)
{
int vn = mesh.Vertices.Count;
int fn = mesh.Faces.Count;
SparseMatrix L = new SparseMatrix(fn, vn, 6);
for (int i = 0; i < fn; i++)
{
int f1 = mesh.Faces[i].GetFace(0).Index;
int f2 = mesh.Faces[i].GetFace(1).Index;
int f3 = mesh.Faces[i].GetFace(2).Index;
Vector3D dv = mesh.DualGetVertexPosition(i);
Vector3D dv1 = mesh.DualGetVertexPosition(f1);
Vector3D dv2 = mesh.DualGetVertexPosition(f2);
Vector3D dv3 = mesh.DualGetVertexPosition(f3);
Vector3D u = dv - dv3;
Vector3D v1 = dv1 - dv3;
Vector3D v2 = dv2 - dv3;
Vector3D normal = (v1.Cross(v2)).Normalize();
Matrix3D M = new Matrix3D(v1, v2, normal);
Vector3D coord = M.Inverse() * u;
double alpha;
alpha = 1.0 / 3.0;
L.AddValueTo(i, mesh.Faces[i].GetVertex(0).Index, alpha);
L.AddValueTo(i, mesh.Faces[i].GetVertex(1).Index, alpha);
L.AddValueTo(i, mesh.Faces[i].GetVertex(2).Index, alpha);
alpha = coord[0] / 3.0;
L.AddValueTo(i, mesh.Faces[f1].GetVertex(0).Index, -alpha);
L.AddValueTo(i, mesh.Faces[f1].GetVertex(1).Index, -alpha);
L.AddValueTo(i, mesh.Faces[f1].GetVertex(2).Index, -alpha);
alpha = coord[1] / 3.0;
L.AddValueTo(i, mesh.Faces[f2].GetVertex(0).Index, -alpha);
L.AddValueTo(i, mesh.Faces[f2].GetVertex(1).Index, -alpha);
L.AddValueTo(i, mesh.Faces[f2].GetVertex(2).Index, -alpha);
alpha = (1.0 - coord[0] - coord[1]) / 3.0;
L.AddValueTo(i, mesh.Faces[f3].GetVertex(0).Index, -alpha);
L.AddValueTo(i, mesh.Faces[f3].GetVertex(1).Index, -alpha);
L.AddValueTo(i, mesh.Faces[f3].GetVertex(2).Index, -alpha);
}
L.SortElement();
return L;
}
示例3: ComputeLaplacianDual
public double[][] ComputeLaplacianDual(TriMesh mesh)
{
int fn = mesh.Faces.Count;
double[][] laplacian = new double[3][];
laplacian[0] = new double[fn];
laplacian[1] = new double[fn];
laplacian[2] = new double[fn];
for (int i = 0; i < fn; i++)
{
int f1 = mesh.Faces[i].GetFace(0).Index;
int f2 = mesh.Faces[i].GetFace(1).Index;
int f3 = mesh.Faces[i].GetFace(2).Index;
Vector3D u = mesh.DualGetVertexPosition(i);
Vector3D v1 = mesh.DualGetVertexPosition(f1);
Vector3D v2 = mesh.DualGetVertexPosition(f2);
Vector3D v3 = mesh.DualGetVertexPosition(f3);
Vector3D normal = ((v1 - v3).Cross(v2 - v3)).Normalize();
Matrix3D m = new Matrix3D(v1 - v3, v2 - v3, normal);
Vector3D coord = m.Inverse() * (u - v3);
laplacian[0][i] = normal.x * coord[2];
laplacian[1][i] = normal.y * coord[2];
laplacian[2][i] = normal.z * coord[2];
}
return laplacian;
}