CN114612609A - Curved surface reflection line calculation method, device, computer equipment and storage medium - Google Patents

Curved surface reflection line calculation method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN114612609A
CN114612609A CN202210175365.2A CN202210175365A CN114612609A CN 114612609 A CN114612609 A CN 114612609A CN 202210175365 A CN202210175365 A CN 202210175365A CN 114612609 A CN114612609 A CN 114612609A
Authority
CN
China
Prior art keywords
triangle
space
plane
ray
line segment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210175365.2A
Other languages
Chinese (zh)
Inventor
厉夫兵
何靖宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Information Science and Technology University
Original Assignee
Beijing Information Science and Technology University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Information Science and Technology University filed Critical Beijing Information Science and Technology University
Priority to CN202210175365.2A priority Critical patent/CN114612609A/en
Publication of CN114612609A publication Critical patent/CN114612609A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/10Geometric CAD

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Geometry (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computer Graphics (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Image Generation (AREA)

Abstract

The invention provides a curved surface reflection line calculation method, a curved surface reflection line calculation device, computer equipment and a storage medium, wherein the method comprises the steps of determining a plane triangle; constructing a first space curve corresponding to each side of a plane triangle; acquiring coordinates and normal vectors of all points forming a first space curve; constructing a plurality of second space curves and third space curves based on the coordinates and normal vector lines of each point of each first space curve corresponding to the plane triangle; dividing the area where the plane triangle is located into a plurality of plane sub-triangles based on the second space curves and the third space curves; acquiring rays; determining a planar sub-triangle intersecting the ray; and calculating the reflected ray of the intersection point position of the ray on the plane sub-triangle by using the reflection law. The method for reconstructing the curved surface by using the vertex coordinates and the normal vector of the plane triangle and calculating the light reflected by the curved surface makes the constructed curve smoother and makes the calculated reflected light more accurate.

Description

曲表面反射线计算方法、装置、计算机设备和存储介质Curved surface reflection line calculation method, device, computer equipment and storage medium

技术领域technical field

本发明涉及射线在曲表面反射线计算技术领域,特别涉及一种曲表面反射线计算方法、装置、计算机设备和存储介质。The invention relates to the technical field of ray reflection line calculation on a curved surface, in particular to a calculation method, device, computer equipment and storage medium for a curved surface reflection line.

背景技术Background technique

在三维几何建模中,目标曲表面通常被离散为大量的三角形、四边形平面元。对于目标曲面而言,面元剖分数量足够多,才能足够逼近原始曲面。当目标剖分数量不是那么充足时,一些场景下需要基于当前的平面元模型重建其弯曲表面,以提高模型表示精度。另外,当一束光照射到真实的曲面时(例如球表面),其反射光线的分布在空间上是连续的;如果曲面用剖分的平面元表示,无论该表面剖分得多么精细,其反射光线的分布在空间上也是不连续的。究其原因,是因为平面元的法矢量唯一,而该平面元所处的原始曲面的法矢量是处处不同的、空间连续分布的。因此,在计算光线在曲面的反射时,为提高计算精度,逼近真实情况,也有必要对曲面进行重建并求解射线与曲面的交点和反射光线。In 3D geometric modeling, the target surface is usually discretized into a large number of triangular and quadrilateral plane elements. For the target surface, the number of surfels is large enough to approximate the original surface sufficiently. When the number of target subdivisions is not so sufficient, in some scenarios, the curved surface needs to be reconstructed based on the current planar metamodel to improve the model representation accuracy. In addition, when a beam of light strikes a real surface (such as a spherical surface), the distribution of its reflected rays is continuous in space; if the surface is represented by a subdivided plane element, no matter how finely the surface is subdivided, its The distribution of reflected light is also spatially discontinuous. The reason is that the normal vector of the plane element is unique, and the normal vector of the original surface where the plane element is located is different everywhere and continuously distributed in space. Therefore, when calculating the reflection of light on the surface, in order to improve the calculation accuracy and approximate the real situation, it is also necessary to reconstruct the surface and solve the intersection of the ray and the surface and the reflected light.

2015年,电子工业出版社出版的图书《有限元分析:ANSYS理论与应用:第4版》推导了一种将三角形平面元重建为三角形曲面的方法,该方法使用形函数,在已知重建曲面上6个点的情况下,可计算出重建曲面上的任意一点,即得到重建的曲面。该方法的问题在于,相邻的重建曲面之间不容易保持连续,或者即便连续,但重建曲面组成的目标表面不容易保持光滑,导致在计算射线在目标表面的反射光线时存在较大的误差。In 2015, the book "Finite Element Analysis: ANSYS Theory and Applications: 4th Edition", published by Electronic Industry Press, deduces a method for reconstructing triangular planar elements into triangular surfaces, which uses shape functions to reconstruct surfaces in known In the case of the upper 6 points, any point on the reconstructed surface can be calculated, that is, the reconstructed surface can be obtained. The problem with this method is that it is not easy to maintain continuity between adjacent reconstructed surfaces, or even if they are continuous, the target surface composed of reconstructed surfaces is not easy to keep smooth, resulting in a large error in calculating the reflected rays of rays on the target surface. .

发明内容SUMMARY OF THE INVENTION

基于此,有必要针对上述技术问题,提供一种曲表面反射线计算方法、装置、计算机设备和存储介质。Based on this, it is necessary to provide a method, device, computer equipment and storage medium for calculating the reflection line of a curved surface in view of the above technical problems.

一种曲表面反射线计算方法,包括:A method for calculating the reflection line of a curved surface, comprising:

确定平面三角形;Determine the plane triangle;

构建所述平面三角形的各边对应的第一空间曲线;constructing a first space curve corresponding to each side of the plane triangle;

获取组成所述第一空间曲线的各点的坐标和法矢量;obtaining the coordinates and normal vectors of each point forming the first space curve;

基于所述平面三角形对应的各所述第一空间曲线的各点的坐标和法矢量线构建多个第二空间曲线和第三空间曲线,其中,各所述第二空间曲线的两端的端点位于相邻的两个所述第一空间曲线上;A plurality of second space curves and third space curves are constructed based on the coordinates and normal vector lines of each point of each of the first space curves corresponding to the plane triangle, wherein the endpoints of both ends of each of the second space curves are located at on two adjacent first space curves;

基于各所述第二空间曲线和各所述第三空间曲线将所述平面三角形所在区域划分为多个平面子三角形;dividing the area where the plane triangle is located into a plurality of plane sub-triangles based on each of the second space curves and each of the third space curves;

获取射线;get rays;

确定与所述射线相交的平面子三角形;determining the planar sub-triangle intersecting the ray;

利用反射定律计算所述射线在所述平面子三角形上的交点位置的反射光线。The reflected ray at the intersection of the ray on the plane sub-triangle is calculated using the law of reflection.

在其中一个实施例中,所述构建所述平面三角形的各边对应的第一空间曲线的步骤包括:In one of the embodiments, the step of constructing the first space curve corresponding to each side of the plane triangle includes:

计算所述平面三角形的三个顶点的法矢量;Calculate the normal vectors of the three vertices of the planar triangle;

根据所述平面三角形的边的顶点的坐标和法矢量,构建据所述平面三角形的边对应的所述第一空间曲线。The first space curve corresponding to the sides of the plane triangle is constructed according to the coordinates and normal vectors of the vertices of the sides of the plane triangle.

在其中一个实施例中,所述根据所述平面三角形的边的顶点的坐标和法矢量,构建据所述平面三角形的边对应的所述第一空间曲线的步骤包括:In one of the embodiments, the step of constructing the first space curve corresponding to the sides of the plane triangle according to the coordinates and normal vectors of the vertices of the sides of the plane triangle includes:

以所述平面三角形的边的顶点的坐标作为第一线段的两个端点,沿所述第一线段的一端至另一端进行法矢量插值,得到第一法矢量曲面;Taking the coordinates of the vertices of the sides of the plane triangle as the two endpoints of the first line segment, performing normal vector interpolation along one end of the first line segment to the other end to obtain a first normal vector surface;

基于所述第一法矢量曲面,进行空间曲线预测,构建所述第一空间曲线。Based on the first normal vector surface, a space curve prediction is performed to construct the first space curve.

在其中一个实施例中,所述基于所述第一法矢量曲面,进行空间曲线预测,构建所述第一空间曲线的步骤之后还包括:In one of the embodiments, the step of performing spatial curve prediction based on the first normal vector surface, and constructing the first spatial curve further includes:

对构建的所述第一空间曲线进行误差修正。Error correction is performed on the constructed first space curve.

在其中一个实施例中,所述基于所述平面三角形对应的各所述第一空间曲线的各点的坐标和法矢量线构建多个第二空间曲线和第三空间曲线的步骤包括:In one of the embodiments, the step of constructing a plurality of second space curves and third space curves based on the coordinates and normal vector lines of each point of each of the first space curves corresponding to the plane triangle includes:

从所述平面三角形的两个边所对应的第一空间曲线各提取一个点作为线段端点,连接两个线段端点得到连接线段;Extract a point from the first space curve corresponding to the two sides of the plane triangle as a line segment endpoint, and connect the two line segment endpoints to obtain a connecting line segment;

基于所述连接线段以及所述连接线段的线段端点的坐标和法矢量,构建所述连接线段对应的第二空间曲线;constructing a second space curve corresponding to the connecting line segment based on the connecting line segment and the coordinates and normal vectors of the line segment endpoints of the connecting line segment;

从相邻的两个所述第二空间曲线各提取一个点作为线段端点,连接两个线段端点得到构造线段;A point is extracted from each of the two adjacent second space curves as a line segment endpoint, and the two line segment endpoints are connected to obtain a construction line segment;

基于所述构造线段以及所述构造线段的线段端点的坐标和法矢量,构建所述构造线段对应的第三空间曲线。Based on the construction line segment and the coordinates and normal vectors of the line segment endpoints of the construction line segment, a third space curve corresponding to the construction line segment is constructed.

在其中一个实施例中,所述利用反射定律计算所述射线在所述平面子三角形上的交点位置的反射光线的步骤包括:In one of the embodiments, the step of calculating the reflected ray at the intersection of the ray on the plane sub-triangle using the law of reflection includes:

计算所述射线与所述平面子三角形的交点位置的曲面法矢量;Calculate the surface normal vector of the intersection of the ray and the plane sub-triangle;

基于所述交点位置的曲面法矢量和所述射线,利用反射定律计算所述射线在所述平面子三角形上的交点位置的反射光线。Based on the surface normal vector at the intersection position and the ray, the reflection law is used to calculate the reflected ray at the intersection position of the ray on the plane sub-triangle.

一种曲表面反射线计算装置,包括:A curved surface reflection line calculation device, comprising:

平面三角形确定模块,用于确定平面三角形;The plane triangle determination module is used to determine the plane triangle;

第一空间曲线构建模块,用于构建所述平面三角形的各边对应的第一空间曲线;a first space curve building module, configured to build a first space curve corresponding to each side of the plane triangle;

第一坐标和法矢量获取模块,用于获取组成所述第一空间曲线的各点的坐标和法矢量;a first coordinate and normal vector acquisition module, used to acquire the coordinates and normal vectors of each point forming the first space curve;

第二空间曲线构建模块,用于基于所述平面三角形对应的各所述第一空间曲线的各点的坐标和法矢量线构建多个第二空间曲线和第三空间曲线,其中,各所述第二空间曲线的两端的端点位于相邻的两个所述第一空间曲线上,各所述第三空间曲线的两端的端点位于相邻的两个所述第二空间曲线上;The second space curve building module is configured to build a plurality of second space curves and third space curves based on the coordinates and normal vector lines of each point of each of the first space curves corresponding to the plane triangle, wherein each of the The end points of both ends of the second space curve are located on two adjacent first space curves, and the end points of both ends of each of the third space curves are located on two adjacent second space curves;

子三角形划分模块,用于基于各所述第二空间曲线和各所述第三空间曲线将所述平面三角形所在区域划分为多个平面子三角形;a sub-triangle dividing module, configured to divide the area where the plane triangle is located into a plurality of plane sub-triangles based on each of the second space curves and each of the third space curves;

射线获取模块,用于获取射线;A ray acquisition module for acquiring rays;

相交子三角形确定模块,用于确定与所述射线相交的平面子三角形;an intersecting sub-triangle determination module, configured to determine a plane sub-triangle intersecting with the ray;

反射光线计算模块,用于利用反射定律计算所述射线在所述平面子三角形上的交点位置的反射光线。The reflected ray calculation module is configured to use the reflection law to calculate the reflected ray at the intersection of the ray on the plane sub-triangle.

在其中一个实施例中,所述第一空间曲线构建模块包括:In one of the embodiments, the first space curve building module includes:

顶点法矢量计算单元,用于计算所述平面三角形的三个顶点的法矢量;a vertex normal vector calculation unit for calculating the normal vectors of the three vertices of the plane triangle;

第一空间曲线构建单元,用于根据所述平面三角形的边的顶点的坐标和法矢量,构建据所述平面三角形的边对应的第一空间曲线。A first space curve construction unit, configured to construct a first space curve corresponding to the sides of the plane triangle according to the coordinates and normal vectors of the vertices of the sides of the plane triangle.

一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时实现上述的曲表面反射线计算方法中任一实施例中的步骤。A computer device, comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, when the processor executes the computer program, the processor implements the steps in any of the above-mentioned methods for calculating curved surface reflection lines .

一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述的曲表面反射线计算方法中任一实施例的步骤。A computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, implements the steps of any one of the above-mentioned methods for calculating curved surface reflection lines.

上述曲表面反射线计算方法、装置、计算机设备和存储介质,利用平面三角形的顶点坐标及法矢量进行曲面重建并计算光线在曲表面反射光线的方法,使得构建的曲线更为平滑,使得计算得到的反射光线更为精确,用于由平面三角形构成的三维几何模型的曲面重建过程,以及后续的需要计算射线与曲面交点或反射光线的场景。The above-mentioned method, device, computer equipment and storage medium for calculating the reflection line of a curved surface use the vertex coordinates and normal vectors of a plane triangle to reconstruct the surface and calculate the light reflected on the curved surface, so that the constructed curve is smoother, so that the calculated The reflected rays are more accurate, and are used in the surface reconstruction process of 3D geometric models composed of flat triangles, and subsequent scenes that require calculation of the intersection of rays and surfaces or reflected rays.

附图说明Description of drawings

图1为一个实施例中曲表面反射线计算方法的流程示意图;1 is a schematic flowchart of a method for calculating a curved surface reflection line in one embodiment;

图2为一个实施例中曲表面反射线计算装置的结构框图;Fig. 2 is a structural block diagram of a curved surface reflection line computing device in one embodiment;

图3为一个实施例中计算机设备的内部结构图;Fig. 3 is the internal structure diagram of the computer device in one embodiment;

图4为一个实施例中的基于平面三角形的构建的空间曲面的过程示意图;4 is a schematic diagram of a process of constructing a space curved surface based on a plane triangle in one embodiment;

图5为一个实施例中的射线与空间曲线的交点及反射光线的示意图;5 is a schematic diagram of the intersection of a ray and a space curve and a reflected ray in one embodiment;

图6为一个实施例中的平面三角形一条边上的法矢量重建过程示意图;6 is a schematic diagram of a normal vector reconstruction process on one side of a planar triangle in one embodiment;

图7为一个实施例中的空间曲线预测示意图;7 is a schematic diagram of spatial curve prediction in one embodiment;

图8为一个实施例中的空间曲线误差修正过程示意图;8 is a schematic diagram of a spatial curve error correction process in one embodiment;

图9为一个实施例中的三角形内部的点的法矢量的示意图;9 is a schematic diagram of the normal vector of a point inside a triangle in one embodiment;

图10为另一个实施例中曲表面反射线计算方法的流程示意图;10 is a schematic flowchart of a method for calculating a curved surface reflection line in another embodiment;

图11为一个实施例中的共顶点平面三角形示意图。FIG. 11 is a schematic diagram of a common vertex planar triangle in one embodiment.

具体实施方式Detailed ways

为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application will be described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application.

实施例一Example 1

本实施例中,如图1所示,提供了一种曲表面反射线计算方法,其包括:In this embodiment, as shown in FIG. 1 , a method for calculating a curved surface reflection line is provided, which includes:

步骤110,确定平面三角形。Step 110, determine a plane triangle.

本实施例中,如图4中(a)所示,该平面三角形为基于二维空间确定的三角形,该平面三角形处于图4中X轴和Y轴所确定的平面。In this embodiment, as shown in FIG. 4( a ), the planar triangle is a triangle determined based on a two-dimensional space, and the planar triangle is located on a plane determined by the X axis and the Y axis in FIG. 4 .

步骤120,构建所述平面三角形的各边对应的第一空间曲线。Step 120, constructing a first space curve corresponding to each side of the plane triangle.

本实施例中,如图4中(a)和(b)所示,对平面三角形的各边分别构建曲线,每一曲线与三角形的一边对应,且每一曲线与三角形的一边处于同一平面。In this embodiment, as shown in (a) and (b) of FIG. 4 , curves are respectively constructed for each side of the plane triangle, each curve corresponds to one side of the triangle, and each curve and one side of the triangle are in the same plane.

步骤130,获取组成所述第一空间曲线的各点的坐标和法矢量。Step 130: Obtain the coordinates and normal vectors of each point forming the first space curve.

本实施例中,获取各第一空间曲线上的各点的坐标和法矢量。In this embodiment, the coordinates and normal vectors of each point on each first space curve are acquired.

步骤140,基于所述平面三角形对应的各所述第一空间曲线的各点的坐标和法矢量线构建多个第二空间曲线和第三空间曲线,其中,各所述第二空间曲线的两端的端点位于相邻的两个所述第一空间曲线上,各所述第三空间曲线的两端的端点位于相邻的两个所述第二空间曲线上。Step 140: Construct a plurality of second space curves and third space curves based on the coordinates and normal vector lines of each point of each of the first space curves corresponding to the plane triangle, wherein two of the second space curves are The end points of the ends are located on two adjacent first space curves, and the end points of both ends of each of the third space curves are located on two adjacent second space curves.

本实施例中,如图4中(c)所示,以平面三角形的相邻的两个边上的点作为第二空间曲线的两个端点,构建第二空间曲线;以相邻的两个第二空间曲线上的点作为第三空间曲线的两个端点,构建第三空间曲线。In this embodiment, as shown in (c) of FIG. 4 , the points on the two adjacent sides of the plane triangle are used as the two end points of the second space curve to construct the second space curve; The points on the second space curve serve as two endpoints of the third space curve, and the third space curve is constructed.

步骤150,基于各所述第二空间曲线和各所述第三空间曲线将所述平面三角形所在区域划分为多个平面子三角形。Step 150: Divide the area where the plane triangle is located into a plurality of plane sub-triangles based on each of the second space curves and each of the third space curves.

本实施例中,各所述第二空间曲线和各所述第三空间曲线在平面三角形上的投影相交,基于各所述第二空间曲线和各所述第三空间曲线将所述平面三角形对应的原始空间曲面划分为多个平面子三角形。In this embodiment, the projections of each of the second space curves and each of the third space curves on a plane triangle intersect, and the plane triangle is corresponding to each of the second space curves and each of the third space curves The original space surface of is divided into multiple planar sub-triangles.

本实施例中,各第二空间曲线和各第三空间曲线将平面三角形划分为多个子三角形,即平面子三角形,该平面子三角形也称为平面小三角形或者小三角形。应该理解的是,该第二空间曲线的两端分别位于平面三角形相邻的两个边上,因此,横跨不同的边的第二空间曲线相交,从而在平面三角形内划分为多个平面子三角形。In this embodiment, each second space curve and each third space curve divide the plane triangle into a plurality of sub-triangles, that is, plane sub-triangles, and the plane sub-triangles are also called plane small triangles or small triangles. It should be understood that the two ends of the second space curve are located on two adjacent sides of the plane triangle, respectively. Therefore, the second space curves spanning different sides intersect, so that the plane triangle is divided into a plurality of plane subsections. triangle.

应该理解的是,以半径为R的空间球面为例,在计算机中通常将球面剖分为大量的“平面三角形”来近似表示。这样,原来的光滑曲表面,被大量的“平面三角形”代替,造成了目标表面反射光线的不连续性。本申请中,基于其中任意一个“平面三角形”,试图将平面三角形对应的原始曲面(在本例中为球面)重建出来。具体地,基于第二空间曲线和第三空间曲线划分的平面子三角形集合,为平面三角形对应的原始曲面的一个近似表示,目的是为了提高射线与原始曲面交点的准确性,利用射线与平面子三角形的交点去逼近射线与原始曲面的交点。It should be understood that, taking a space sphere with a radius R as an example, the sphere is usually divided into a large number of "plane triangles" for approximate representation in a computer. In this way, the original smooth curved surface is replaced by a large number of "flat triangles", resulting in discontinuity of reflected light from the target surface. In this application, an attempt is made to reconstruct the original curved surface (in this case, a spherical surface) corresponding to the planar triangle based on any one of the "planar triangles". Specifically, the set of plane sub-triangles divided by the second space curve and the third space curve is an approximate representation of the original surface corresponding to the plane triangle. The purpose is to improve the accuracy of the intersection of the ray and the original surface. Triangle intersection to approximate the intersection of the ray with the original surface.

步骤160,获取射线。Step 160, acquiring rays.

本实施例中,射线为入射的光线,获取该射线的轨迹,获取射线的入射方向和位置。In this embodiment, the ray is an incident light ray, the trajectory of the ray is obtained, and the incident direction and position of the ray are obtained.

步骤170,确定与所述射线相交的平面子三角形。Step 170: Determine the plane sub-triangles intersecting the ray.

本实施例中,基于该射线的方向和位置,如图5中(a)和(b)所示,即可确定该射线所相交平面子三角形。In this embodiment, based on the direction and position of the ray, as shown in (a) and (b) in FIG. 5 , the plane sub-triangle intersected by the ray can be determined.

步骤180,利用反射定律计算所述射线在所述平面子三角形上的交点位置的反射光线。Step 180: Calculate the reflected ray at the intersection of the ray on the plane sub-triangle by using the law of reflection.

本实施例中,如图5中(c)所示,利用反射定律,计算该射线在所相交的平面子三角形上经过反射形成的反射光线的路径,计算得到该反射光线的反射方向和位置。In this embodiment, as shown in FIG. 5( c ), the reflection law is used to calculate the path of the reflected ray formed by the reflection of the ray on the intersecting plane sub-triangles, and the reflection direction and position of the reflected ray are calculated.

在一个实施例中,所述构建所述平面三角形的各边对应的第一空间曲线的步骤包括:计算所述平面三角形的三个顶点的法矢量;根据所述平面三角形的边的顶点的坐标和法矢量,构建据所述平面三角形的边对应的所述第一空间曲线。In one embodiment, the step of constructing the first space curve corresponding to each side of the plane triangle includes: calculating normal vectors of three vertices of the plane triangle; according to the coordinates of the vertices of the sides of the plane triangle and the normal vector to construct the first space curve corresponding to the sides of the plane triangle.

在一个实施例中,所述根据所述平面三角形的边的顶点的坐标和法矢量,构建据所述平面三角形的边对应的所述第一空间曲线的步骤包括:以所述平面三角形的边的顶点的坐标作为第一线段的两个端点,沿所述第一线段的一端至另一端进行法矢量插值,得到第一法矢量曲面;基于所述第一法矢量曲面,进行空间曲线预测,构建所述第一空间曲线。In one embodiment, the step of constructing the first space curve corresponding to the sides of the plane triangle according to the coordinates and normal vectors of the vertices of the sides of the plane triangle includes: using the sides of the plane triangle The coordinates of the vertex of the first line segment are taken as the two end points of the first line segment, and normal vector interpolation is performed along one end of the first line segment to the other end to obtain the first normal vector surface; based on the first normal vector surface, the space curve is performed. To predict, construct the first spatial curve.

如图6所示,Pa和Pb为线段的两个端点,本实施例中,Pa和Pb为作为平面三角形的一边的两个顶点,直线段PaPb的端点坐标Pa(xa,ya,za)、Pb(xb,yb,zb)及其法矢量fa(fxa,fya,fza)、fb(fxb,fyb,fzb),求解直线段PaPb张成的空间曲线的方法如下:As shown in FIG. 6 , P a and P b are the two endpoints of the line segment. In this embodiment, P a and P b are two vertices that are one side of a plane triangle, and the endpoint coordinates P a of the straight line segment P a P b (x a , y a , z a ), P b (x b , y b , z b ) and their normal vectors f a (fx a , fy a , fz a ), f b (fx b , fy b , fz b ), the method of solving the space curve formed by the straight line segment P a P b is as follows:

首先,沿直线段PaPb进行法矢量插值First, interpolate the normal vector along the straight line segment P a P b

如图6所示,在直线段PaPb上取一系列离散点P1、P2、…Pk、…,利用线性插值方法计算各离散点处的法矢量。以Pk(xk,yk,zk)为例,其法矢量fk(fxk,fyk,fzk)中的fxk可表示为:As shown in Fig. 6, a series of discrete points P 1 , P 2 , ... P k , ... are taken on the straight line segment P a P b , and the normal vector at each discrete point is calculated by using the linear interpolation method. Taking P k (x k , y k , z k ) as an example, f xk in its normal vector f k (f xk , f yk , f zk ) can be expressed as:

Figure BDA0003520016480000061
Figure BDA0003520016480000061

其余坐标fyk、fzk可用类似的方法求出。值得注意的是,一般情况下,由于线段两端的法矢量fa、fb通常不共面,因此本步骤中得到的一系列法矢量也不共面。如果线段PaPb上的离散点取得足够密,则在离散点上的法矢量将形成一个从fa过渡到fb的法矢量曲面。接下来将在该曲面上重建从Pa到Pb的空间曲线。The remaining coordinates f yk and f zk can be obtained by a similar method. It is worth noting that, in general, since the normal vectors f a and f b at both ends of the line segment are usually not coplanar, a series of normal vectors obtained in this step are also not coplanar. If the discrete points on the line segment P a P b are sufficiently dense, the normal vectors on the discrete points will form a normal vector surface that transitions from f a to f b . Next, the spatial curve from P a to P b will be reconstructed on this surface.

随后,空间曲线预测:Subsequently, the spatial curve predicts:

如图7所示,由于点Pa、Pb是原始平面三角形的两个顶点,故最终重建的空间曲面必过点Pa、Pb,故存在过点Pa、以fa为法矢量的切平面,该切平面可作为Pa邻域内重建曲面的线性近似。以P1为出发点、f1为方向矢量的射线(P1,f1)交切平面于点Q1,Q1实际上是射线(P1,f1)与重建曲面交点的一种估计,并与真实交点存在着一定误差。用同样的方法,在Q1点以f1为法矢量做切平面,可求出其与射线(P2,f2)的交点Q2,进而依次求出Q3,…,直到QbAs shown in Figure 7, since the points P a and P b are the two vertices of the original plane triangle, the final reconstructed space surface must pass through the points P a and P b , so there is a passing point P a and f a is the normal vector , which can be used as a linear approximation of the reconstructed surface in the neighborhood of Pa. The ray (P 1 , f 1 ) with P 1 as the starting point and f 1 as the direction vector intersects the plane at point Q 1 . Q 1 is actually an estimate of the intersection of the ray (P 1 , f 1 ) and the reconstructed surface, And there is a certain error with the real intersection. Using the same method, take f 1 as the normal vector as the tangent plane at point Q 1 , and then find the intersection point Q 2 with the ray (P 2 , f 2 ), and then find out Q 3 , . . . , until Q b .

理论上,Pb应该与Qb重合,因此需要对该误差进行修正。因此,在一个实施例中,所述基于所述第一法矢量曲面,进行空间曲线预测,构建所述第一空间曲线的步骤之后还包括:对构建的所述第一空间曲线进行误差修正。In theory, P b should coincide with Q b , so this error needs to be corrected. Therefore, in an embodiment, the step of performing spatial curve prediction based on the first normal vector surface, and constructing the first spatial curve further includes: performing error correction on the constructed first spatial curve.

最后,误差修正:Finally, error correction:

如图8所示,估计值Qb与真值Pb之间的距离误差为eb=|Qb-Pb|。由于误差是累积的,因此需要对前面各个估计值进行修正。以Qk为例,其距离误差ek可近似表示为:As shown in FIG. 8 , the distance error between the estimated value Q b and the true value P b is e b =|Q b −P b |. Since the errors are cumulative, corrections to the previous estimates are required. Taking Q k as an example, its distance error e k can be approximately expressed as:

Figure BDA0003520016480000071
Figure BDA0003520016480000071

则Qk经过修正后的坐标为:Then the corrected coordinates of Q k are:

Figure BDA0003520016480000072
Figure BDA0003520016480000072

采用这种方法全部的估计点进行修正,可得到由一条线段PaPb生成的空间曲线。因此,最终重建的曲面过点Qk’,该点的法矢量可用fk近似表示。Using this method to correct all the estimated points, a space curve generated by a line segment P a P b can be obtained. Therefore, the final reconstructed surface passes through the point Q k ', and the normal vector of this point can be approximated by f k .

在一个实施例中,所述基于所述平面三角形对应的各所述第一空间曲线的各点的坐标和法矢量线构建多个第二空间曲线和第三空间曲线的步骤包括:从所述平面三角形的两个边所对应的第一空间曲线各提取一个点作为线段端点,连接两个线段端点得到连接线段;基于所述连接线段以及所述连接线段的线段端点的坐标和法矢量,构建所述连接线段对应的第二空间曲线;从相邻的两个所述第二空间曲线各提取一个点作为线段端点,连接两个线段端点得到构造线段;基于所述构造线段以及所述构造线段的线段端点的坐标和法矢量,构建所述构造线段对应的第三空间曲线。In one embodiment, the step of constructing a plurality of second space curves and third space curves based on the coordinates and normal vector lines of each point of each of the first space curves corresponding to the plane triangle includes: from the Each of the first space curves corresponding to the two sides of the plane triangle extracts a point as a line segment endpoint, and connects the two line segment endpoints to obtain a connecting line segment; The second space curve corresponding to the connecting line segment; extracting a point from each of the two adjacent second space curves as a line segment endpoint, and connecting the two line segment endpoints to obtain a construction line segment; based on the construction line segment and the construction line segment The coordinates and normal vector of the end point of the line segment, and the third space curve corresponding to the construction line segment is constructed.

本实施例中,基于这些连接线段构建的第二空间曲线在视觉上近似平行。In this embodiment, the second space curve constructed based on these connecting line segments is approximately parallel visually.

本实施例中,首先从平面三角形的两个边所对应的第一空间曲线中提取一个点作为线段端点,连接两个线段端点,即可获得连接线段,基于该连接线段构建对应的第二空间曲线。In this embodiment, a point is first extracted from the first space curve corresponding to the two sides of the plane triangle as a line segment endpoint, and the two line segment endpoints are connected to obtain a connecting line segment, and a corresponding second space is constructed based on the connecting line segment. curve.

具体地,对平面三角形的两条边进行曲线重建,然后,在两条重建曲线上各取一点连接成线段,由于该线段的端点坐标和曲面法矢量已经求出,因此可使用上述实施例的方法,基于线段端点坐标和法矢量生成一条空间曲线,如图4(b)所示。随后,在生成的空间曲线上继续取点、连线并生成空间曲线,最终生成满足要求的曲线网络,完成曲面重建,如图4(c)所示。Specifically, curve reconstruction is performed on the two sides of the plane triangle, and then a point is taken on each of the two reconstructed curves to form a line segment. Since the endpoint coordinates of the line segment and the surface normal vector have been obtained, the method of the above embodiment can be used method, a space curve is generated based on the coordinates of the endpoints of the line segment and the normal vector, as shown in Figure 4(b). Then, continue to take points and connect lines on the generated space curve to generate the space curve, finally generate a curve network that meets the requirements, and complete the surface reconstruction, as shown in Figure 4(c).

此外,采用与构造第二空间曲线同样的方法,如图4C所示,从相邻的两个所述第二空间曲线各提取一个点作为线段端点,连接两个线段端点得到构造线段;基于所述构造线段以及所述构造线段的线段端点的坐标和法矢量,构建所述构造线段对应的第三空间曲线。In addition, adopt the same method as constructing the second space curve, as shown in FIG. 4C, extract a point from each of the two adjacent second space curves as the line segment endpoint, and connect the two line segment endpoints to obtain the constructed line segment; The construction line segment and the coordinates and normal vectors of the line segment endpoints of the construction line segment are used to construct a third space curve corresponding to the construction line segment.

在一个实施例中,所述利用反射定律计算所述射线在所述平面子三角形上的交点位置的反射光线的步骤包括:计算所述射线与所述平面子三角形的交点位置的曲面法矢量;基于所述交点位置的曲面法矢量和所述射线,利用反射定律计算所述射线在所述平面子三角形上的交点位置的反射光线。In one embodiment, the step of calculating the reflected ray at the intersection of the ray on the plane sub-triangle using the law of reflection includes: calculating a surface normal vector at the intersection of the ray and the plane sub-triangle; Based on the surface normal vector at the intersection position and the ray, the reflection law is used to calculate the reflected ray at the intersection position of the ray on the plane sub-triangle.

本实施例中,计算射线与小三角形面元集的相交情况,求解交点处的曲面法矢量。In this embodiment, the intersection of the ray and the small triangular surfel set is calculated, and the surface normal vector at the intersection is solved.

如果射线不与集合中的任何一个小三角形相交,则射线不与该重建曲面相交;反之,找到与射线相交的小三角形,计算射线与小三角形的交点坐标,并将该交点作为射线与重建曲面的交点,如图5(a)所示。If the ray does not intersect any small triangle in the set, the ray does not intersect the reconstructed surface; otherwise, find the small triangle that intersects the ray, calculate the coordinates of the intersection of the ray and the small triangle, and use the intersection as the ray and the reconstructed surface , as shown in Figure 5(a).

如图9所示,假定射线与平面子三角形ABC相交,交点为P。提取该平面子三角形ABC的顶点坐标和法矢量,如图9所示,fa、fb、fc分别为顶点A、B、C处的曲面法矢量。过点P做平行于AB的直线交于BC,交点占BC的比例系数为β(0≤β≤1);同时,过点P做平行于BC的直线交于AB,交点占AB的比例为γ(0≤γ≤1),则点P处的曲面法矢量可近似表示为:As shown in Figure 9, it is assumed that the ray intersects the plane sub-triangle ABC, and the intersection point is P. The vertex coordinates and normal vectors of the plane sub-triangle ABC are extracted, as shown in FIG. 9 , f a , f b , and f c are the surface normal vectors at vertices A, B, and C, respectively. A line parallel to AB is drawn through the point P and intersected with BC, and the proportional coefficient of the intersection to BC is β (0≤β≤1); at the same time, a straight line parallel to BC is made to intersect AB through the point P, and the proportion of the intersection to AB is γ (0≤γ≤1), the surface normal vector at point P can be approximately expressed as:

fp=(1-β-γ)fb+βfc+γfa f p =(1-β-γ)f b +βf c +γf a

最后,已知交点处的曲面法矢量和入射线,根据反射定律可求解反射线,作为射线与重建曲面的反射线。Finally, the surface normal vector and the incident ray at the intersection point are known, and the reflection line can be solved according to the reflection law as the reflection line of the ray and the reconstructed surface.

应该理解的是,虽然图1的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图1中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the various steps in the flowchart of FIG. 1 are shown in sequence according to the arrows, these steps are not necessarily executed in the sequence shown by the arrows. Unless explicitly stated herein, the execution of these steps is not strictly limited to the order, and these steps may be performed in other orders. Moreover, at least a part of the steps in FIG. 1 may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed and completed at the same time, but may be executed at different times. The execution of these sub-steps or stages The sequence is also not necessarily sequential, but may be performed alternately or alternately with other steps or sub-steps of other steps or at least a portion of a phase.

实施例二Embodiment 2

本实施例中,提供了一种基于平面三角形及其顶点法矢量的曲面重建方法,在实现曲面重建的同时,还能保证相邻平面三角形各自重建曲面之间的严格连续与基本光滑。如图10所示,该方法首先计算(或提取)三角形3个顶的点法矢量,并利用这些信息对三角形的某条边进行曲线重建,如图4(a)所示;然后在重建的两条曲线上各取一点,连接成线段,并对该线段进行曲线重建,如图4(b)所示;最后,用类似的方法在前述重建曲线上取点并连接线段,重建线段对应的曲线,直到形成满足用户需求的曲线网络,如图4(c)所示。In this embodiment, a surface reconstruction method based on a plane triangle and its vertex normal vector is provided, which can ensure the strict continuity and basic smoothness between the reconstructed surfaces of adjacent plane triangles while realizing the reconstruction of the curved surface. As shown in Figure 10, the method first calculates (or extracts) the point normal vectors of the three vertices of the triangle, and uses this information to reconstruct the curve of an edge of the triangle, as shown in Figure 4(a); Take a point on each of the two curves, connect them into a line segment, and reconstruct the line segment, as shown in Figure 4(b). curve until a curve network that meets the user's needs is formed, as shown in Figure 4(c).

射线与曲面的交点及反射线的求解过程:在基于上述方法获取的曲线网络的基础上,首先获取平面小三角形集合,并计算射线与集合的相交情况。如果相交,求出交点所在的小三角形及交点位置,如图5(a)所示;然后,利用小三角形顶点的法矢量重建交点位置的法矢量,如图5(b)所示;最后,利用反射定律计算射线在交点位置的反射光线,如图5c)所示。The solution process of the intersection of the ray and the surface and the reflection line: On the basis of the curve network obtained by the above method, firstly obtain the set of small plane triangles, and calculate the intersection of the ray and the set. If it intersects, find the small triangle where the intersection is located and the position of the intersection, as shown in Figure 5(a); then, use the normal vector of the vertex of the small triangle to reconstruct the normal vector of the intersection position, as shown in Figure 5(b); finally, Use the law of reflection to calculate the reflected rays at the intersection of the rays, as shown in Figure 5c).

