1. <i id='givzV'><tr id='givzV'><dt id='givzV'><q id='givzV'><span id='givzV'><b id='givzV'><form id='givzV'><ins id='givzV'></ins><ul id='givzV'></ul><sub id='givzV'></sub></form><legend id='givzV'></legend><bdo id='givzV'><pre id='givzV'><center id='givzV'></center></pre></bdo></b><th id='givzV'></th></span></q></dt></tr></i><div id='givzV'><tfoot id='givzV'></tfoot><dl id='givzV'><fieldset id='givzV'></fieldset></dl></div>
    <legend id='givzV'><style id='givzV'><dir id='givzV'><q id='givzV'></q></dir></style></legend>

      <bdo id='givzV'></bdo><ul id='givzV'></ul>
    1. <tfoot id='givzV'></tfoot>

      <small id='givzV'></small><noframes id='givzV'>

      给定 3 点,我如何计算法线向量?

      时间:2023-07-25

          <tbody id='9YFxd'></tbody>
        • <bdo id='9YFxd'></bdo><ul id='9YFxd'></ul>
          <tfoot id='9YFxd'></tfoot>

            <small id='9YFxd'></small><noframes id='9YFxd'>

            <i id='9YFxd'><tr id='9YFxd'><dt id='9YFxd'><q id='9YFxd'><span id='9YFxd'><b id='9YFxd'><form id='9YFxd'><ins id='9YFxd'></ins><ul id='9YFxd'></ul><sub id='9YFxd'></sub></form><legend id='9YFxd'></legend><bdo id='9YFxd'><pre id='9YFxd'><center id='9YFxd'></center></pre></bdo></b><th id='9YFxd'></th></span></q></dt></tr></i><div id='9YFxd'><tfoot id='9YFxd'></tfoot><dl id='9YFxd'><fieldset id='9YFxd'></fieldset></dl></div>
            1. <legend id='9YFxd'><style id='9YFxd'><dir id='9YFxd'><q id='9YFxd'></q></dir></style></legend>
              • 本文介绍了给定 3 点,我如何计算法线向量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                给定三个 3D 点(A、B 和 C),我如何计算法线向量?这三个点定义了一个平面,我想要垂直于这个平面的向量.

                Given three 3D points (A,B, & C) how do I calculate the normal vector? The three points define a plane and I want the vector perpendicular to this plane.

                我可以获得演示此功能的示例 C# 代码吗?

                Can I get sample C# code that demonstrates this?

                推荐答案

                这取决于点的顺序.如果从法线的方向看,这些点是按逆时针顺序指定的,那么计算起来很简单:

                It depends on the order of the points. If the points are specified in a counter-clockwise order as seen from a direction opposing the normal, then it's simple to calculate:

                Dir = (B - A) x (C - A)
                Norm = Dir / len(Dir)
                

                其中 x 是叉积.

                如果您使用的是 OpenTK 或 XNA(可以访问 Vector3 类),那么只需:

                If you're using OpenTK or XNA (have access to the Vector3 class), then it's simply a matter of:

                class Triangle {
                    Vector3 a, b, c;
                    public Vector3 Normal {
                        get {
                            var dir = Vector3.Cross(b - a, c - a);
                            var norm = Vector3.Normalize(dir);
                            return norm;
                        }
                    }
                }
                

                这篇关于给定 3 点,我如何计算法线向量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:在 WPF 中将形状转换为可重用的几何图形 下一篇:是否有一种简单快捷的方法来检查多边形是否自相交?

                相关文章

                  <bdo id='Xgeei'></bdo><ul id='Xgeei'></ul>
                <i id='Xgeei'><tr id='Xgeei'><dt id='Xgeei'><q id='Xgeei'><span id='Xgeei'><b id='Xgeei'><form id='Xgeei'><ins id='Xgeei'></ins><ul id='Xgeei'></ul><sub id='Xgeei'></sub></form><legend id='Xgeei'></legend><bdo id='Xgeei'><pre id='Xgeei'><center id='Xgeei'></center></pre></bdo></b><th id='Xgeei'></th></span></q></dt></tr></i><div id='Xgeei'><tfoot id='Xgeei'></tfoot><dl id='Xgeei'><fieldset id='Xgeei'></fieldset></dl></div>

                  1. <tfoot id='Xgeei'></tfoot>
                  2. <small id='Xgeei'></small><noframes id='Xgeei'>

                  3. <legend id='Xgeei'><style id='Xgeei'><dir id='Xgeei'><q id='Xgeei'></q></dir></style></legend>