本文整理汇总了C#中Autodesk.get_Triangle方法的典型用法代码示例。如果您正苦于以下问题:C# Autodesk.get_Triangle方法的具体用法?C# Autodesk.get_Triangle怎么用?C# Autodesk.get_Triangle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Autodesk
的用法示例。
在下文中一共展示了Autodesk.get_Triangle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PushMesh
public static void PushMesh(Autodesk.Revit.DB.Mesh mesh, IRenderPackage package)
{
for (var i = 0; i < mesh.NumTriangles; i++)
{
var triangle = mesh.get_Triangle(i);
for (var j = 0; j < 3; j++)
{
var xyz = triangle.get_Vertex(j);
package.PushTriangleVertex(xyz.X, xyz.Y, xyz.Z);
}
var a = mesh.get_Triangle(i).get_Vertex(1).Subtract(mesh.get_Triangle(i).get_Vertex(0)).Normalize();
var b = mesh.get_Triangle(i).get_Vertex(2).Subtract(mesh.get_Triangle(i).get_Vertex(0)).Normalize();
var norm = a.CrossProduct(b);
package.PushTriangleVertexNormal(norm.X, norm.Y, norm.Z);
package.PushTriangleVertexNormal(norm.X, norm.Y, norm.Z);
package.PushTriangleVertexNormal(norm.X, norm.Y, norm.Z);
}
}
示例2: RevitMeshToHelixMesh
// must return an array to make mesh double sided
public static Mesh3D[] RevitMeshToHelixMesh(Autodesk.Revit.DB.Mesh rmesh)
{
List<int> indices_front = new List<int>();
List<int> indices_back = new List<int>();
List<Point3D> vertices = new List<Point3D>();
for (int i = 0; i < rmesh.NumTriangles; ++i)
{
MeshTriangle tri = rmesh.get_Triangle(i);
for (int k = 0; k < 3; ++k)
{
Point3D new_point = RevitPointToWindowsPoint(tri.get_Vertex(k));
bool new_point_exists = false;
for (int l = 0; l < vertices.Count; ++l)
{
Point3D p = vertices[l];
if ((p.X == new_point.X) && (p.Y == new_point.Y) && (p.Z == new_point.Z))
{
indices_front.Add(l);
new_point_exists = true;
break;
}
}
if (new_point_exists)
continue;
indices_front.Add(vertices.Count);
vertices.Add(new_point);
}
int a = indices_front[indices_front.Count - 3];
int b = indices_front[indices_front.Count - 2];
int c = indices_front[indices_front.Count - 1];
indices_back.Add(c);
indices_back.Add(b);
indices_back.Add(a);
}
List<Mesh3D> meshes = new List<Mesh3D>();
meshes.Add(new Mesh3D(vertices, indices_front));
meshes.Add(new Mesh3D(vertices, indices_back));
return meshes.ToArray();
}
示例3: TriangulateTopoMesh
//function processing the meash
public void TriangulateTopoMesh(Autodesk.Revit.DB.Mesh vMesh)
{
//setup utility class
LuxExporter.UnitConverter Converter = new UnitConverter();
// set pointer
Data.NumberOfVerticesinFace = 3;
//export all triangles
for (int i = 0; i < vMesh.NumTriangles; i++)
{
//increase face counter
iNumberOfFaces++;
//create a triangle
MeshTriangle objTriangular = vMesh.get_Triangle(i);
//calculate normal of triangle
LuxExporter.NormalOfTriangle NormalofT = new NormalOfTriangle();
XYZ NormalAtPoint = NormalofT.calcNormal(objTriangular.get_Vertex(0), objTriangular.get_Vertex(1), objTriangular.get_Vertex(2));
for (int iPointsCounter = 0; iPointsCounter < 3; iPointsCounter++)
{
XYZ point = objTriangular.get_Vertex(iPointsCounter);
//convert to meter
point = Converter.ConvertPointCoordToMeter(point);
//add to ply class
Data.AddVertice(point, NormalAtPoint);
}
}
}
示例4: SendMesh
/// <summary>
/// send a mesh to OpenCOVER.
/// </summary>
/// <param name="geomMesh"></param>
/// <remarks></remarks>
private void SendMesh(Autodesk.Revit.DB.Mesh geomMesh, ref MessageBuffer mb, bool twoSided)
{
int i = 0;
mb.add(twoSided);
mb.add(geomMesh.NumTriangles);
for (i = 0; i < geomMesh.NumTriangles; i++)
{
Autodesk.Revit.DB.MeshTriangle triangle = default(Autodesk.Revit.DB.MeshTriangle);
triangle = geomMesh.get_Triangle(i);
mb.add((float)triangle.get_Vertex(0).X);
mb.add((float)triangle.get_Vertex(0).Y);
mb.add((float)triangle.get_Vertex(0).Z);
mb.add((float)triangle.get_Vertex(1).X);
mb.add((float)triangle.get_Vertex(1).Y);
mb.add((float)triangle.get_Vertex(1).Z);
mb.add((float)triangle.get_Vertex(2).X);
mb.add((float)triangle.get_Vertex(2).Y);
mb.add((float)triangle.get_Vertex(2).Z);
}
}