下面结合附图,介绍顶点法矢量插值,曲线、曲面重建及射线与曲面交点的计算过程。The following describes the calculation process of vertex normal vector interpolation, curve and surface reconstruction, and intersection of rays and surfaces with reference to the accompanying drawings.

(1)获取/计算三角形顶点的法矢量(1) Get/calculate the normal vector of the triangle vertex

如果能够获得三角形顶点法矢量的真值,可直接使用该数据;否则,需要利用共顶点平面三角形的相关信息计算该顶点的法矢量,作为其真值的一个估计,如图11所示。这类方法在现有文献中有很多,可灵活选择。If the true value of the normal vector of the vertex of the triangle can be obtained, the data can be used directly; otherwise, the normal vector of the vertex needs to be calculated using the relevant information of the common vertex plane triangle as an estimate of its true value, as shown in Figure 11. There are many such methods in the existing literature, which can be flexibly selected.

(2)基于线段顶点和法矢量信息重建空间曲线(2) Reconstructing space curve based on line segment vertex and normal vector information

已知直线段PaPb的端点坐标Pa(xa,ya,za)、Pb(xb,yb,zb)及其法矢量fa(fxa,fya,fza)、fb(fxb,fyb,fzb),求解直线段PaPb张成的空间曲线的方法如下如示。Known the coordinates of the end points of the straight line segment P a P b P a (x a , y a , z a ), P b (x b , y b , z b ) and their normal vectors f a (f xa , f ya , f za ), f b (f xb , f yb , f zb ), the method for solving the space curve formed by the straight line segment P a P b is as follows.

