RAY TRACING SYNTHESIS OF SPATIAL CURVE IMAGES BUILT BY THE SPHERICAL INTERPOLATION METHOD

The methods for constructing curves and surfaces that interpolate points set in space largely determine complexity of the algorithm for synthesizing images of objects and realism of the synthesized scene. Comparison of various ways of describing curves and surfaces in solving problems of image synthesis by the method of ray tracing is given hereinafter. Objects with a triangulated surface without smoothing are used alongside the method of ray tracing in [3]. A method was proposed for finding the point of intersection of a projection ray (PR) with a triangle. At the same time, this approach significantly worsens realism of synthesized objects since the surface geometry is violated and physically correct illumination cannot be calculated. One of convenient mathematical methods for describing curvilinear forms of objects consists in their representation with the help of pieces of parametric curves, surfaces or splines. Finding the point of intersection of a PR with such surfaces is not an easy task. An algorithm for finding point of intersection of a PR with NURBS splines was proposed in

Therefore, study of capabilities of synthesis by ray tracing of images of smooth spatial curves constructed by the method of spherical interpolation is a crucial issue.

Literature review and problem statement
The methods for constructing curves and surfaces that interpolate points set in space largely determine complexity of the algorithm for synthesizing images of objects and realism of the synthesized scene.Comparison of various ways of describing curves and surfaces in solving problems of image synthesis by the method of ray tracing is given hereinafter.Objects with a triangulated surface without smoothing are used alongside the method of ray tracing in [3].A method was proposed for finding the point of intersection of a projection ray (PR) with a triangle.At the same time, this approach significantly worsens realism of synthesized objects since the surface geometry is violated and physically correct illumination cannot be calculated.
One of convenient mathematical methods for describing curvilinear forms of objects consists in their representation with the help of pieces of parametric curves, surfaces or splines.Finding the point of intersection of a PR with such surfaces is not an easy task.An algorithm for finding point of intersection of a PR with NURBS splines was proposed in

Introduction
The main trend in modern computer graphics consists in strengthening realism of synthesized scenes [1].Meeting the requirement of high realism is an important factor, for example, in designing visualization systems (VS) for simulators of a variety of vehicles (e. g., aviation training simulators) or those used in film making with the use of computer graphics, etc.One possible way to cope with this problem is to apply the ray tracing method in solving problems of image synthesis [2].
The ray tracing method has been actively developing in recent years.It enables synthesis of images of analytically described surfaces without their preliminary triangulation, which significantly increases realism of the synthesized images of objects.At the same time, the base of models of objects and software accumulated in the computer graphics are oriented to the curves set by straight line segments and triangulated surfaces.In the classical computer graphics, this representation is necessary to synthesize curves and surfaces by the rasterization method.
Combination of the ray tracing method with the accumulated base of object models and software should be realized preserving features of high realism of the method.
Solution of this problem is greatly simplified if the method of spherical interpolation is used to interpolate curves and surfaces.

RAY TRACING SYNTHESIS OF SPATIAL CURVE IMAGES BUILT BY THE SPHERICAL INTERPOLATION METHOD V . G u s i a t i n
PhD, Professor* Е-mail: vmgus1@gmail.com

M . G u s i a t i n
Engineer* Е-mail: mgusatin@gmail.com

О . M i k h a l
Doctor of Technical Science, Professor, Head of Department* Е-mail: oleg.mikhal@gmail.com*Department of Electronic Computers National University of Radio Electronics Nauky ave., 14, Kharkiv, Ukraine, 61166

