关于向量、顶点、边、射线、直线和向量的实现的非常普遍的问题线段
这只是一个关于光线(和/或线段或边缘等)及其在执行/不执行光线跟踪操作的软件渲染 3D 引擎中的位置的大一般性问题。我正在学习基础知识,我是第一个承认我对这些东西了解不多的人,所以请友善。 :)
我想知道为什么不使用参数化线而不是射线(或者它们是??)。我浏览了互联网上的一些 cpp 文件,看到一些资源定义了 Ray.cpp 对象,一个具有顶点和一个向量,另一个使用一个点和一个向量。我非常确定您可以仅使用法线或向量定义无限线,然后定义沿该线的交点以创建线段作为该无限线的子集。当前是否有任何引擎以这种方式实现线路,或者是否有更好的方法来实现这一点?
为了增加进一步的复杂性(或简单性?)维基百科说,在向量空间中,线段的端点通常是向量,特别是 u -> 。 u + v,如果通过空间中的向量定义一条线而不是与一条已经定义的无限线相交,那么这很有意义,但我也找不到它的任何实现,这让我想知道在应用它时我的想法的有效性一个 3D 引擎,甚至在查看 Flash 3D 引擎 Papervision 时会产生更复杂的情况,我查看了 Ray 类,它需要 6 个单独的数值作为参数,然后将它们作为 2 个不同的 Number3D 返回,(Papervision 相当于矢量),数据类型?!?
我非常有兴趣看到实际使用正确方式根据这些低级部分的真实定义来实现的东西的实现。
This is just a LARGE generalized question regarding rays (and/or line segments or edges etc) and their place in a software rendered 3d engine that is/not performing raytracing operations. I'm learning the basics and I'm the first to admit that I don't know much about this stuff so please be kind. :)
I wondered why a parameterized line is not used instead of a ray(or are they??). I have looked around at a few cpp files around the internet and seen a couple of resources define a Ray.cpp object, one with a vertex and a vector, another used a point and a vector. I'm pretty sure that you can define an infinate line with only a normal or a vector and then define intersecting points along that line to create a line segment as a subset of that infinate line. Are there any current engines implementing lines in this way, or is there a better way to go about this?
To add further complication (or simplicity?) Wikipedia says that in vector space, the end points of a line segment are often vectors, notably u -> u + v, which makes alot of sence if defining a line by vectors in space rather than intersecting an already defined, infinate line, but I cannot find any implementation of this either which makes me wonder about the validity of my thoughts when applying this in a 3d engine and even further complication is created when looking at the Flash 3D engine, Papervision, I looked at the Ray class and it takes 6 individual number values as it's parameters and then returns them as 2 different Number3D, (the Papervision equivalent of a Vector), data types?!?
I'd be very interested to see an implementation of something which actually uses the CORRECT way of implementing these low level parts as per their true definitions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
,不,您不能。向量将定义直线的方向,但所有平行线共享相同的方向,因此要选择一条,您需要使用直线经过的特定点来确定它。
线通常以原点 + 方向*K 的形式定义,其中 K 可以取任何实数值,因为该形式对于其他数学来说很容易。您也可以使用线上的两个点。
No, you can't. A vector would define a direction of the line, but all the parallel lines share the same direction, so to pick one, you need to pin it down using a specific point that the line passes through.
Lines are typically defined in Origin + Direction*K form, where K would take any real value, because that form is easy for other math. You could as well use two points on the line.