①沿直线段PaPb进行法矢量插值① Interpolate the normal vector along the straight line segment P a P b

如图6所示,在直线段PaPb上取一系列离散点P1、P2、…Pk、…,利用线性插值方法计算各离散点处的法矢量。以Pk(xk,yk,zk)为例,其法矢量fk(fxk,fyk,fzk)中的fxk可表示为:As shown in Fig. 6, a series of discrete points P 1 , P 2 , ... P k , ... are taken on the straight line segment P a P b , and the normal vector at each discrete point is calculated by using the linear interpolation method. Taking P k (x k , y k , z k ) as an example, f xk in its normal vector f k (f xk , f yk , f zk ) can be expressed as:

Figure BDA0003520016480000101
Figure BDA0003520016480000101

其余坐标fyk、fzk可用类似的方法求出。值得注意的是,一般情况下,由于线段两端的法矢量fa、fb通常不共面,因此步骤①得到的一系列法矢量也不共面。如果线段PaPb上的离散点取得足够密,则在离散点上的法矢量将形成一个从fa过渡到fb的法矢量曲面。接下来将在该曲面上重建从Pa到Pb的空间曲线。The remaining coordinates f yk and f zk can be obtained by a similar method. It is worth noting that in general, since the normal vectors f a and f b at both ends of the line segment are usually not coplanar, the series of normal vectors obtained in step ① are also not coplanar. If the discrete points on the line segment P a P b are sufficiently dense, the normal vectors on the discrete points will form a normal vector surface that transitions from f a to f b . Next, the spatial curve from P a to P b will be reconstructed on this surface.

