本文整理汇总了C#中Mesh.DuplicateMesh方法的典型用法代码示例。如果您正苦于以下问题:C# Mesh.DuplicateMesh方法的具体用法?C# Mesh.DuplicateMesh怎么用?C# Mesh.DuplicateMesh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mesh
的用法示例。
在下文中一共展示了Mesh.DuplicateMesh方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: convertProxyToMesh
internal Mesh convertProxyToMesh(Mesh baseMesh)
{
Mesh proxyAsMesh = baseMesh.DuplicateMesh();
Boolean[] shouldFaceBeDeletedFromCopy = new bool[baseMesh.Faces.Count];
UsefulFunctions.setAllArrayTo(true, shouldFaceBeDeletedFromCopy);
for (int i = 0; i < assignedFaces.Count; i++)
{
shouldFaceBeDeletedFromCopy[assignedFaces[i]] = false;
}
List<int> facesToDelete = new List<int>();
for (int i = 0; i < baseMesh.Faces.Count; i++)
{
if (shouldFaceBeDeletedFromCopy[i])
{
facesToDelete.Add(i);
}
}
proxyAsMesh.Faces.DeleteFaces(facesToDelete);
return proxyAsMesh;
}
示例2: Speaker_Balloon
//.........这里部分代码省略.........
throw new Exception();
}
m_HareMesh = new Topology[8];
for (int oct = 1; oct < 9; oct++)
{
string[] values;
swl_values[oct - 1] = double.Parse(swl[oct - 1]);
if (code[oct - 1] != "")
{
values = code[oct - 1].Split(';');
}
else
{
values = new string[umax * vmax];
for (int i = 0; i < values.Length; i++)
{
values[i] = "0";
}
}
Vector[,] Magnitude = new Vector[umax, vmax];
double Theta, Phi;
int idx = 0;
for (int v = 0; v < vmax; v++)
{
for (int u = 0; u < umax; u++)
{
if (double.IsInfinity(swl_values[oct - 1]) || double.IsNaN(swl_values[oct - 1]))
{
Magnitude[u, v] = new Vector();
}
else
{
Theta = u * System.Math.PI / (umax - 1);
Phi = 2 * v * System.Math.PI / (vmax) + System.Math.PI / 2;
Magnitude[u, v] = new Vector(Math.Sin(Theta) * Math.Cos(Phi), Math.Cos(Theta), Math.Sin(Theta) * Math.Sin(Phi));
Magnitude[u, v].Normalize();
double swlmag = (double.Parse(values[idx]) + 60);
if (swlmag < 0) swlmag = 0;
Magnitude[u, v] *= swlmag;
}
idx++;
}
}
//Create a mesh of the points...
List<Hare.Geometry.Point[]> list = new List<Hare.Geometry.Point[]>();
double Minx = double.MaxValue, Miny = double.MaxValue, Minz = double.MaxValue, Maxx = double.MinValue, Maxy = double.MinValue, Maxz = double.MinValue;
for (int u = 0; u < umax - 1; u++)
{
for (int v = 0; v < vmax; v++)
{
Hare.Geometry.Point[] Poly = new Hare.Geometry.Point[4];
Poly[0] = Magnitude[u, v];
Poly[1] = Magnitude[u, (v + 1) % vmax];
Poly[2] = Magnitude[u + 1, (v + 1) % vmax];
Poly[3] = Magnitude[u + 1, v];
list.Add(Poly);
foreach (Hare.Geometry.Point p in Poly)
{
if (p.x < Minx) Minx = p.x;
if (p.y < Miny) Miny = p.y;
if (p.z < Minz) Minz = p.z;
if (p.x > Maxx) Maxx = p.x;
if (p.y > Maxy) Maxy = p.y;
if (p.z > Maxz) Maxz = p.z;
}
}
}
m_HareMesh[oct - 1] = new Topology(new Hare.Geometry.Point(Minx, Miny, Minz), new Hare.Geometry.Point(Maxx, Maxy, Maxz));
foreach (Hare.Geometry.Point[] Poly in list) m_HareMesh[oct - 1].Add_Polygon(Poly);
}
//RhinoMeshStuff
m_RhinoMesh = new Mesh();
int ct = 0;
for (int i = 0; i < m_HareMesh[4].Polygon_Count; i++)
{
Hare.Geometry.Point[] Pt = m_HareMesh[4].Polygon_Vertices(i);
int[] F = new int[m_HareMesh[4].Polys[i].VertextCT];
//List<Point3d> F = new List<Point3d>();
for (int j = 0; j < m_HareMesh[4].Polys[i].VertextCT; j++)
{
m_RhinoMesh.Vertices.Add(new Point3d(Pt[j].x, Pt[j].y, Pt[j].z) / 90);
F[j] = ct;
//F.Add(new Point3d(Pt[j].x, Pt[j].y, Pt[j].z) / 200);
ct++;
}
m_RhinoMesh.Faces.AddFace(F[2], F[1], F[0], F[3]);
}
m_RhinoMesh.FaceNormals.ComputeFaceNormals();
m_RhinoMesh.Normals.ComputeNormals();
m_DisplayMesh = m_RhinoMesh.DuplicateMesh();
Update_Position(new Point3f((float)Center.X, (float)Center.Y, (float)Center.Z));
}
示例3: CreateBlades
private void CreateBlades()
{
var xInterval = new Interval(-Settings.GameBoardWith / 2d - Settings.BladeSize.X / 2, -Settings.GameBoardWith / 2d + Settings.BladeSize.X / 2);
var yInterval = new Interval(-Settings.BladeSize.Y / 2, Settings.BladeSize.Y / 2);
var zInterval = new Interval(-Settings.BladeSize.Z / 2, Settings.BladeSize.Z / 2);
_bladeLeft = Mesh.CreateFromBox(new Box(Plane.WorldXY, xInterval, yInterval, zInterval), 1, 1, 1);
_bladeRight = _bladeLeft.DuplicateMesh();
_bladeRight.Translate(new Vector3d(Settings.GameBoardWith, 0, 0));
_bladeLeftInitialPosition = _bladeLeft.GetBoundingBox(true).Center;
_bladeRightInitialPosition = _bladeRight.GetBoundingBox(true).Center;
_bladeLeftPosition = new Point3d(_bladeLeftInitialPosition);
_bladeRightPosition = new Point3d(_bladeRightInitialPosition);
_bladeTransformLetft = Transform.Identity;
_bladeTransformRight = Transform.Identity;
_ballTransform = Transform.Identity;
}
示例4: Populate
/// <summary>
/// Adds particle points to this class for display based on the distance traveled from the source.
/// </summary>
/// <param name="Dist"></param>
public void Populate(double Dist, Mesh M)
{
Mesh_Vis = true;
Section_Vis = false;
SPLList = new List<double>();
this.Enabled = false;
DisplayMesh = new List<Mesh>();//[PR.Length];
for (int s = 0; s < PR.Length; s++)
{
Mesh DM = M.DuplicateMesh();
DM.VertexColors.Clear();
System.Drawing.Color[] C = new System.Drawing.Color[DM.Vertices.Count];
for (int q = 0; q < PR[s].Count(); q++)
{
double SPL;
Point3d N, PT;
if (!PR[s].RayPt(q, Dist, 4, out SPL, out N, out PT)) continue;
SPLList.Add(SPL);
DM.Vertices[q] = new Point3f((float)PT.X, (float)PT.Y, (float)PT.Z);
C[q] = P_Color(SPL);
}
DM.VertexColors.AppendColors(C);
DM.Normals.ComputeNormals();
DM.FaceNormals.ComputeFaceNormals();
DisplayMesh.Add(DM);
}
this.Enabled = true;
}