Решается задача визуализации обратным трассированием пространственных кривых, заданных точками интерполяции, и сглаженных методом сферической интерполяции. Приведены аналитические соотношения для реализации каждого этапа построения и визуализации таких кривых. Особенностью решения задачи является совмещение метода сферической интерполяции и синтеза изображения пространственной кривой методом обратного трассирования за один проход. Такой подход позволяет повысить реалистичность изображений сцен
Ключевые слова: обратное трассирование, проекционный луч, моделирование кривых и поверхностей, квадрик, сферическая интерполяции [4].This algorithm is based on the well-known Bézier's clipping method.The author proposed to transform the NURBS surface into rational Bezier regions at the stage of preliminary preparation of the algorithm to work which requires additional computational costs.A complex approach is presented in [5].Parametrically free surface forms and the most suitable for them way of visualization by the ray tracing method are studied there.In general, analysis of works [4,5] makes it possible to note that the use of NURBS and other parametric curves and surfaces significantly lengthens time of rendering the scene by the ray tracing method.This makes it difficult to use standard algorithms for image synthesis with the help of the ray tracing method.This feature of parametric description has made the researchers resort to algebraic curves and surfaces.A method for approximating a given set of ordered data points using biarc interpolation was proposed in [6].There is no complex approach: construction of surfaces by this method and visualization by the ray tracing method are not considered.Construction of spherical splines for interpolation is discussed in [7].In view of complexity, it is proposed to use this method for solving problems arising in geophysics and for a realistic description of the Earth's geopotential.Local mixing of radially basic functions was proposed in [8] to construct surfaces.When using this approach, difficulties with boundary bonding arise in interpolation of triangulated surfaces.The interpolation surface for a triangle was constructed in [9] by mixing two algebraic surfaces of the second and third order.To increase variety of forms of the interpolation surface, it was proposed to blend two algebraic surfaces of the second and third order.Disadvantage of this approach consists in complexity of calculation of such surfaces.The lack of an algorithm for finding point of intersection of a PR with the surface makes it difficult to use this method in constructing VS.It was proposed in [10] to use an algebraic surface of the second order as perturbation functions but an initial triangulation net of high detail is required for interpolation.Besides, formation of such a surface is multi-stage and the time of image synthesis increases if the surface geometry alters.According to the author of this method, it can be used in systems of interactive volumetric oriented geometric modeling.It was proposed in [11] to apply the method of spherical interpolation which is based on the use of the simplest quadric, sphere.An example of construction of a spatial curve was considered.With this approach, the following problems can be solved.Restoration of a smooth surface is possible using an existing model base with a triangulated surface.In this case, there is no need to interpolate illumination according to Gouraud or Phong shading.When calculating glare, there is no need to calculate bidirectional reflectance distribution function (BRDF) and perspective is taken into account when calculating illumination.An undistorted by faces shadow shape is obtained in mapping.It is easier to apply a texture and much more.An example of constructing a curve by the method of spherical interpolation and its visualization by ray tracing is considered in [12].
Thus, there is a problem in computer graphics related with combining highly realistic image synthesis by the method of ray tracing with the accumulated base of model objects having triangulated surfaces and linearly interpolated curves.The first part of this problem solution consists in necessity of further studies of the interpolation methods based on algebraic surfaces, quadrics.It is necessary that this method be uniform (universal) both for constructing curves and surfaces.The second part of the problem solution is elaboration of the main stages (algorithms) of visualization by the method of ray tracing of arbitrary curves and surfaces constructed using algebraic surfaces.These surfaces make it possible to perform operation of tracing PR in a simplest way.This work is part of such studies.The work presents a complex solution for constructing spatial curves by the method of spherical interpolation and synthesis of such curve image by ray tracing based on the proposed iterative process.

The aim and objectives of the study
This work objective was to develop stages of image synthesis by ray tracing of spatial curves constructed by the method of spherical interpolation.
To achieve this objective, the following tasks were accomplished: -for visualization, construct an iterative process (IP) of calculation of the point in the PR nearest to some point in the mathematical spatial curve; -elaborate stages of the construction of points in the spatial curve that would coincide with the step of the iterative calculation process which allows one to perform visualization algorithm and plot the curve point in one IP pass.

