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 点,我如何计算法线向量?

      Given 3 points, how do I calculate the normal vector?(给定 3 点,我如何计算法线向量?)

          <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 点,我如何计算法线向量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Performance overhead of using attributes in .NET(在 .NET 中使用属性的性能开销)
                Accessing attribute info from DTE(从 DTE 访问属性信息)
                c# Hide a property in datagridview with datasource(c#使用数据源隐藏datagridview中的属性)
                Extract Display name and description Attribute from within a HTML helper(从 HTML 帮助器中提取显示名称和描述属性)
                C# Attributes and their uses(C# 属性及其用途)
                C# - Getting all enums value by attribute(C# - 按属性获取所有枚举值)
                  <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>

                      <tbody id='Xgeei'></tbody>
                          <tfoot id='Xgeei'></tfoot>
                        • <small id='Xgeei'></small><noframes id='Xgeei'>

                        • <legend id='Xgeei'><style id='Xgeei'><dir id='Xgeei'><q id='Xgeei'></q></dir></style></legend>