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


C# Point3d.Cross方法代码示例

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


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

示例1: Point3d_Cross_123_456

        public void Point3d_Cross_123_456()
        {
            Point3d a = new Point3d(1.0, 2.0, 3.0),
                    b = new Point3d(4.0, 5.0, 6.0);
            Point3d actual = a.Cross(b);
            Point3d expected = new Point3d(-3.0, 6.0, -3.0);

            Assert.That(actual.x, Is.EqualTo(expected.x).Within(1).Ulps);
            Assert.That(actual.y, Is.EqualTo(expected.y).Within(1).Ulps);
            Assert.That(actual.z, Is.EqualTo(expected.z).Within(1).Ulps);
        }
开发者ID:ItEndsWithTens,项目名称:Quinstance,代码行数:11,代码来源:QuinstanceTests.cs

示例2: Point3d_Cross_Oddball

        public void Point3d_Cross_Oddball()
        {
            // I started with random numbers for a and b, got the values of
            // 'expected', then used the Visual Studio debugger's Watch panel
            // to get (double)(float)value. This test case will therefore serve
            // only as a regression test in case I do something stupid.
            Point3d a = new Point3d(0.001, 0.0001, 0.00001),
                 b = new Point3d(473.6, 9.0, 1.1);
            Point3d actual = a.Cross(b);
            Point3d expected = new Point3d(0.000020000000000000012, 0.0036360000000000003, -0.038360000000000005);

            Assert.That(actual.x, Is.EqualTo(expected.x).Within(1).Ulps);
            Assert.That(actual.y, Is.EqualTo(expected.y).Within(1).Ulps);
            Assert.That(actual.z, Is.EqualTo(expected.z).Within(1).Ulps);
        }
开发者ID:ItEndsWithTens,项目名称:Quinstance,代码行数:15,代码来源:QuinstanceTests.cs

示例3: Plane

            public Plane(string map_line, bool flip_normal=false)
            {
                char[] plane_delims = { '(', ')', ' ' };
                string[] plane_strings = map_line.Split(plane_delims, StringSplitOptions.RemoveEmptyEntries);

                double a_x, a_y, a_z;
                Double.TryParse(plane_strings[0], out a_x);
                Double.TryParse(plane_strings[1], out a_y);
                Double.TryParse(plane_strings[2], out a_z);

                double b_x, b_y, b_z;
                Double.TryParse(plane_strings[3], out b_x);
                Double.TryParse(plane_strings[4], out b_y);
                Double.TryParse(plane_strings[5], out b_z);

                double c_x, c_y, c_z;
                Double.TryParse(plane_strings[6], out c_x);
                Double.TryParse(plane_strings[7], out c_y);
                Double.TryParse(plane_strings[8], out c_z);

                this.f_a = new Point3d(a_x, a_y, a_z);
                this.f_b = new Point3d(b_x, b_y, b_z);
                this.f_c = new Point3d(c_x, c_y, c_z);

                Point3d vec_a = new Point3d(this.b - this.a),
                        vec_b = new Point3d(this.c - this.a);
                this.f_normal = vec_a.Cross(vec_b).Normalize();
                if (flip_normal)
                    this.f_normal = new Point3d(-this.f_normal.x, -this.f_normal.y, -this.f_normal.z);
            }
开发者ID:ItEndsWithTens,项目名称:Quinstance,代码行数:30,代码来源:Quin3d.cs


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