1. Features of construction of the projection ray
The process of synthesizing images of spatial mathematical curves by the method of ray tracing is complicated by the fact that there is no size of this object (for example, the size of the cross section of such a curve).In accordance with the method of ray tracing, it is necessary to find the intersection point of the projection ray (PR) with the object (it has no size in this case).In order to "capture" such an object, introduce the concept of pixel visibility pyramid (PVP).This approach makes it possible to estimate whether the mathematical point in the curve falls into the region of space allocated to PVP, that is, to verify the "capture" operation.In this case, the minimum widths of the line of the synthesized image in a screen are limited by the pixel dimensions.Basic relationships for construction of PVP are shown below.The right coordinate system XYZ is shown here (the z axis is directed upwards).The geometric scheme realizes centroprojective transformation of the synthesized spatial curve image onto the screen.In the scene bounded by a cube in Fig. 1, points (p 1 -p 12 ) connected by straight lines present the initial data for the synthesized smooth curve.These initial data are supplemented with unit normals at each point n 1 {n 1 x, n 1 y, n 1 z}-n 12 [11].A flat screen is shown: (ps 1 -ps 4 ) are set in XYZ coordinate system.Assume that the screen pixel is a square with vertices set by points (px 1 -px 4 ) in XYZ coordinate system.In this case, the four planes forming the PVP can be determined for three points.One point, the center of projection h, is common for all planes.Two more points for each of the four planes are determined at the pixel vertices.For definiteness, denote these planes f p1 -f p4 by the numbers of the first points (of two) denoting the pixel vertices: f p1 (x, y, z); f p2 (x, y, z); f p3 (x, y, z); f p4 (x, y, z). ( Relationships (1) will be used to perform "capture" test.

2. Interpolation region. Sphere of greatest curvature
According to [11], the method of spherical interpolation makes it possible to construct a smooth curve, both locally for an individual segment and as a whole for all segments.Therefore, in outlining of the main synthesis, the process of calculations for a local (individual) segment will be considered.Since hereinafter, vector quantities will be mainly written in relationships, they will not be denoted by an arrow.It is also important to note here that the points specified in XYZ coordinate system can be defined as the radius-vector of these points.
The following notation was adopted in Fig. 1: h is the radius-vector of the projection center; v is the observation vector connecting the point h with an arbitrary pixel in the screen.By analogy with [12], allocate a region of interpolation for each segment.To do this, construct a sphere of greatest curvature for the chosen segment.This sphere limits the space in such a way that any spatial curve constructed in a segment, e. g. p 1 , p 2 , will be inside this sphere.Define the radius-vector c 0 for the middle of segment p 1 , p 2 in which center of the sphere of greatest curvature is located ( ) Write the equation for the sphere of greatest curvature in a vector form: where r is radius-vector specifying a point in the surface.

3. Test for checking transition of the projection beam in the interpolation region
Write in a parametric form the equation of straight line (projection ray is PR hereinafter) which coincides with the observation vector ( ) where t is parameter, scalar, Write down equation of the plane passing through the center of the sphere of greatest curvature and perpendicular to the observation vector Find a joint solution of equations ( 4) and ( 5) with respect to t and substitute the obtained value in (4).Thus, the radius-vector p(t 0 ) is obtained which determines, for a given value of t 0 , position of the point of intersection p 0 (x, y, z) of the projection ray with surface (5), p 0 henceforth.Write down distance l 0 of the point p 0 from the center c 0 of the sphere of greatest curvature: To evaluate the test, calculate the predicate: If pred 1 =0, a background color is assigned to the pixel, otherwise count for this projection ray continues.This approach allows one to reduce counting time since there is a lot of background space between the interpolation regions.

Relationships for construction of reference spheres
To simplify notation, assume that the segment p 1 , p 2 is chosen in the previous step.
The vector field of the guides in which, properly, points of the interpolating curve constructed by the method of spherical interpolation will actually lie are defined as the straight lines perpendicular to the straight line connecting two consecutive points p 1 , p 2 in the interpolation region [11].The main feature of the method of spherical interpolation is the use of such quadric as a sphere for constructing a spatial curve of arbitrary shape between two points.The presence of normals to the future curve at each point through which it passes allows one to obtain, along with connectivity (C0), continuity of the first derivative, i.e. smoothness (C1) of the synthesized curve [1,11].In the process of synthesizing image of the curve, perform the following geometric constructions.Draw two spheres (socalled reference spheres) through the ends of a segment of each straight line, for example, through the points p 1 , p 2 .In this case, the center o 1 of one sphere must be located in the line passing through the point p 1 and coinciding with the vector n 1 of the normal at this point.The center o 2 of the second sphere must be in the straight line passing through the point p 2 and coinciding with the vector of the normal n 2 .
The relationships for the equations of these lines have the form: po p n t. = + ⋅ Introduce notation and write the equation for the plane passing through the point (2) perpendicular to this segment ( ) ( )( ) Find joint solution of equations ( 7) for each straight line and (8) relative to t and substitute the obtained values in (7).Thus, radius-vectors for the centers o 1 , o 2 of the reference spheres are obtained.
Write down the scalar values of the radii for the reference spheres: Write down final equations for the reference spheres in a vector form: The reference spheres do not change during the curve synthesis.

5. Relationships for constructing spatial curve
All steps of constructing spatial curve by the method of spherical interpolation are described in detail in [11].Write the equation of the straight line parallel to the vector of the segment p 2 -p 1 and passing through, e. g. the p 1 point: Construct vector field of the guides [11].Write down vectors for each reference sphere: Next, write down for each reference sphere equations of the lines passing through arbitrary points p(t) in segment p 1 , p 2 of the straight line (10) and parallel to the corresponding vectors (11): Substitute (12) into the equations of spheres ( 9) and find values of t 0 at which intersection of the lines (12) with the spheres (9) respectively is done.Let they be 0 p ,p for the first and second sphere, respectively.Make use of [11] for a correct choice of roots.Let they be, for example, 0 11 p and 0 21 p .Further, according to [11], write down relations for the directing vectors: Finally, expression for the radius-vector specifying a point in the constructed curve, e. g. in the segment between points p 1 , p 2 , is written as relationship: where t is a parameter that varies from zero to one in segment p 1 , p 2 .The second term in equation (13) forms the vector field of the guides in which points of the interpolating curve actually lie.When parameter t is changed, linear interpolation of vectors s 11 , s 21 is performed.As a result, a certain ruled surface is formed in which directing vectors perpendicular to the segment p 1 , p 2 lie as it follows from relations ( 11), (12).

6. Construction of the iterative process
In a case if the test (6) yields pred 1 =1, find segment of PR which fell into the region of interpolation.To this end, solve the system of equations ( 3), ( 4) relative to the t parameter.In a general case, solution of intersection with the sphere gives two roots: -t 1 , t 2 .Substitute these roots in equation ( 4) and obtain coordinates of the points of intersection with coordinate system XYZ.Let these be points p(t 1 ), p(t 2 ).Write down the equation of straight line for a part of the PR segment with its ends at these points.Then equation for this straight line coinciding with the PR has the form: In a general case, it is necessary to find at least one point in line ( 14) which closest approaches the constructed curve (13).Calculate these points using an iterative algorithm that determines n 1 orders of the unknown number in each iteration step.In this case, the number of iterations will be equal to: where n is the number of orders of the unknown number.Assume that n and n 1 are multiples.
Hereinafter, to construct an iteration process (IP), refer to the work of one of the authors of this article [13] in which it is proposed to represent parameter t as: where k is the step number of iterations, k∈{1, 2, ...,K}; δ k is the quantum of the k-th step of iterations, δ k =2 -n1•k ; η k is a positive coefficient determining the number of quanta used in the k-th step of iterations.
The goal of each k-th step is definition of a segment in the line (14) (hereinafter, selected segment) within the boundaries of which the result of joint solution of equations ( 13), ( 14) can be found.It is important to note that the selected segment (SS) decreases in 2 n1 in each next step of IP.In this case, joint solution is understood as finding a region of space in which curve (13) and straight line (14) are located most closely (in a particular case, they coincide).Main stages of computation performed in the k-th step of iterations of IP are considered below.
Stage 1. Substitute parameter value in equation ( 14) in this form: where t k-1 is the parameter calculated in a general case in the previous step of IP.Since consideration is started from k=1, t k-1 =t 0 =0 is obtained.Assume that the t parameter in (14) specifies length of segment p(t 2 )-p(t 1 ) in relative units.At this stage, this segment and all subsequent selected segments are divided into 2 n1 equal segments.Denote the radius-vectors of the end points of these equal segments at the k-th step taking into account (14) with k j pr , where j index is introduced for numbering of points bounding equal segments k j pr , where In this case, the quantum value δk=2 -n1 for k=1.Taking into account (14), agree that j index will be counted in a direction from point p(t 1 ) to point p(t 2 ).
Stage 2. Draw planes perpendicular to the segment, e. g. p 1 , p 2 , for which joint solution of equations ( 13), ( 14) is searched through points 1 j pr of the ends of equal segments.Write down equation of these planes for the k-th step: Next, find joint solutions for equations (10) and (19) relative to t for each j at k=1.Denote these solutions as In total, j+1 solutions are obtained.Substituting these solutions in (13) and taking into account relationships ( 7)-( 12), coordinates for j+1 corresponding points in the interpolating curve of segment p 1 , p 2 are obtained.Denote the radius-vectors for the computed points of the interpolating curve (with k=1) as follows: ( ) ( ) ( ) Stage 3. Define the selected segment.To do this, find differences between the radius-vectors ( 17) and ( 20) for all j.Denote the newly obtained difference vectors as follows: Next, find modules k j md of the resulting vectors (21) and sum them in pairs for each j-th segment.Denote these sums as follows: sd md md , where subscripts j and j+1 are initial and final indices, respectively.
Find minimal sum in the resulting set of sums (22).In a general case, such sums can be more than one.Then choose a sum with a minimum j value.The segment in the line (14) with minimal j value and with minimum sum ( 22) is defined as the selected segment.In the given k-th step (or iteration), this segment is the closest to some point of the interpolating curve.
Stage 4. Define scalar factor η k for relationship (16) where (j) k is value of the initial index of the selected segment at the previous stage of the k-th step.Stage 5. Calculate parameter t k in the iterative equation (16) taking into account η k =η 1 determined at the previous stage.Initial conditions at k=1 for the IP are t k-1 =t 0 =0.The obtained value of the parameter in this step of iteration when substituted in (14) makes it possible to calculate radius-vector of the initial point of the selected segment in coordinate system XYZ.
Calculation of all IP steps for stages 1-5 are continued until k=K.In the last step of the algorithm, a selected segment is obtained in the PR.All points of this segment are closest to a certain point of the interpolating curve with an accuracy determined by the number of steps of the IP.

7. The test of performance of the "capture" operation
To determine whether a particular point of the interpolating curve belongs to the corresponding PR, perform a test to know whether this point was got in the PVP.As a test point, the curve (13) point can be taken which corresponds e. g. to the initial index of the selected segment in the PR in the last algorithm step.Let this be in accordance with (20): s( k 0 t ).To perform the test, substitute the value px= =(px 1 +px 3 )/2 in (1) and obtain a set of 4 numbers: Select signs of numbers in (24) and form a set of "standard signs" for the region of space bounded by PVP: Use relationships ( 1) and ( 25) to identify position of any point of the interpolating curve relative to the region of space bounded by PVP.In analogy with (25), write the sign function for a point s( k 0 t ) closest to the selected segment in the PR: To evaluate the test, calculate the predicate using relations (25) and (26):

Discussion of the results: simulation of synthesis of the spatial curve image
Simulation was performed using Wolfram Mathematica mathematical software package.Fig. 2 shows the result obtained in simulation of the image synthesis by ray tracing of the spatial interpolating curve drawn through points p 1 -p 12 (Fig. 1) taking into account the order of their assignment and constructed in accordance with the method of spherical interpolation.

= =
The simulation task consisted of checking provisions stated in the theoretical part, namely: -verification of correctness of work of the visualization algorithm based on the studied iterative process of calculating the point in the projection ray closest to a certain point in the mathematical spatial curve; -verification of the algorithm for constructing points of a spatial curve with its step coinciding with the step of the iterative calculation process which makes it possible to perform the visualization algorithm and plot a curve point in a single pass of the IP.
The simulation results fully confirmed correctness of all theoretical positions set forth in the paper.
The obtained results differ from the known data in such aspects: -application of the simplest quadric, sphere, for interpolation of spatial curves.The obtained curves satisfy the condition of connectedness of the curve, C0, and the condition of continuity of the first derivative, C1.When constructing a spatial curve passing through arbitrarily taken points, it is not necessary to use algebraic polynomials of the third and higher degree; -the proposed iterative process for visualization has a potential of wide parallelling of computations.In the IP algorithm, it is possible to adjust the number of orders of the unknown number determined in a single step, which is limited just by hardware.
As a disadvantage, it should be noted that a rather high performance of computing facilities is necessary for realization of this method, especially when constructing surfaces.This method of synthesis of spatial curve images is the result of earlier studies.It is supposed that further research will be aimed at development of image synthesis by ray tracing of surfaces constructed by the method of spherical interpola-tion as well as reduction of the counting time.The performed studies can be applied in various areas of computer graphics, e. g., in designing visualization systems (VS) for training simulators of vehicles for various purposes, such as aviation training simulators, etc., in making art films using computer graphics, etc.

Conclusions
1. To visualize the spatial curve, an iterative process (IP) was developed for calculating a point in the projection ray closest to some point in a mathematical spatial curve.To establish correspondence of a curve point to a pixel in a computer monitor screen, position of this point was evaluated relative to the region of space bounded by the pyramid of pixel visibility.The proposed IP has potentials for a wide parallelization of computations.
2. An algorithm for constructing points in a spatial curve was developed with its step coinciding with the step of the iterative calculation process which makes it possible to perform visualization algorithm and plot a curve point in one pass of the IP.To this end, the point in the PR and the direction vector of the curve at each step of iteration lie in the same plane perpendicular to the interpolated segment.This approach allows one to determine modulus of the directing vector for a subsequent stage of this iteration step.The proposed interpolation algorithm is based on the simplest algebraic surface, sphere, and does not use algebraic polynomials of the third and higher degrees.
Thus, feasibility of image synthesis by ray tracing of spatial curves constructed by the method of spherical interpolation has been demonstrated.

Fig. 1
presents geometric elements of the problem.

Fig. 1 .
Fig. 1.Geometric elements of the problem the second sphere.Substitute these values into equation (12) and obtain values of coordinates XYZ for each point of intersection.There are two intersection points for each sphere.Let they be ( ) 1-4.7 are performed for each PR.The process of image construction can be materially accelerated if classification of the points of the initial data (p 1 -p 12 ) is carried out in advance, by analogy with [12].