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


C# Vector3.CrossProduct方法代码示例

本文整理汇总了C#中System.Vector3.CrossProduct方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3.CrossProduct方法的具体用法?C# Vector3.CrossProduct怎么用?C# Vector3.CrossProduct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Vector3的用法示例。


在下文中一共展示了Vector3.CrossProduct方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CalcFacetNormal

        /// <summary>
        /// Compute the Facet Normal between three vertices in space. The direction is given by rhs-rule
        /// v1v2 x v1v3
        /// </summary>
        /// <param name="v1"></param>
        /// <param name="v2"></param>
        /// <param name="v3"></param>
        /// <returns></returns>
        public static Vector3 CalcFacetNormal(Vertex v1, Vertex v2, Vertex v3)
        {
            var M = new Vector3(v2.X - v1.X, v2.Y - v1.Y, v2.Z - v1.Z);
            var N = new Vector3(v3.X - v1.X, v3.Y - v1.Y, v3.Z - v1.Z);
            var normalVector = M.CrossProduct(N);
            normalVector.Normalize();

            return normalVector;
        }
开发者ID:OffWind,项目名称:offwindstl,代码行数:17,代码来源:Geometry.cs

示例2: _computeQuaternion

 public static Quaternion _computeQuaternion(Vector3 direction, Vector3 upVector) {
     Quaternion q = new Quaternion();
     Vector3 zVec = direction;
     zVec = zVec.NormalisedCopy;
     Vector3 xVec = upVector.CrossProduct(zVec);
     if (xVec.IsZeroLength)
         xVec = Vector3.UNIT_X;
     xVec = xVec.NormalisedCopy;
     Vector3 yVec = zVec.CrossProduct(xVec);
     yVec = yVec.NormalisedCopy;
     q.FromAxes(xVec, yVec, zVec);
     return q;
 }
开发者ID:andyhebear,项目名称:mogre-procedural,代码行数:13,代码来源:Utils.cs

示例3: planeAngleToolStripMenuItem_Click

        private void planeAngleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // plane
            Vector3 planeDir = Vector3.UNIT_Z;
            TopoShape plane1 = GlobalInstance.BrepTools.MakePlaneFace(Vector3.ZERO, planeDir, -100, 100, -100, 100);

            {
                GeomSurface gs = new GeomSurface();
                gs.Initialize(plane1);
                List<Vector3> rst = gs.D1(gs.FirstUParameter(), gs.FirstVParameter());
                Vector3 dir2 = rst[1].CrossProduct(rst[2]);

                MessageBox.Show(dir2.ToString());
            }
    

            Vector3 normal = new Vector3(0,1,1);
            normal.Normalize();
            TopoShape plane2 = GlobalInstance.BrepTools.MakePlaneFace(Vector3.ZERO, normal, -100, 100, -100, 100);

            renderView.ShowGeometry(plane1, ++shapeId);
            renderView.ShowGeometry(plane2, ++shapeId);

            LineStyle style = new LineStyle();
            style.SetColor(ColorValue.GREEN);
            // witness
            Vector3 end1 =  new Vector3(0, 0, 100);
            LineNode line1 = new LineNode();
            line1.Set(Vector3.ZERO, end1);
            line1.SetLineStyle(style);
            renderView.ShowSceneNode(line1);

            Vector3 end2 = normal * 100;
            LineNode line2 = new LineNode();
            line2.Set(Vector3.ZERO, end2);
            line2.SetLineStyle(style);
            renderView.ShowSceneNode(line2);

            // angle
            float angle = normal.AngleBetween(planeDir);

            Vector3 dir = normal.CrossProduct(planeDir);
            dir.Normalize();
            TopoShape arc = GlobalInstance.BrepTools.MakeArc(end2, end1, Vector3.ZERO, dir);
            SceneNode arcNode = renderView.ShowGeometry(arc, ++shapeId);
            arcNode.SetLineStyle(style);

            // text
            TextNode text = new TextNode();
            text.SetText(angle.ToString());
            Vector3 pos = end2 + end1;
            pos = pos * 0.5f;
            text.SetPosition(pos);
            renderView.ShowSceneNode(text);

            renderView.RequestDraw();
        }
开发者ID:xazk027,项目名称:anycadnetsdkpro,代码行数:57,代码来源:FormMain.cs

示例4: evolvedToolStripMenuItem_Click

        private void evolvedToolStripMenuItem_Click(object sender, EventArgs e)
        {
            List<Vector3> points = new List<Vector3>();
            points.Add(new Vector3());
            points.Add(new Vector3(200, 0, 0));
            points.Add(new Vector3(200, 200, 0));
            points.Add(new Vector3(0, 200, 0));

            TopoShape polygon = GlobalInstance.BrepTools.MakePolygon(points);

            float radius = 100;
            TopoShape arc = GlobalInstance.BrepTools.MakeArc(Vector3.ZERO, new Vector3(-radius, -radius, 0), new Vector3(0, -radius, 0), Vector3.UNIT_Z);
            TopoShape line = GlobalInstance.BrepTools.MakeLine(new Vector3(-radius, -radius, 0), new Vector3(-radius, -radius * 2, 0));

            TopoShapeGroup edges = new TopoShapeGroup();
            edges.Add(arc);
            edges.Add(line);
            TopoShape wire = GlobalInstance.BrepTools.MakeWire(edges);
            

            Vector3 dirZ = new Vector3(1,-1,0);
            dirZ.Normalize();
            Vector3 dirX = dirZ.CrossProduct(Vector3.UNIT_Z);
            Coordinate3 coord = new Coordinate3(Vector3.ZERO, dirX, Vector3.UNIT_Z, dirZ);

            
            TopoShape path = GlobalInstance.BrepTools.Transform(wire, coord);
            renderView.ShowGeometry(path, ++shapeId);

            AdvFeatureTools advFT = new AdvFeatureTools();
            TopoShape shape = advFT.MakeEvolved(polygon, path, 0, true);

            renderView.ShowGeometry(shape, ++shapeId);
        }
开发者ID:xazk027,项目名称:anycadnetsdkpro,代码行数:34,代码来源:FormMain.cs


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