CN114612609A - Curved surface reflection line calculation method, curved surface reflection line calculation device, computer equipment and storage medium - Google Patents
Curved surface reflection line calculation method, curved surface reflection line calculation device, computer equipment and storage medium Download PDFInfo
- 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
- line segment
- space curve
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T17/00—Three dimensional [3D] modelling, e.g. data description of 3D objects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/10—Geometric 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
Technical Field
The invention relates to the technical field of ray-on-curved surface reflection line calculation, in particular to a curved surface reflection line calculation method, a curved surface reflection line calculation device, computer equipment and a storage medium.
Background
In three-dimensional geometric modeling, a target curved surface is typically discretized into a large number of triangular, quadrilateral planar elements. For the target curved surface, the number of the surface element subdivision is enough to approach the original curved surface. When the number of target splits is not so sufficient, it is necessary in some scenarios to reconstruct the curved surface based on the current planar meta-model to improve the model representation accuracy. In addition, when a beam of light strikes a real curved surface (e.g., a spherical surface), the distribution of its reflected light is spatially continuous; if a surface is represented by a split planar element, the distribution of reflected light is also spatially discontinuous, no matter how finely the surface is split. The reason for this is that the normal vector of the planar element is unique, and the normal vector of the original surface where the planar element is located is spatially continuously distributed with different locations. Therefore, when calculating the reflection of the ray on the curved surface, in order to improve the calculation accuracy and approach to the real situation, it is also necessary to reconstruct the curved surface and solve the intersection point of the ray and the curved surface and the reflected ray.
Book published by electronics industry publishers "finite element analysis" in 2015: ANSYS theory and application: the 4 th edition derives a method for reconstructing a triangular plane element into a triangular curved surface, and the method uses a shape function, under the condition that 6 points on the reconstructed curved surface are known, any point on the reconstructed curved surface can be calculated, and the reconstructed curved surface can be obtained. The method has a problem that continuity between adjacent reconstruction curved surfaces is not easily maintained, or even if the continuity is maintained, a target surface composed of the reconstruction curved surfaces is not easily maintained to be smooth, resulting in a large error in calculating a reflected ray of a ray on the target surface.
Disclosure of Invention
In view of the above, it is necessary to provide a curved surface reflection line calculation method, apparatus, computer device and storage medium for solving the above technical problems.
A curved surface reflection line calculation method includes:
determining a plane triangle;
constructing a first space curve corresponding to each side of the plane triangle;
acquiring coordinates and normal vectors of all points forming the 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, wherein end points of two ends of each second space curve are positioned 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 second space curve and each third space curve;
acquiring rays;
determining a planar sub-triangle that intersects the ray;
and calculating the reflected light rays of the intersection positions of the rays on the plane sub-triangle by using a reflection law.
In one embodiment, the step of constructing the first space curve corresponding to each side of the planar triangle includes:
calculating normal vectors of three vertexes of the plane triangle;
and constructing the first space curve corresponding to the side of the plane triangle according to the coordinates and normal vectors of the vertex of the side of the plane triangle.
In one embodiment, the step of constructing the first space curve corresponding to the side of the planar triangle according to the coordinates of the vertex of the side of the planar triangle and the normal vector comprises:
taking the coordinates of the vertexes of the sides of the plane triangle as two end points of a first line segment, and performing normal vector interpolation along one end to the other end of the first line segment to obtain a first normal vector curved surface;
and performing space curve prediction based on the first normal vector curved surface to construct the first space curve.
In one embodiment, the performing spatial curve prediction based on the first normal vector surface further includes, after the step of constructing the first spatial curve:
and carrying out error correction on the constructed first space curve.
In one embodiment, the step of constructing a plurality of second space curves and third space curves based on the coordinates of each point of each first space curve corresponding to the planar triangle and the normal vector line includes:
extracting one point from each of first space curves corresponding to two sides of the plane triangle as a line segment endpoint, and connecting 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 end points of the connecting line segment;
extracting a point from each of two adjacent second space curves as a line segment endpoint, and connecting the two line segment endpoints to obtain a constructed line segment;
and constructing a third space curve corresponding to the construction line segment based on the construction line segment and the coordinates and normal vectors of the line segment end points of the construction line segment.
In one embodiment, the step of calculating the reflected ray of the intersection position of the ray on the plane sub-triangle by using the law of reflection comprises:
calculating a surface normal vector of the intersection point position of the ray and the plane sub-triangle;
and calculating the reflected light rays of the intersection point positions of the rays on the plane sub-triangle by using a reflection law based on the curved surface normal vector of the intersection point positions and the rays.
A curved surface reflection line calculation apparatus comprising:
the plane triangle determining module is used for determining a plane triangle;
the first space curve construction module is used for constructing a first space curve corresponding to each side of the plane triangle;
the first coordinate and normal vector acquisition module is used for acquiring the coordinates and normal vectors of all points forming the first space curve;
a second space curve constructing module, configured to construct a plurality of second space curves and third space curves based on coordinates and normal vector lines of each point of each first space curve corresponding to the planar triangle, where end points of two ends of each second space curve are located on two adjacent first space curves, and end points of two ends of each third space curve are located on two adjacent second space curves;
a sub-triangle dividing module, configured to divide the area where the planar triangle is located into a plurality of planar sub-triangles based on each of the second spatial curves and each of the third spatial curves;
the ray acquisition module is used for acquiring rays;
an intersecting sub-triangle determining module for determining a planar sub-triangle intersecting the ray;
and the reflected light ray calculation module is used for calculating the reflected light ray of the intersection point position of the ray on the plane sub-triangle by using the reflection law.
In one embodiment, the first spatial curve constructing module includes:
a vertex normal vector calculation unit for calculating normal vectors of three vertices of the plane triangle;
and the first space curve construction unit is used for constructing a first space curve corresponding to the side of the plane triangle according to the coordinates and normal vectors of the vertex of the side of the plane triangle.
A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor when executing the computer program implements the steps in any of the above-described curved surface reflection curve calculation methods.
A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of any one of the embodiments of the method for calculating a curved surface reflection line as described above.
According to the method, the device, the computer equipment and the storage medium for calculating the curved surface reflection line, the vertex coordinates and the normal vector of the plane triangle are used for curved surface reconstruction and the method for calculating the light reflected by the curved surface makes the constructed curve smoother and makes the calculated reflection light more accurate, and the method and the device are used for the curved surface reconstruction process of a three-dimensional geometric model formed by the plane triangle and the subsequent scene needing to calculate the intersection point of the ray and the curved surface or the reflection light.
Drawings
FIG. 1 is a schematic flow chart of a method for calculating a curved surface reflection line according to an embodiment;
FIG. 2 is a block diagram of a curved surface reflection line calculation device in one embodiment;
FIG. 3 is a diagram of the internal structure of a computer device in one embodiment;
FIG. 4 is a schematic process diagram of constructing a spatial surface based on planar triangles in one embodiment;
FIG. 5 is a diagram illustrating ray intersections with space curves and reflected rays in one embodiment;
FIG. 6 is a diagram illustrating a normal vector reconstruction process on one side of a planar triangle, according to an embodiment;
FIG. 7 is a schematic representation of spatial curve prediction in one embodiment;
FIG. 8 is a schematic diagram of a spatial curve error correction process in one embodiment;
FIG. 9 is a diagram of normal vectors for points inside a triangle in one embodiment;
FIG. 10 is a flowchart illustrating a method for calculating a curved surface reflection line according to another embodiment;
FIG. 11 is a schematic diagram of a co-vertex planar triangle in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
Example one
In this embodiment, as shown in fig. 1, a curved surface reflection curve calculation method is provided, which includes:
In the present embodiment, as shown in fig. 4(a), the plane triangle is a triangle determined based on a two-dimensional space, and the plane triangle is located in a plane determined by the X axis and the Y axis in fig. 4.
And 120, constructing a first space curve corresponding to each side of the plane triangle.
In this embodiment, as shown in fig. 4(a) and (b), curves are respectively constructed for the sides of the planar triangle, each curve corresponds to one side of the triangle, and each curve is in the same plane with one side of the triangle.
In this embodiment, the coordinates and normal vectors of each point on each first space curve are obtained.
In this embodiment, as shown in fig. 4(c), a second space curve is constructed with points on two adjacent sides of the planar triangle as two end points of the second space curve; and constructing a third space curve by taking points on two adjacent second space curves as two end points of the third space curve.
And 150, dividing the area where the plane triangle is located into a plurality of plane sub-triangles based on each second space curve and each third space curve.
In this embodiment, projections of the second space curves and the third space curves on the plane triangle intersect, and the original space curved surface corresponding to the plane triangle is divided into a plurality of plane sub-triangles based on the second space curves and the third space curves.
In this embodiment, each second space curve and each third space curve divides the plane triangle into a plurality of sub-triangles, i.e., plane sub-triangles, which are also called plane small triangles or small triangles. It should be understood that both ends of the second space curve are respectively located on two adjacent sides of the planar triangle, and thus, the second space curves crossing different sides intersect to be divided into a plurality of planar sub-triangles within the planar triangle.
It should be understood that, taking a spatial sphere with radius R as an example, the sphere is usually split into a large number of "planar triangles" to approximate in a computer. Thus, the original smooth curved surface is replaced by a large number of "flat triangles" which cause discontinuities in the reflected light from the target surface. In the present application, based on any one of the "plane triangles", an attempt is made to reconstruct an original curved surface (in this example, a spherical surface) corresponding to the plane triangle. Specifically, the set of plane sub-triangles divided based on the second space curve and the third space curve is an approximate representation of the original curved surface corresponding to the plane triangle, and the purpose is to use the intersection point of the ray and the plane sub-triangle to approximate the intersection point of the ray and the original curved surface in order to improve the accuracy of the intersection point of the ray and the original curved surface.
At step 160, rays are acquired.
In this embodiment, the ray is an incident ray, the trajectory of the ray is obtained, and the incident direction and position of the ray are obtained.
At step 170, a planar sub-triangle intersecting the ray is determined.
In this embodiment, based on the direction and position of the ray, as shown in (a) and (b) of fig. 5, the sub-triangle of the plane intersected by the ray can be determined.
And step 180, calculating the reflection ray of the intersection point position of the ray on the plane sub-triangle by using the reflection law.
In this embodiment, as shown in fig. 5 (c), the reflection law is used to calculate the path of the reflected light ray formed by the ray reflected on the intersected planar sub-triangle, and the reflection direction and position of the reflected light ray are calculated.
In one embodiment, the step of constructing the first space curve corresponding to each side of the planar triangle includes: calculating normal vectors of three vertexes of the plane triangle; and constructing the first space curve corresponding to the side of the plane triangle according to the coordinates and normal vectors of the vertex of the side of the plane triangle.
In one embodiment, the step of constructing the first space curve corresponding to the side of the planar triangle according to the coordinates of the vertex of the side of the planar triangle and the normal vector comprises: taking the coordinates of the vertexes of the sides of the plane triangle as two end points of a first line segment, and performing normal vector interpolation along one end to the other end of the first line segment to obtain a first normal vector curved surface; and performing space curve prediction based on the first normal vector curved surface to construct the first space curve.
As shown in FIG. 6, PaAnd PbTwo end points of the line segment, in this embodiment, PaAnd PbTwo vertices of a triangle as a side of the plane, a straight line segment PaPbEnd point coordinate P ofa(xa,ya,za)、Pb(xb,yb,zb) And its normal vector fa(fxa,fya,fza)、fb(fxb,fyb,fzb) Solving for the straight line segment PaPbThe method of the stretched space curve is as follows:
first, along a straight line segment PaPbPerforming normal vector interpolation
As shown in fig. 6, in straight line segment PaPbTake a series of discrete points P1、P2、…Pk…, normal vectors at the discrete points are calculated by a linear interpolation method. With Pk(xk,yk,zk) For example, its normal vector fk(fxk,fyk,fzk) F in (1)xkCan be expressed as:
the remaining coordinates fyk、fzkCan be determined in a similar manner. It is noted that, in general, the normal vector f is due to the two ends of the line segmenta、fbTypically not coplanar, and therefore the series of normal vectors obtained in this step are not coplanar. If line segment PaPbIf the discrete points are sufficiently dense, then the normal vector at the discrete points will form a vector from faTransition to fbThe normal vector surface of (1). Then reconstructing on the curved surface from PaTo PbThe spatial profile of (a).
Subsequently, the spatial curve predicts:
as shown in fig. 7, due to the point Pa、PbIs two vertexes of the original plane triangle, so the finally reconstructed space curved surface must pass through the point Pa、PbSo that there exists a passing point PaWith faIs a tangent plane of normal vector, which can be taken as PaLinear approximation of the reconstructed surface in the neighborhood. With P1As a starting point, f1Ray (P) being a direction vector1,f1) Intersecting plane at point Q1,Q1Is actually a ray (P)1,f1) An estimate of the intersection with the reconstructed surface and some error from the true intersection. In the same way, at Q1Point with f1Making a tangent plane for the normal vector, and calculating the sum of the tangent plane and the ray (P)2,f2) Cross point of (Q)2Further, Q is sequentially obtained3…, up to Qb。
Theoretically, PbShould be in contact with QbThis error needs to be corrected for the coincidence. Therefore, in one embodiment, the performing spatial curve prediction based on the first normal vector surface further includes, after the step of constructing the first spatial curve: and carrying out error correction on the constructed first space curve.
And finally, error correction:
as shown in FIG. 8, the estimated value QbAnd true value PbThe distance error between is eb=|Qb-PbL. the method is used for the preparation of the medicament. Since the errors are cumulative, correction of the previous respective estimated values is required. With QkFor example, its distance error ekCan be approximately expressed as:
then Q iskThe corrected coordinates are:
by correcting all the estimation points in the method, a line segment P can be obtainedaPbAnd (4) generating a space curve. Thus, the final reconstructed surface transit point Qk', the normal vector of the point can be represented by fkApproximately represented.
In one embodiment, the step of constructing a plurality of second space curves and third space curves based on the coordinates of each point of each first space curve corresponding to the planar triangle and the normal vector line includes: extracting one point from each of first space curves corresponding to two sides of the plane triangle as a line segment endpoint, and connecting 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 end points of the connecting line segment; extracting a point from each of two adjacent second space curves as a line segment endpoint, and connecting the two line segment endpoints to obtain a constructed line segment; and constructing a third space curve corresponding to the construction line segment based on the construction line segment and the coordinates and normal vectors of the line segment end points of the construction line segment.
In the present embodiment, the second space curves constructed based on these connecting line segments are approximately parallel visually.
In this embodiment, first, a point is extracted from the first space curve corresponding to two sides of the plane triangle as a line segment end point, the two line segment end points are connected to obtain a connected line segment, and a corresponding second space curve is constructed based on the connected line segment.
Specifically, two sides of the plane triangle are curve-reconstructed, and then a point is taken from each of the two reconstructed curves to connect into a line segment, and since the end point coordinates and the normal vector of the curved surface of the line segment are already obtained, a space curve can be generated based on the end point coordinates and the normal vector of the line segment by using the method of the above embodiment, as shown in fig. 4 (b). Subsequently, points and lines are continuously taken and connected on the generated space curve to generate a space curve, and finally a curve network meeting the requirements is generated to complete the curved surface reconstruction, as shown in fig. 4 (c).
In addition, by using the same method as that for constructing the second space curve, as shown in fig. 4C, one point is extracted from each of two adjacent second space curves as a line segment end point, and the two line segment end points are connected to obtain a constructed line segment; and constructing a third space curve corresponding to the construction line segment based on the construction line segment and the coordinates and normal vectors of the line segment end points of the construction line segment.
In one embodiment, the step of calculating the reflected ray of the intersection position of the ray on the plane sub-triangle by using the law of reflection comprises: calculating a surface normal vector of the intersection point position of the ray and the plane sub-triangle; and calculating the reflected light rays of the intersection point positions of the rays on the plane sub-triangle by using a reflection law based on the curved surface normal vector of the intersection point positions and the rays.
In this embodiment, the intersection condition of the ray and the small triangular surface element set is calculated, and the surface normal vector at the intersection point is solved.
If the ray does not intersect any of the small triangles in the set, the ray does not intersect the reconstructed surface; on the contrary, a small triangle intersecting the ray is found, the coordinates of the intersection point of the ray and the small triangle are calculated, and the intersection point is taken as the intersection point of the ray and the reconstructed curved surface, as shown in fig. 5 (a).
As shown in FIG. 9, assume that a ray intersects the planar sub-triangle ABC with an intersection point P. The vertex coordinates and normal vectors of the planar sub-triangle ABC are extracted, as shown in FIG. 9, fa、fb、fcAre respectively provided withIs the surface normal vector at the vertex A, B, C. The crossing point P is crossed with BC by a straight line parallel to AB, and the proportion coefficient of the crossing point in BC is beta (beta is more than or equal to 0 and less than or equal to 1); meanwhile, the crossing point P is crossed with the AB by a straight line parallel to BC, the proportion of the crossing point to the AB is gamma (gamma is more than or equal to 0 and less than or equal to 1), and the normal vector of the curved surface at the point P can be approximately expressed as:
fp=(1-β-γ)fb+βfc+γfa
finally, the normal vector of the curved surface and the incident ray at the known intersection point can be used for solving the reflection ray according to the reflection law, and the reflection ray is used as the reflection ray of the ray and the reconstructed curved surface.
It should be understood that, although the steps in the flowchart of fig. 1 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a portion of the steps in fig. 1 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
Example two
In this embodiment, a curved surface reconstruction method based on planar triangles and vertex normal vectors thereof is provided, which can ensure strict continuity and basic smoothness between respective reconstructed curved surfaces of adjacent planar triangles while achieving curved surface reconstruction. As shown in fig. 10, the method first calculates (or extracts) the normal vectors of the points at 3 vertices of the triangle, and uses this information to perform curve reconstruction on a certain edge of the triangle, as shown in fig. 4 (a); then, a point is taken from each of the two reconstructed curves to be connected into a line segment, and the line segment is subjected to curve reconstruction, as shown in fig. 4 (b); finally, points are taken from the reconstructed curve and line segments are connected by a similar method, and the curve corresponding to the line segments is reconstructed until a curve network meeting the requirements of the user is formed, as shown in fig. 4 (c).
The solving process of the intersection point of the ray and the curved surface and the reflection line is as follows: on the basis of the curve network obtained based on the method, a plane small triangle set is obtained firstly, and the intersection condition of the ray and the set is calculated. If the intersection exists, finding the small triangle where the intersection exists and the intersection position, as shown in FIG. 5 (a); then, reconstructing a normal vector of the intersection position by using the normal vector of the vertex of the small triangle, as shown in fig. 5 (b); finally, the reflection law is used to calculate the reflected ray of the ray at the intersection position, as shown in fig. 5 c).
The calculation processes of vertex normal vector interpolation, curve and curved surface reconstruction and intersection point of ray and curved surface are described below with reference to the attached drawings.
(1) Obtaining/calculating the normal vector of the triangle vertex
If the true value of the triangle vertex normal vector can be obtained, the data can be directly used; otherwise, the normal vector of the vertex needs to be calculated using the information about the co-vertex planar triangle as an estimate of the true value, as shown in fig. 11. There are many methods in the existing literature and flexible options are available.
(2) Reconstructing a spatial curve based on line segment vertices and normal vector information
Known straight line segment PaPbEnd point coordinate P ofa(xa,ya,za)、Pb(xb,yb,zb) And its normal vector fa(fxa,fya,fza)、fb(fxb,fyb,fzb) Solving for the straight line segment PaPbThe method of the expanded space curve is as follows.
Is along straight line segment PaPbPerforming normal vector interpolation
As shown in fig. 6, in straight line segment PaPbTake a series of discrete points P1、P2、…Pk…, normal vectors at the discrete points are calculated by a linear interpolation method. With Pk(xk,yk,zk) For example, its normal vector fk(fxk,fyk,fzk) F in (1)xkCan be expressed as:
the remaining coordinates fyk、fzkCan be determined in a similar manner. It is noted that, in general, the normal vector f is due to the two ends of the line segmenta、fbUsually, the vectors are not coplanar, so the normal vectors obtained in step (i) are not coplanar. If line segment PaPbIf the discrete points are sufficiently dense, then the normal vector at the discrete points will form a vector from faTransition to fbThe normal vector surface of (1). Then reconstructing on the curved surface from PaTo PbThe spatial profile of (a).
② spatial Curve prediction
As shown in fig. 7, due to the point Pa、PbIs two vertexes of the original plane triangle, so the finally reconstructed space curved surface must pass through the point Pa、PbSo that there exists a passing point PaWith faIs a tangent plane of normal vector, which can be taken as PaLinear approximation of the reconstructed surface in the neighborhood. With P1As a starting point, f1Ray (P) being a direction vector1,f1) Intersecting plane at point Q1,Q1Is actually a ray (P)1,f1) An estimate of the intersection with the reconstructed surface and some error from the true intersection. In the same way, at Q1Point with f1Making a tangent plane for the normal vector, and calculating the sum of the tangent plane and the ray (P)2,f2) Cross point of (Q)2Further, Q is sequentially obtained3…, up to Qb. Theoretically, PbShould be in contact with QbThis error needs to be corrected for the coincidence.
(iii) error correction
As shown in FIG. 8, the estimated value QbAnd true value PbThe distance error between is eb=|Qb-PbL. Since the errors are cumulative, correction of the previous respective estimated values is required.With QkFor example, the distance error ekCan be approximately expressed as:
then Q iskThe corrected coordinates are:
Qk'=Qk-ekfk
by correcting all the estimation points in the method, a line segment P can be obtainedaPbAnd (4) generating a space curve. It can be considered that the final reconstructed surface passes through point Qk', the normal vector of this point can be used as fkApproximately represented.
(3) Connecting line segments on adjacent spatial curves and reconstructing the curves
And (3) performing curve reconstruction on two sides of the original plane triangle by using the method in the step (2). Then, a point is taken from each of the two reconstructed curves to be connected into a line segment. Since the end point coordinates and the normal vector of the line segment have already been found, a space curve can be generated using the method of step (2), as shown in fig. 4 (b).
(4) According to the actual needs of the user, points and lines are continuously taken and connected on the generated space curve to generate a space curve, and finally a curve network meeting the requirements is generated to complete the curved surface reconstruction, as shown in fig. 4 (c).
Solving method for intersection point of ray and curved surface and reflection line
(1) On the basis of the curve network shown in fig. 4(c), a set of planar small triangular surface elements is constructed as shown in fig. 5 (a).
(2) Calculating the intersection condition of the ray and the small triangular surface element set, and solving the surface normal vector at the intersection point
If the ray does not intersect any of the small triangles in the set, the ray does not intersect the reconstructed surface; on the contrary, a small triangle intersecting the ray is found, the coordinates of the intersection point of the ray and the small triangle are calculated, and the intersection point is taken as the intersection point of the ray and the reconstructed curved surface, as shown in fig. 5 (a).
Suppose thatThe ray intersects small triangle ABC, and the intersection point is P. The vertex coordinates and normal vectors of the small triangle are extracted, as shown in FIG. 9, fa、fb、fcRespectively, the normal vectors of the surfaces at the apex A, B, C. The crossing point P is crossed with BC by a straight line parallel to AB, and the proportion coefficient of the crossing point in BC is beta (beta is more than or equal to 0 and less than or equal to 1); meanwhile, the crossing point P is crossed with the AB by a straight line parallel to BC, the proportion of the crossing point to the AB is gamma (gamma is more than or equal to 0 and less than or equal to 1), and the normal vector of the curved surface at the point P can be approximately expressed as:
fp=(1-β-γ)fb+βfc+γfa
(3) the normal vector and incident ray of the curved surface at the known intersection point can be used for solving the reflection ray according to the reflection law, and the reflection ray is used as the reflection ray of the ray and the reconstructed curved surface.
EXAMPLE III
In this embodiment, as shown in fig. 2, a curved surface reflection curve calculation apparatus is provided, which includes:
a plane triangle determining module 210, configured to determine a plane triangle;
a first space curve constructing module 220, configured to construct a first space curve corresponding to each side of the planar triangle;
a first coordinate and normal vector obtaining module 230, configured to obtain coordinates and normal vectors of points that form the first space curve;
a second space curve constructing module 240, configured to construct a plurality of second space curves and third space curves based on coordinates and normal vector lines of each point of each first space curve corresponding to the planar triangle, where end points of two ends of each second space curve are located on two adjacent first space curves, and end points of two ends of each third space curve are located on two adjacent second space curves;
a sub-triangle dividing module 250, configured to divide the area where the planar triangle is located into a plurality of planar sub-triangles based on each of the second spatial curves and each of the third spatial curves;
a ray acquisition module 260 for acquiring rays;
an intersecting sub-triangle determining module 270 for determining a planar sub-triangle that intersects the ray;
and the reflected ray calculation module 280 is used for calculating the reflected ray of the intersection point position of the ray on the plane sub-triangle by using the law of reflection.
In one embodiment, the first spatial curve construction module comprises:
a vertex normal vector calculation unit for calculating normal vectors of three vertices of the planar triangle;
and the first space curve construction unit is used for constructing a first space curve corresponding to the side of the plane triangle according to the coordinates and normal vectors of the vertex of the side of the plane triangle.
For specific definition of the curved surface reflection line calculating device, reference may be made to the above definition of the curved surface reflection line calculating method, which is not described herein again. The respective units in the curved-surface reflection line calculation apparatus described above may be wholly or partially implemented by software, hardware, and a combination thereof. The units may be embedded in hardware or independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor invokes and executes operations corresponding to the units.
Example four
In this embodiment, a computer device is provided. The internal structure thereof may be as shown in fig. 3. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program, and the non-volatile storage medium is deployed with a database. The internal memory provides an environment for the operation of an 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 that deploy application software. The computer program is executed by a processor to implement a curved surface reflection curve calculation method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 3 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, there is provided a computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of any of the above-described curved surface reflection curve calculation methods when executing the computer program.
EXAMPLE five
In this embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which, when being executed by a processor, implements the steps of any of the above-mentioned curved surface reflection line calculation methods.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), Rambus (Rambus) direct RAM (RDRAM), direct bused dynamic RAM (DRDRAM), and bused dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is specific and detailed, but not to be understood as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, and these are all within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.
Claims (10)
1. A curved surface reflection curve calculation method is characterized by comprising the following steps:
determining a plane triangle;
constructing a first space curve corresponding to each side of the plane triangle;
acquiring coordinates and normal vectors of all points forming the 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, wherein end points of two ends of each second space curve are located on two adjacent first space curves, and end points of two ends of each third space curve are located on two adjacent second space curves;
dividing the area where the plane triangle is located into a plurality of plane sub-triangles based on each second space curve and each third space curve;
acquiring rays;
determining a planar sub-triangle that intersects the ray;
and calculating the reflected light rays of the intersection positions of the rays on the plane sub-triangle by using a reflection law.
2. The method of claim 1, wherein the step of constructing a first space curve corresponding to each side of the planar triangle comprises:
calculating normal vectors of three vertexes of the plane triangle;
and constructing the first space curve corresponding to the side of the plane triangle according to the coordinates and normal vectors of the vertex of the side of the plane triangle.
3. The method according to claim 2, wherein the step of constructing the first space curve corresponding to the side of the planar triangle from the coordinates of the vertex of the side of the planar triangle and a normal vector comprises:
taking the coordinates of the vertexes of the sides of the plane triangle as two end points of a first line segment, and performing normal vector interpolation along one end to the other end of the first line segment to obtain a first normal vector curved surface;
and performing space curve prediction based on the first normal vector curved surface to construct the first space curve.
4. The method of claim 3, wherein the spatial curve prediction is performed based on the first normal vector surface, and the step of constructing the first spatial curve further comprises:
and carrying out error correction on the constructed first space curve.
5. The method according to claim 1, wherein the step of constructing a plurality of second and third space curves based on the coordinates of the points of each of the first space curves corresponding to the planar triangle and a normal vector line comprises:
extracting one point from each of the first space curves corresponding to the two sides of the plane triangle as a line segment end point, and connecting the two line segment end points 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 end points of the connecting line segment;
extracting a point from each of two adjacent second space curves as a line segment endpoint, and connecting the two line segment endpoints to obtain a constructed line segment;
and constructing a third space curve corresponding to the construction line segment based on the construction line segment and the coordinates and normal vectors of the line segment end points of the construction line segment.
6. The method according to any one of claims 1 to 5, wherein the step of calculating the reflected ray for the intersection position of the ray on the planar sub-triangle using the law of reflection comprises:
calculating a surface normal vector of the intersection point position of the ray and the plane sub-triangle;
and calculating the reflected light rays of the intersection point positions of the rays on the plane sub-triangle by using a reflection law based on the curved surface normal vector of the intersection point positions and the rays.
7. A curved surface reflection curve calculation apparatus, comprising:
the plane triangle determining module is used for determining a plane triangle;
the first space curve construction module is used for constructing a first space curve corresponding to each side of the plane triangle;
the first coordinate and normal vector acquisition module is used for acquiring the coordinates and normal vectors of all points forming the first space curve;
a second space curve constructing module, configured to construct a plurality of second space curves and third space curves based on coordinates and normal vector lines of each point of each first space curve corresponding to the planar triangle, where end points of two ends of each second space curve are located on two adjacent first space curves, and end points of two ends of each third space curve are located on two adjacent second space curves;
a sub-triangle dividing module, configured to divide the area where the planar triangle is located into a plurality of planar sub-triangles based on each of the second spatial curves and each of the third spatial curves;
the ray acquisition module is used for acquiring rays;
an intersecting sub-triangle determining module for determining a planar sub-triangle intersecting the ray;
and the reflected light ray calculation module is used for calculating the reflected light ray of the intersection point position of the ray on the plane sub-triangle by using the reflection law.
8. The apparatus of claim 7, wherein the first spatial curve constructing module comprises:
a vertex normal vector calculation unit for calculating normal vectors of three vertices of the planar triangle;
and the first space curve construction unit is used for constructing a first space curve corresponding to the side of the plane triangle according to the coordinates and normal vectors of the vertex of the side of the plane triangle.
9. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 6.
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, curved surface reflection line calculation 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, curved surface reflection line calculation 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, curved surface reflection line calculation device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114612609A (en) |
Cited By (1)
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 |
-
2022
- 2022-02-25 CN CN202210175365.2A patent/CN114612609A/en active Pending
Cited By (1)
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 |
---|---|---|
Wang et al. | Surface flattening based on energy model | |
Wang et al. | An optimization approach for constructing trivariate B-spline solids | |
Saini et al. | NURBS-based geometric inverse reconstruction of free-form shapes | |
Novello et al. | Exploring differential geometry in neural implicits | |
Neto et al. | Nagata patch interpolation using surface normal vectors evaluated from the IGES file | |
CN114612609A (en) | Curved surface reflection line calculation method, curved surface reflection line calculation device, computer equipment and storage medium | |
Zheng et al. | A new topology optimization framework for stiffness design of beam structures based on the transformable triangular mesh algorithm | |
Veron et al. | Shape preserving polyhedral simplification with bounded error | |
Aubry et al. | A three-dimensional parametric mesher with surface boundary-layer capability | |
Wang et al. | Reduce the stretch in surface flattening by finding cutting paths to the surface boundary | |
Wang et al. | EQSM: An efficient high quality surface grid generation method based on remeshing | |
Yin | Direct generation of extended STL file from unorganized point data | |
Li et al. | A generative design method for structural topology optimization via transformable triangular mesh (TTM) algorithm | |
CN112805754B (en) | Method and data processing system for CAD operation | |
US8289332B2 (en) | Apparatus and method for determining intersections | |
Scheirer et al. | Fiber layup generation on curved composite structures | |
CN113947661A (en) | Modeling method for fitting generalized cylinder curved surface based on water elastic paper folding derivative structure | |
De Araújo et al. | Curvature dependent polygonization of implicit surfaces | |
Ptáčková et al. | A simple and complete discrete exterior calculus on general polygonal meshes | |
Tremel et al. | Automatic unstructured surface mesh generation for complex configurations | |
Zhu et al. | Constructive generation of the medial axis for solid models | |
Marchiori et al. | Isogeometric analysis applied to 2D Bernoulli-Euler beam model: imposition of constraints by Lagrange and Penalty methods | |
Zhu et al. | Computing the minimum distance between a point and a curve on mesh | |
Laug | Some aspects of parametric surface meshing | |
Wang et al. | An automated mesh generation algorithm for curved surfaces of ship longitudinal structures |
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 |