②空间曲线预测②Space curve prediction

如图7所示,由于点Pa、Pb是原始平面三角形的两个顶点,故最终重建的空间曲面必过点Pa、Pb,故存在过点Pa、以fa为法矢量的切平面,该切平面可作为Pa邻域内重建曲面的线性近似。以P1为出发点、f1为方向矢量的射线(P1,f1)交切平面于点Q1,Q1实际上是射线(P1,f1)与重建曲面交点的一种估计,并与真实交点存在着一定误差。用同样的方法,在Q1点以f1为法矢量做切平面,可求出其与射线(P2,f2)的交点Q2,进而依次求出Q3,…,直到Qb。理论上,Pb应该与Qb重合,因此需要对该误差进行修正。As shown in Figure 7, since the points P a and P b are the two vertices of the original plane triangle, the final reconstructed space surface must pass through the points P a and P b , so there is a passing point P a and f a is the normal vector , which can be used as a linear approximation of the reconstructed surface in the neighborhood of Pa. The ray (P 1 , f 1 ) with P 1 as the starting point and f 1 as the direction vector intersects the plane at point Q 1 . Q 1 is actually an estimate of the intersection of the ray (P 1 , f 1 ) and the reconstructed surface, And there is a certain error with the real intersection. Using the same method, take f 1 as the normal vector as the tangent plane at point Q 1 , and then find the intersection point Q 2 with the ray (P 2 , f 2 ), and then find out Q 3 , . . . , until Q b . In theory, P b should coincide with Q b , so this error needs to be corrected.

