本文整理汇总了C#中Vector3d.Reverse方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3d.Reverse方法的具体用法?C# Vector3d.Reverse怎么用?C# Vector3d.Reverse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector3d
的用法示例。
在下文中一共展示了Vector3d.Reverse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoublePack
//Compare this circle to another circle and moves both circles in case of an overlap
public bool DoublePack(PackingCircle other, double tolerance)
{
Point3d a = this.Center;
Point3d b = other.Center;
double d = (a.X - b.X) * (a.X - b.X) + (a.Y - b.Y) * (a.Y - b.Y);
double r = m_circle.Radius + other.m_circle.Radius;
if (d < ((r * r) - 0.01 * tolerance))
{
//If the above line evaluates to TRUE, we have an overlap
Vector3d v = new Vector3d(a.X - b.X, a.Y - b.Y, 0);
v.Unitize();
v *= 0.5 * (r - Math.Sqrt(d));
Translate(v);
v.Reverse();
other.Translate(v);
InMotion = true;
return true;
}
return false;
}
示例2: subdiv
public static Mesh subdiv(Mesh oldmesh, int maxdepth, int currentdepth)
{
Mesh newmesh = new Mesh();
int vcount = 0;
for(int i = 0;i < oldmesh.Faces.Count;i++)
{
double length = 0;
//first check face type
Vector3d ab = new Vector3d (oldmesh.Vertices[oldmesh.Faces[i].B] - oldmesh.Vertices[oldmesh.Faces[i].A]);
Vector3d ac = new Vector3d (oldmesh.Vertices[oldmesh.Faces[i].C] - oldmesh.Vertices[oldmesh.Faces[i].A]);
Vector3d cb = new Vector3d (oldmesh.Vertices[oldmesh.Faces[i].B] - oldmesh.Vertices[oldmesh.Faces[i].C]);
Point3d pt0 = new Point3d();
Point3d pt1 = new Point3d();
length = ab.Length * 1 / phi;
ab.Unitize();
ab = ab * length;
length = ac.Length * 1 / phi;
ac.Unitize();
ac = ac * length;
length = cb.Length * 1 / phi;
cb.Unitize();
cb = cb * length;
if(Math.Round(ab.Length / ac.Length, 3) == 1.618)
{
//vertices
// c
// / \
//a-----------b
if(oldmesh.Faces[i].A < oldmesh.Faces[i].B)//its fatC
{
newmesh.Vertices.Add(oldmesh.Vertices[oldmesh.Faces[i].A]);vcount++;//1
ab.Reverse();
pt0 = Point3d.Add(oldmesh.Vertices[oldmesh.Faces[i].B], ab);
newmesh.Vertices.Add(pt0);vcount++;//2
newmesh.Vertices.Add(oldmesh.Vertices[oldmesh.Faces[i].B]);vcount++;//3
newmesh.Vertices.Add(oldmesh.Vertices[oldmesh.Faces[i].C]);vcount++;//4
cb.Reverse();
pt1 = Point3d.Add(oldmesh.Vertices[oldmesh.Faces[i].B], cb);
newmesh.Vertices.Add(pt1);vcount++;//5
newmesh.Faces.AddFace(vcount - 3, vcount - 4, vcount - 1);//2,1,4
newmesh.Faces.AddFace(vcount - 1, vcount - 2, vcount - 4);//3,4,1
newmesh.Faces.AddFace(vcount - 2, vcount - 5, vcount - 4);//3,0,1
}
else//its fatCC counter clockwise
{
newmesh.Vertices.Add(oldmesh.Vertices[oldmesh.Faces[i].A]);vcount++;//1
ab.Reverse();
pt0 = Point3d.Add(oldmesh.Vertices[oldmesh.Faces[i].B], ab);
newmesh.Vertices.Add(pt0);vcount++;//2
newmesh.Vertices.Add(oldmesh.Vertices[oldmesh.Faces[i].B]);vcount++;//3
newmesh.Vertices.Add(oldmesh.Vertices[oldmesh.Faces[i].C]);vcount++;//4
cb.Reverse();
pt1 = Point3d.Add(oldmesh.Vertices[oldmesh.Faces[i].B], cb);
newmesh.Vertices.Add(pt1);vcount++;//5
newmesh.Faces.AddFace(vcount - 3, vcount - 4, vcount - 1);//2,1,4
newmesh.Faces.AddFace(vcount - 1, vcount - 2, vcount - 4);//4,3,1
newmesh.Faces.AddFace(vcount - 2, vcount - 5, vcount - 4);//3,0,1
}
}
else
{
//other wise one new point on thin type
//vertices
// c
// / \
//a---b
if(oldmesh.Faces[i].A < oldmesh.Faces[i].B)//its thinC
{
ac.Reverse();
pt1 = Point3d.Add(oldmesh.Vertices[oldmesh.Faces[i].C], ac);
newmesh.Vertices.Add(oldmesh.Vertices[oldmesh.Faces[i].A]);vcount++;//1
newmesh.Vertices.Add(oldmesh.Vertices[oldmesh.Faces[i].B]);vcount++;//2
newmesh.Vertices.Add(oldmesh.Vertices[oldmesh.Faces[i].C]);vcount++;//3
newmesh.Vertices.Add(pt1);vcount++;//4
newmesh.Faces.AddFace(vcount - 1, vcount - 4, vcount - 3);//3, 0, 1
newmesh.Faces.AddFace(vcount - 2, vcount - 3, vcount - 1);//2, 1, 3
}
else
{
ac.Reverse();
pt1 = Point3d.Add(oldmesh.Vertices[oldmesh.Faces[i].C], ac);
newmesh.Vertices.Add(oldmesh.Vertices[oldmesh.Faces[i].A]);vcount++;//1
newmesh.Vertices.Add(oldmesh.Vertices[oldmesh.Faces[i].B]);vcount++;//2
newmesh.Vertices.Add(oldmesh.Vertices[oldmesh.Faces[i].C]);vcount++;//3
newmesh.Vertices.Add(pt1);vcount++;//4
newmesh.Faces.AddFace(vcount - 1, vcount - 4, vcount - 3);//3, 0, 1
newmesh.Faces.AddFace(vcount - 2, vcount - 3, vcount - 1);//2, 1, 3
}
}
// Tree.Add(newmesh);
}
if(currentdepth < maxdepth)
{
return subdiv(newmesh, maxdepth, currentdepth + 1);
}
//.........这里部分代码省略.........