当前位置: 首页>>代码示例>>C#>>正文


C# Vector3d.Reverse方法代码示例

本文整理汇总了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;
        }
开发者ID:sbaer,项目名称:circlepacking,代码行数:23,代码来源:PackingClasses.cs

示例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);
        }
//.........这里部分代码省略.........
开发者ID:chirs,项目名称:parametric_systems,代码行数:101,代码来源:penrose.cs


注:本文中的Vector3d.Reverse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。