③误差修正③Error correction

如图8所示,估计值Qb与真值Pb之间的距离误差为eb=|Qb-Pb|。由于误差是累积的,因此需要对前面各个估计值进行修正。以Qk为例,其距离误差ek可近似表示为:As shown in FIG. 8 , the distance error between the estimated value Q b and the true value P b is e b =|Q b −P b |. Since the errors are cumulative, corrections to the previous estimates are required. Taking Q k as an example, its distance error e k can be approximately expressed as:

Figure BDA0003520016480000102
Figure BDA0003520016480000102

则Qk经过修正后的坐标为:Then the corrected coordinates of Q k are:

Qk'=Qk-ekfk Q k '=Q k -e k f k

采用这种方法全部的估计点进行修正,可得到由一条线段PaPb生成的空间曲线。可以认为,最终重建的曲面过点Qk’,该点的法矢量可用fk近似表示。Using this method to correct all the estimated points, a space curve generated by a line segment P a P b can be obtained. It can be considered that the final reconstructed surface passes through the point Q k ', and the normal vector of this point can be approximated by f k .

(3)在相邻空间曲线上连接线段并重建曲线(3) Connect line segments on adjacent spatial curves and reconstruct the curve

使用步骤(2)的方法,对原始平面三角形的两条边进行曲线重建。然后,在两条重建曲线上各取一点连接成线段。由于该线段的端点坐标和曲面法矢量已经求出,因此可使用步骤(2)的方法生成一条空间曲线,如图4(b)所示。Using the method of step (2), curve reconstruction is performed on the two sides of the original plane triangle. Then, take a point on each of the two reconstructed curves and connect them into line segments. Since the endpoint coordinates of the line segment and the surface normal vector have been obtained, the method of step (2) can be used to generate a space curve, as shown in Figure 4(b).

