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


C# Vector3I.Cross方法代码示例

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


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

示例1: Prepare

        public override bool Prepare(Vector3I[] marks) {
            a = marks[0];
            b = marks[1];
            c = marks[2];

            if (a == b || b == c || c == a) {
                if (a != c) b = c;
                isLine = true;
            }

            Bounds = new BoundingBox(
                Math.Min(Math.Min(a.X, b.X), c.X),
                Math.Min(Math.Min(a.Y, b.Y), c.Y),
                Math.Min(Math.Min(a.Z, b.Z), c.Z),
                Math.Max(Math.Max(a.X, b.X), c.X),
                Math.Max(Math.Max(a.Y, b.Y), c.Y),
                Math.Max(Math.Max(a.Z, b.Z), c.Z)
                );

            Coords = Bounds.MinVertex;

            if (!base.Prepare(marks)) return false;

            normal = (b - a).Cross(c - a);
            normalF = normal.Normalize();
            BlocksTotalEstimate = GetBlockTotalEstimate();

            s1 = normal.Cross(a - b).Normalize();
            s2 = normal.Cross(b - c).Normalize();
            s3 = normal.Cross(c - a).Normalize();

            return true;
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:33,代码来源:TriangleDrawOperation.cs

示例2: Prepare

        public override bool Prepare(Vector3I[] marks)
        {
            a = marks[0];
            c = marks[1];
            b = marks[2];

            d = new Vector3I(a.X + c.X - b.X, a.Y + c.Y - b.Y, a.Z + c.Z - b.Z);

            Bounds = new BoundingBox(
                Math.Min(Math.Min(a.X, b.X), Math.Min(c.X, d.X)),
                Math.Min(Math.Min(a.Y, b.Y), Math.Min(c.Y, d.Y)),
                Math.Min(Math.Min(a.Z, b.Z), Math.Min(c.Z, d.Z)),
                Math.Max(Math.Max(a.X, b.X), Math.Max(c.X, d.X)),
                Math.Max(Math.Max(a.Y, b.Y), Math.Max(c.Y, d.Y)),
                Math.Max(Math.Max(a.Z, b.Z), Math.Max(c.Z, d.Z))
            );

            Coords = Bounds.MinVertex;

            if (!base.Prepare(marks))
                return false;

            normal = (b - a).Cross(c - a);
            normalF = normal.Normalize();
            BlocksTotalEstimate = GetBlockTotalEstimate();

            s1 = normal.Cross(a - b).Normalize();
            s2 = normal.Cross(b - c).Normalize();
            s3 = normal.Cross(c - d).Normalize();
            s4 = normal.Cross(d - a).Normalize();

            return true;
        }
开发者ID:Magi1053,项目名称:ProCraft,代码行数:33,代码来源:PlaneDrawOperation.cs

示例3: Cross

        public void Cross()
        {
            Vector3I a = new Vector3I(1, 0, 0);
            Vector3I b = new Vector3I(0, 1, 0);

            Vector3I cross1 = a.Cross(b);
            Assert.AreEqual(0, cross1.X);
            Assert.AreEqual(0, cross1.Y);
            Assert.AreEqual(1, cross1.Z);

            Vector3I cross2 = b.Cross(a);
            Assert.AreEqual(0, cross2.X);
            Assert.AreEqual(0, cross2.Y);
            Assert.AreEqual(-1, cross2.Z);
        }
开发者ID:jpespartero,项目名称:OpenGlobe,代码行数:15,代码来源:Vector3ITests.cs


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