<tfoot id='RDQmp'></tfoot>

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

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

        从 3D 点到线上的 3D 垂直点

        3D Perpendicular Point on Line From 3D point(从 3D 点到线上的 3D 垂直点)
              <tbody id='ckNl5'></tbody>

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

              <legend id='ckNl5'><style id='ckNl5'><dir id='ckNl5'><q id='ckNl5'></q></dir></style></legend>
                <bdo id='ckNl5'></bdo><ul id='ckNl5'></ul>
                <tfoot id='ckNl5'></tfoot>

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

                  本文介绍了从 3D 点到线上的 3D 垂直点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  这个问题以前曾在参考 2D 时被问过.这个问题将其扩展到 3D.如何从 3D 空间中的一个点找到一条直线上的垂直相交点?如果我的线由点 (x1,y1,z1) &(x2,y2,z2) 我在空间中有一个点 (x3,y3,z3).

                  This question has been asked before in reference to 2D. This question extends it to 3D. How do I find the perpendicular intersected point on a line from a point in 3D space?. If my line is defined by points (x1,y1,z1) & (x2,y2,z2) and I have a point (x3,y3,z3) in space.

                  如何在 (x3,y3,z3) 的线上找到点 (x4,y4,z4) 的垂直交点?

                  How do I find the perpendicular intersection of point (x4,y4,z4) on the line from (x3,y3,z3)?

                  推荐答案

                  对于初学者,您几乎需要一些 Vector3 类的实现,无论您是自己编写,还是在互联网某处,或使用包含 XNA 或Sharp3D.Math.

                  For starters, you pretty much need some implementation of a Vector3 class, whether you write your own, find a standalone implementation on the internet somewhere, or use a library that contains one like XNA or Sharp3D.Math.

                  通常,3d 空间中的线不是由两个点表示,而是由参数方程表示,并由向量而不是标量进行运算.您的参数方程将采用以下形式:

                  Typically lines in 3d space are not represented by two points, but by parametric equations and operated on by vectors and not scalars. Your parametric equation would be of the form:

                  x = x1 + t(x2-x1), y = y1 + t(y2-y1), z = z1 + t(z2-z1)
                  

                  向量ut的系数定义.<x2-x1, y2-y1, z2-z1>.

                  The vector u is defined by the coefficients of t. <x2-x1, y2-y1, z2-z1>.

                  矢量 PQ 由您选择的点 Q 减去线上的点 P 定义.可以选择线上的任何点,因此最简单的方法是使用线 t = 0,简化为 x1、y1 和 z1.<x3-x1, y3-y1, z3-z1>

                  The vector PQ is defined by your chosen point Q minus a point P on the line. Any point on the line can be chosen, so it would be simplest to just use the line t = 0, which simplifies to x1, y1, and z1. <x3-x1, y3-y1, z3-z1>

                  3空间中点到线的最短距离定义如下:

                  The definition of the shortest distance between a point and a line in 3-space is as follows:

                  D = ||PQ x u||/||||

                  D = ||PQ x u|| / ||u||

                  其中 x 是叉积运算符,而 ||... || 获取包含向量的大小.根据您选择的库,您的代码可能会有所不同,但应该非常相似:

                  Where x is the cross product operator, and || ... || gets the magnitude of the contained vector. Depending on which library you choose, your code may vary, but it should be very similar:

                  Vector3 u = new Vector3(x2 - x1, y2 - y1, z2 - z1);
                  Vector3 pq = new Vector3(x3 - x1, y3 - y1, z3 - z1);
                  
                  float distance = Vector3.Cross(pq, u).Length / u.Length;
                  

                  编辑:我刚刚意识到你想要的是实际的交点,而不是距离.找到实际点的公式有点不同.您需要使用内积空间来使 u 的分量垂直于 PQ.为此,您需要在 PQ 的方向上找到 u 的分量:

                  Edit: I just realized you wanted the actual point of intersection, and not the distance. The formula to find the actual point is a bit different. You need to use inner product space to get the component of u perpendicular to PQ. To do that, you need to find the component of u in the direction of PQ:

                  ((PQ · u)/||u||^2) * u

                  ((PQ · u) / ||u||^2) * u

                  这得到了 w1 组件,但我们想要 w2,它是 Q 和线之间的组件:

                  This gets us the w1 component, but we want w2, which is the component between Q and the line:

                  PQ = w1 + w2

                  w2 = PQ - w1

                  从那里,我们取 w2 并将其添加到点 Q 上,以获得最接近 Q 的直线上的点.在代码中,这将是:

                  From there, we take w2 and add it to the point Q to get the point on the line nearest Q. In code this would be:

                  Vector3 p1 = new Vector3(x1, y1, z1);
                  Vector3 p2 = new Vector3(x2, y2, z2);
                  Vector3 q = new Vector3(x3, y3, z3);
                  
                  Vector3 u = p2 - p1;
                  Vector3 pq = q - p1;
                  Vector3 w2 = pq - Vector3.Multiply(u, Vector3.Dot(pq, u) / u.LengthSquared);
                  
                  Vector3 point = q - w2;
                  

                  point.Xx4point.Yy4point.Zz4.

                  Where point.X is x4, point.Y is y4, and point.Z is z4.

                  这篇关于从 3D 点到线上的 3D 垂直点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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# - 按属性获取所有枚举值)
                1. <tfoot id='fBpa8'></tfoot>

                2. <small id='fBpa8'></small><noframes id='fBpa8'>

                      <tbody id='fBpa8'></tbody>
                    <legend id='fBpa8'><style id='fBpa8'><dir id='fBpa8'><q id='fBpa8'></q></dir></style></legend>

                          <bdo id='fBpa8'></bdo><ul id='fBpa8'></ul>

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