(4)根据用户的实际需要,在生成的空间曲线上继续取点、连线并生成空间曲线,最终生成满足要求的曲线网络,完成曲面重建,如图4(c)所示。(4) According to the actual needs of the user, continue to take points and connect lines on the generated space curve to generate the space curve, and finally generate a curve network that meets the requirements, and complete the surface reconstruction, as shown in Figure 4(c).

射线与曲面的交点及反射线的求解方法How to solve the intersection of ray and surface and reflection line

(1)在图4(c)所示的曲线网络的基础上,构建平面小三角形面元集,如图5(a)所示。(1) On the basis of the curve network shown in Fig. 4(c), a small triangular surface element set is constructed, as shown in Fig. 5(a).

(2)计算射线与小三角形面元集的相交情况,求解交点处的曲面法矢量(2) Calculate the intersection of the ray and the small triangular surface element set, and solve the surface normal vector at the intersection point

如果射线不与集合中的任何一个小三角形相交,则射线不与该重建曲面相交;反之,找到与射线相交的小三角形,计算射线与小三角形的交点坐标,并将该交点作为射线与重建曲面的交点,如图5(a)所示。If the ray does not intersect any small triangle in the set, the ray does not intersect the reconstructed surface; otherwise, find the small triangle that intersects the ray, calculate the coordinates of the intersection of the ray and the small triangle, and use the intersection as the ray and the reconstructed surface , as shown in Figure 5(a).

假定射线与小三角形ABC相交,交点为P。提取该小三角形的顶点坐标和法矢量,如图9所示,fa、fb、fc分别为顶点A、B、C处的曲面法矢量。过点P做平行于AB的直线交于BC,交点占BC的比例系数为β(0≤β≤1);同时,过点P做平行于BC的直线交于AB,交点占AB的比例为γ(0≤γ≤1),则点P处的曲面法矢量可近似表示为:Suppose that the ray intersects the small triangle ABC at P. The vertex coordinates and normal vector of the small triangle are extracted, as shown in FIG. 9 , f a , f b , and f c are the surface normal vectors at vertices A, B, and C, respectively. A line parallel to AB is drawn through the point P and intersected with BC, and the proportional coefficient of the intersection to BC is β (0≤β≤1); at the same time, a straight line parallel to BC is made to intersect AB through the point P, and the proportion of the intersection to AB is γ (0≤γ≤1), the surface normal vector at point P can be approximately expressed as:

fp=(1-β-γ)fb+βfc+γfa f p =(1-β-γ)f b +βf c +γf a

(3)已知交点处的曲面法矢量和入射线,根据反射定律可求解反射线,作为射线与重建曲面的反射线。(3) The surface normal vector and the incident ray at the intersection point are known, and the reflection line can be solved according to the law of reflection as the reflection line between the ray and the reconstructed surface.

实施例三Embodiment 3

本实施例中,如图2所示,提供一种曲表面反射线计算装置,包括:In this embodiment, as shown in FIG. 2, a curved surface reflection line calculation device is provided, including:

平面三角形确定模块210,用于确定平面三角形;a plane triangle determination module 210, configured to determine a plane triangle;

第一空间曲线构建模块220,用于构建所述平面三角形的各边对应的第一空间曲线;a first space curve construction module 220, configured to construct a first space curve corresponding to each side of the plane triangle;

第一坐标和法矢量获取模块230,用于获取组成所述第一空间曲线的各点的坐标和法矢量;a first coordinate and normal vector acquisition module 230, configured to acquire the coordinates and normal vectors of each point forming the first space curve;

第二空间曲线构建模块240,用于基于所述平面三角形对应的各所述第一空间曲线的各点的坐标和法矢量线构建多个第二空间曲线和第三空间曲线,其中,各所述第二空间曲线的两端的端点位于相邻的两个所述第一空间曲线上,各所述第三空间曲线的两端的端点位于相邻的两个所述第二空间曲线上;The second space curve building module 240 is configured to build a plurality of second space curves and third space curves based on the coordinates and normal vector lines of each point of each of the first space curves corresponding to the plane triangle, wherein each of the The endpoints of both ends of the second space curve are located on two adjacent first space curves, and the endpoints of both ends of each of the third space curves are located on two adjacent second space curves;

子三角形划分模块250,用于基于各所述第二空间曲线和各所述第三空间曲线将所述平面三角形所在区域划分为多个平面子三角形;a sub-triangle dividing module 250, configured to divide the area where the plane triangle is located into a plurality of plane sub-triangles based on each of the second space curves and each of the third space curves;

射线获取模块260,用于获取射线;a ray acquisition module 260, configured to acquire rays;

相交子三角形确定模块270,用于确定与所述射线相交的平面子三角形;an intersecting sub-triangle determining module 270, configured to determine a plane sub-triangle intersecting with the ray;

反射光线计算模块280,用于利用反射定律计算所述射线在所述平面子三角形上的交点位置的反射光线。The reflected ray calculation module 280 is configured to use the reflection law to calculate the reflected ray at the intersection of the ray on the plane sub-triangle.

在一个实施例中,所述第一空间曲线构建模块包括:In one embodiment, the first space curve building module includes:

顶点法矢量计算单元,用于计算所述平面三角形的三个顶点的法矢量;a vertex normal vector calculation unit for calculating the normal vectors of the three vertices of the plane triangle;

第一空间曲线构建单元,用于根据所述平面三角形的边的顶点的坐标和法矢量,构建据所述平面三角形的边对应的第一空间曲线。A first space curve construction unit, configured to construct a first space curve corresponding to the sides of the plane triangle according to the coordinates and normal vectors of the vertices of the sides of the plane triangle.

关于曲表面反射线计算装置的具体限定可以参见上文中对于曲表面反射线计算方法的限定,在此不再赘述。上述曲表面反射线计算装置中的各个单元可全部或部分通过软件、硬件及其组合来实现。上述各单元可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个单元对应的操作。For the specific limitation of the device for calculating the reflection line on the curved surface, please refer to the limitation on the method for calculating the reflection line on the curved surface above, which will not be repeated here. Each unit in the above-mentioned curved surface reflection line computing device may be implemented in whole or in part by software, hardware, and combinations thereof. The above units may be embedded in or independent of the processor in the computer device in the form of hardware, or may be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above units.

实施例四Embodiment 4

本实施例中,提供了计算机设备。其内部结构图可以如图3所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口、显示屏和输入装置。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统和计算机程序,且该非易失性存储介质部署有数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的网络接口用于与部署了应用软件的其他计算机设备通信。该计算机程序被处理器执行时以实现一种曲表面反射线计算方法。该计算机设备的显示屏可以是液晶显示屏或者电子墨水显示屏,该计算机设备的输入装置可以是显示屏上覆盖的触摸层,也可以是计算机设备外壳上设置的按键、轨迹球或触控板,还可以是外接的键盘、触控板或鼠标等。In this embodiment, a computer device is provided. Its internal structure diagram can be shown in Figure 3. The computer equipment includes a processor, memory, a network interface, a display screen, and an input device connected by a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium, an internal memory. The non-volatile storage medium stores an operating system and a computer program, and the non-volatile storage medium deploys a database. The internal memory provides an environment for the execution of the operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used to communicate with other computer devices on which application software is deployed. The computer program, when executed by the processor, implements a curved surface reflection line calculation method. The display screen of the computer equipment may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment may be a touch layer covered on the display screen, or a button, a trackball or a touchpad set on the shell of the computer equipment , or an external keyboard, trackpad, or mouse.

本领域技术人员可以理解,图3中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the structure shown in FIG. 3 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer equipment to which the solution of the present application is applied. Include more or fewer components than shown in the figures, or combine certain components, or have a different arrangement of components.

在一个实施例中,提供了一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时实现上述的曲表面反射线计算方法中任一实施例中的步骤。In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and it is characterized in that, when the processor executes the computer program, the above-mentioned method for calculating curved surface reflection lines is implemented the steps in any one of the examples.

实施例五Embodiment 5

本实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述的曲表面反射线计算方法中任一实施例的步骤。In this embodiment, a computer-readable storage medium is provided, and a computer program is stored thereon, and when the computer program is executed by a processor, the steps of any one of the foregoing methods for calculating curved surface reflection lines are implemented.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage In the medium, when the computer program is executed, it may include the processes of the above-mentioned method embodiments. Wherein, any reference to memory, storage, database or other medium used in the various embodiments provided in this application may include non-volatile and/or volatile memory. Nonvolatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Road (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined arbitrarily. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features It is considered to be the range described in this specification.

以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only represent several embodiments of the present application, and the descriptions thereof are specific and detailed, but should not be construed as a limitation on the scope of the invention patent. It should be pointed out that for those skilled in the art, without departing from the concept of the present application, several modifications and improvements can be made, which all belong to the protection scope of the present application. Therefore, the scope of protection of the patent of the present application shall be subject to the appended claims.

Claims (10)

1.一种曲表面反射线计算方法,其特征在于,包括:1. a curved surface reflection line calculation method, is characterized in that, comprises: 确定平面三角形;Determine the plane triangle; 构建所述平面三角形的各边对应的第一空间曲线;constructing a first space curve corresponding to each side of the plane triangle; 获取组成所述第一空间曲线的各点的坐标和法矢量;obtaining the coordinates and normal vectors of each point forming the first space curve; 基于所述平面三角形对应的各所述第一空间曲线的各点的坐标和法矢量线构建多个第二空间曲线和第三空间曲线,其中,各所述第二空间曲线的两端的端点位于相邻的两个所述第一空间曲线上,各所述第三空间曲线的两端的端点位于相邻的两个所述第二空间曲线上;A plurality of second space curves and third space curves are constructed based on the coordinates and normal vector lines of each point of each of the first space curves corresponding to the plane triangle, wherein the endpoints of both ends of each of the second space curves are located at On the two adjacent first space curves, the endpoints of both ends of each of the third space curves are located on the two adjacent second space curves; 基于各所述第二空间曲线和各所述第三空间曲线将所述平面三角形所在区域划分为多个平面子三角形;dividing the area where the plane triangle is located into a plurality of plane sub-triangles based on each of the second space curves and each of the third space curves; 获取射线;get rays; 确定与所述射线相交的平面子三角形;determining the planar sub-triangle intersecting the ray; 利用反射定律计算所述射线在所述平面子三角形上的交点位置的反射光线。The reflected ray at the intersection of the ray on the plane sub-triangle is calculated using the law of reflection. 2.根据权利要求1所述的方法,其特征在于,所述构建所述平面三角形的各边对应的第一空间曲线的步骤包括:2. The method according to claim 1, wherein the step of constructing the first space curve corresponding to each side of the plane triangle comprises: 计算所述平面三角形的三个顶点的法矢量;Calculate the normal vectors of the three vertices of the planar triangle; 根据所述平面三角形的边的顶点的坐标和法矢量,构建据所述平面三角形的边对应的所述第一空间曲线。The first space curve corresponding to the sides of the plane triangle is constructed according to the coordinates and normal vectors of the vertices of the sides of the plane triangle. 3.根据权利要求2所述的方法,其特征在于,所述根据所述平面三角形的边的顶点的坐标和法矢量,构建据所述平面三角形的边对应的所述第一空间曲线的步骤包括:3. The method according to claim 2, wherein the step of constructing the first space curve corresponding to the sides of the plane triangle according to the coordinates and normal vectors of the vertices of the sides of the plane triangle include: 以所述平面三角形的边的顶点的坐标作为第一线段的两个端点,沿所述第一线段的一端至另一端进行法矢量插值,得到第一法矢量曲面;Taking the coordinates of the vertices of the sides of the plane triangle as the two endpoints of the first line segment, performing normal vector interpolation along one end of the first line segment to the other end to obtain a first normal vector surface; 基于所述第一法矢量曲面,进行空间曲线预测,构建所述第一空间曲线。Based on the first normal vector surface, a space curve prediction is performed to construct the first space curve. 4.根据权利要求3所述的方法,其特征在于,所述基于所述第一法矢量曲面,进行空间曲线预测,构建所述第一空间曲线的步骤之后还包括:4. The method according to claim 3, wherein the step of performing spatial curve prediction based on the first normal vector surface, and constructing the first spatial curve further comprises: 对构建的所述第一空间曲线进行误差修正。Error correction is performed on the constructed first space curve. 5.根据权利要求1所述的方法,其特征在于,所述基于所述平面三角形对应的各所述第一空间曲线的各点的坐标和法矢量线构建多个第二空间曲线和第三空间曲线的步骤包括:5 . The method according to claim 1 , wherein the construction of a plurality of second space curves and third The steps for a space curve include: 从所述平面三角形的两个边所对应的第一空间曲线各提取一个点作为线段端点,连接两个线段端点得到连接线段;Extract a point from the first space curve corresponding to the two sides of the plane triangle as a line segment endpoint, and connect the two line segment endpoints to obtain a connecting line segment; 基于所述连接线段以及所述连接线段的线段端点的坐标和法矢量,构建所述连接线段对应的第二空间曲线;constructing a second space curve corresponding to the connecting line segment based on the connecting line segment and the coordinates and normal vectors of the line segment endpoints of the connecting line segment; 从相邻的两个所述第二空间曲线各提取一个点作为线段端点,连接两个线段端点得到构造线段;A point is extracted from each of the two adjacent second space curves as a line segment endpoint, and the two line segment endpoints are connected to obtain a construction line segment; 基于所述构造线段以及所述构造线段的线段端点的坐标和法矢量,构建所述构造线段对应的第三空间曲线。Based on the construction line segment and the coordinates and normal vectors of the line segment endpoints of the construction line segment, a third space curve corresponding to the construction line segment is constructed. 6.根据权利要求1-5任一项中所述的方法,其特征在于,所述利用反射定律计算所述射线在所述平面子三角形上的交点位置的反射光线的步骤包括:6. The method according to any one of claims 1-5, wherein the step of calculating the reflected ray at the intersection of the ray on the plane sub-triangle using the law of reflection comprises: 计算所述射线与所述平面子三角形的交点位置的曲面法矢量;Calculate the surface normal vector of the intersection of the ray and the plane sub-triangle; 基于所述交点位置的曲面法矢量和所述射线,利用反射定律计算所述射线在所述平面子三角形上的交点位置的反射光线。Based on the surface normal vector at the intersection position and the ray, the reflection law is used to calculate the reflected ray at the intersection position of the ray on the plane sub-triangle. 7.一种曲表面反射线计算装置,其特征在于,包括:7. A curved surface reflection line computing device, characterized in that, comprising: 平面三角形确定模块,用于确定平面三角形;The plane triangle determination module is used to determine the plane triangle; 第一空间曲线构建模块,用于构建所述平面三角形的各边对应的第一空间曲线;a first space curve building module, configured to build a first space curve corresponding to each side of the plane triangle; 第一坐标和法矢量获取模块,用于获取组成所述第一空间曲线的各点的坐标和法矢量;a first coordinate and normal vector acquisition module, used to acquire the coordinates and normal vectors of each point forming the first space curve; 第二空间曲线构建模块,用于基于所述平面三角形对应的各所述第一空间曲线的各点的坐标和法矢量线构建多个第二空间曲线和第三空间曲线,其中,各所述第二空间曲线的两端的端点位于相邻的两个所述第一空间曲线上,各所述第三空间曲线的两端的端点位于相邻的两个所述第二空间曲线上;The second space curve building module is configured to build a plurality of second space curves and third space curves based on the coordinates and normal vector lines of each point of each of the first space curves corresponding to the plane triangle, wherein each of the The end points of both ends of the second space curve are located on two adjacent first space curves, and the end points of both ends of each of the third space curves are located on two adjacent second space curves; 子三角形划分模块,用于基于各所述第二空间曲线和各所述第三空间曲线将所述平面三角形所在区域划分为多个平面子三角形;a sub-triangle dividing module, configured to divide the area where the plane triangle is located into a plurality of plane sub-triangles based on each of the second space curves and each of the third space curves; 射线获取模块,用于获取射线;A ray acquisition module for acquiring rays; 相交子三角形确定模块,用于确定与所述射线相交的平面子三角形;an intersecting sub-triangle determination module, configured to determine a plane sub-triangle intersecting with the ray; 反射光线计算模块,用于利用反射定律计算所述射线在所述平面子三角形上的交点位置的反射光线。The reflected ray calculation module is configured to use the reflection law to calculate the reflected ray at the intersection of the ray on the plane sub-triangle. 8.根据权利要求7所述的装置,其特征在于,所述第一空间曲线构建模块包括:8. The apparatus according to claim 7, wherein the first space curve building module comprises: 顶点法矢量计算单元,用于计算所述平面三角形的三个顶点的法矢量;a vertex normal vector calculation unit for calculating the normal vectors of the three vertices of the plane triangle; 第一空间曲线构建单元,用于根据所述平面三角形的边的顶点的坐标和法矢量,构建据所述平面三角形的边对应的第一空间曲线。A first space curve construction unit, configured to construct a first space curve corresponding to the sides of the plane triangle according to the coordinates and normal vectors of the vertices of the sides of the plane triangle. 9.一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至6中任一项所述方法的步骤。9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein the processor implements the steps of the method according to any one of claims 1 to 6 when the processor executes the computer program . 10.一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至6中任一项所述的方法的步骤。10. A computer-readable storage medium on which a computer program is stored, characterized in that, when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
CN202210175365.2A 2022-02-25 2022-02-25 Curved surface reflection line calculation method, device, computer equipment and storage medium Pending CN114612609A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210175365.2A CN114612609A (en) 2022-02-25 2022-02-25 Curved surface reflection line calculation method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210175365.2A CN114612609A (en) 2022-02-25 2022-02-25 Curved surface reflection line calculation method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114612609A true CN114612609A (en) 2022-06-10

Family

ID=81858208

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210175365.2A Pending CN114612609A (en) 2022-02-25 2022-02-25 Curved surface reflection line calculation method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114612609A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115661361A (en) * 2022-11-18 2023-01-31 南京智程信息科技有限公司 Model wall thickness calculation method, device, equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115661361A (en) * 2022-11-18 2023-01-31 南京智程信息科技有限公司 Model wall thickness calculation method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
US20210263499A1 (en) Conversion of mesh geometry to watertight boundary representation
Kineri et al. B-spline surface fitting by iterative geometric interpolation/approximation algorithms
JPH08138082A (en) Method and system for generation of square mesh
Wang et al. Enhanced remeshing from STL files with applications to surface grid generation
CN110688798B (en) Deformation prediction method, device, equipment and storage medium for shell structural part
CN109886279A (en) Image processing method, device, computer equipment and storage medium
Neto et al. Nagata patch interpolation using surface normal vectors evaluated from the IGES file
CN112632679B (en) Building information model scene rendering method and device and computer equipment
Li et al. A generative design method for structural topology optimization via transformable triangular mesh (TTM) algorithm
CN114612609A (en) Curved surface reflection line calculation method, device, computer equipment and storage medium
CN109658474A (en) Creation method, device and the computer equipment of three-dimensional sketch
Zhu et al. Analytical solutions for sketch-based convolution surface modeling on the GPU
Bo et al. Improving geometric iterative approximation methods using local approximations
Lu et al. A fast T-spline fitting method based on efficient region segmentation
CN115115801B (en) Method, device, equipment and readable storage medium for simplifying triangular mesh model
US11763524B2 (en) Layered meshing for additive manufacturing simulations
CN110489510B (en) Road data processing method and device, readable storage medium and computer equipment
CN110704896A (en) Method and product for placing connecting node between keel column model and wall keel model
CN110737934B (en) Tiger window roof truss node generation method, device and storage medium
CN110765513B (en) Method for placing connecting node of wall keel model and L-shaped top guide beam model and product
CN112507596B (en) Groundwater level analysis method and device, electronic equipment and storage medium
Mancinelli et al. Splines on manifolds: A survey
CN113158280B (en) Roof main body structure generation method, device, computer equipment and storage medium
CN110717291B (en) Deformation simulation method, device, equipment and storage medium for welded structural parts
CN110704897A (en) Method for placing connecting node between wall keel model and bottom guide beam model and product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination