Three-dimensional engine on Excel formulas for dummies

 3r31824. 3r3-31. Three-dimensional engine on Excel formulas for dummies
3r31811.  3r31824.

What turned out 3r3393911. 3r31811.  3r31824. 3r31734.  3r31824. 3r31744. A file with a cube and a torus 3r31800.  3r31824. 3r31744. File with a kettle 3r31800.  3r31824. 3r31744. 3r3342. ObservableHQ laptop with its Excel-file generator
3r31800.  3r31824.
3r31811.  3r31824. In Excel files at the top, you can change the following cells: 3r31811.  3r31824. 3r31811.  3r31824. 3r31734.  3r31824. 3r31744. 3r31746. alpha: 3r31747. horizontal camera rotation in degrees, 3r3-31800.  3r31824. 3r31744. 3r31746. beta: 3r31747. vertical rotation of the camera in degrees, 3r3-31800.  3r31824. 3r31744. 3r31746. dist: distance from the camera to the origin,
 3r31824. 3r31744. 3r31746. fov: "Zoom" camera. 3r31800.  3r31824.
3r31811.  3r31824. To rotate the camera, you need to give Excel the right to change the file. 3r31811.  3r31824. 3r31811.  3r31824. In the case of downloading your Excel-file with ObservableHQ, the cells must be painted manually. You need to select all the small square cells and select “Conditional Formatting” → “Color Scales”. 3r31811.  3r31824. 3r31811.  3r31824.
Ray marching

3r31811.  3r31824. The Ray Marching algorithm was popularized by Iñigo Quilez in 2008 after 3r390. Rendering Worlds with Two Triangles presentations
about a compact three-dimensional engine for the demoscene. 3r31811.  3r31824. 3r31811.  3r31824. After that, Iñigo Quilez created the site Shadertoy , and most of the works sent there use the described method. It turned out that using it you can create photo-realistic scenes, see, for example, 3r-398. this gallery is
. 3r31811.  3r31824. 3r31811.  3r31824. Ray Marching is a very easy-to-implement and efficient algorithm that allows rendering quite complex scenes. Why then is it not used on video cards? The fact is that video cards are sharpened to work with three-dimensional figures consisting of triangles, for which Ray Marching is not so effective. 3r31811.  3r31824. 3r31811.  3r31824.

The principle of the engine

3r31811.  3r31824. 3r31734.  3r31824. 3r31744. The object is described as a function. 3r31800.  3r31824. 3r31744. Match each pixel of the result of the beam leaving the camera. 3r31800.  3r31824. 3r31744. For each ray find the coordinates of the intersection with the object. 3r31800.  3r31824. 3r31744. At the intersection point to determine the color of the pixel 3r31800.  3r31824.
3r31811.  3r31824. I think that in one form or another, all these subtasks are solved in any three-dimensional engine. 3r31811.  3r31824. 3r31811.  3r31824.

Description of the object

3r31811.  3r31824. There are three ways to describe a three-dimensional object: 3r31811.  3r31824. 3r31811.  3r31824. 3r31734.  3r31824. 3r31744. An explicit formula that, by a ray coming out of the camera, returns the point of intersection with the object (or, for example, the direction of the tangent in it). 3r31800.  3r31824. 3r31744. Membership function By a point in space, it tells whether it belongs to an object or not. 3r31800.  3r31824. 3r31744. Real function. For points inside the object, it is negative, outside - positive. 3r31800.  3r31824.
3r31811.  3r31824. This article will use the special case of the third option, called 3r3-331805. signed distance function (SDF) [/b] . 3r31811.  3r31824. 3r31811.  3r31824. The SDF receives a point of space as input and returns the distance to the nearest point of the object. For points inside it is equal to the distance to the boundary of the object with a “minus” sign 3r3-31811.  3r31824. 3r31811.  3r31824.

Finding the intersection of the beam and the object 3r3393911. 3r31811.  3r31824. Suppose we have a beam emanating from a camera, and we want to find its intersection point with an object. 3r31811.  3r31824. 3r31811.  3r31824. Several ways come to mind to find this point:
 3r31824. 3r31811.  3r31824. 3r31734.  3r31824. 3r31744. Go through the points on the ray with some steps. 3r31800.  3r31824. 3r31744. Having a point inside the object and outside, run a binary search to clarify the intersection. 3r31800.  3r31824. 3r31744. Either run any method for finding the roots of the SDF function (which is negative inside the object and positive outside) on the ray. 3r31800.  3r31824.
3r31811.  3r31824. But here we will use another method: Ray Marching . 3r31811.  3r31824. 3r31811.  3r31824. This is a simple algorithm that only works with SDF. 3r31811.  3r31824. 3r31811.  3r31824.
3r3r2202. 3r31820. 3r31811.  3r31824. 3r31811.  3r31824. Let's parameterize a ray by distance from its beginning by the function 3r31737. 3r31739. . 3r31811.  3r31824. Then 37. 3r31739. - this is the camera itself. Here is the algorithm: 3r31811.  3r31824. 3r31811.  3r31824. 3r31734.  3r31824. 3r31744. 3r31737. 3r31739. 3r31800.  3r31824. 3r31744. Repeat 3r31737. 3r31739. times:
 3r31824. 3r31734.  3r31824. 3r31744. 3r31737. 3r31739. 3r31800.  3r31824.
3r31800.  3r31824. 3r31744. If
3r31739. then return 3r31737. 3r31739. as an intersection point, otherwise report that the ray does not intersect the object. 3r31800.  3r31824.
3r31811.  3r31824. Here
3r31739. the number of iterations we can afford. 3r31811.  3r31824. The more 3r31737. 3r31739. the more accurate the algorithm. 3r31811.  3r31824. 3r31811.  3r31824. The number 3r31737. 3r31739. this is the distance from the camera, within which we expect to find the object. 3r31811.  3r31824. 3r31811.  3r31824.
3r31820. 3r31811.  3r31824. 3r31811.  3r31824. 3r31811.  3r31824.
Why does the algorithm work 3r3393911. 3r31811.  3r31824. Does the algorithm always reach the point of intersection with the object (more precisely, it will tend to it)? The object may have a complex shape and its other parts may come close to the beam, preventing the algorithm from converging to the intersection point. In fact, this can not be: other parts of the object will necessarily be at some non-zero distance from the beam (otherwise it would intersect them), which we denote 3r31737. $ 0 "data-tex =" inline "> Then the SDF function will be more than 3r31737. 3r31811.  3r31824. 3r31811.  3r31824.
3r33300. 3r31820. 3r31811.  3r31824. On the other hand, if the algorithm converges to a certain point, then the distance between adjacent iterations tends to zero 3r31737. 3r31739. The SDF (distance to the nearest point of the object) also tends to zero 3r3r171737. 3r31739. in the limit of 3r31737. 3r33333. 3r31739. 3r31737. 3r31739. the algorithm converges to the point of intersection of the beam with the object. 3r31811.  3r31824. 3r31811.  3r31824.
Getting the color of the pixel at the intersection of r3r3911. 3r31811.  3r31824. Imagine that for each pixel we found an intersection point with an object. We can draw these values ​​(that is, the distance from the camera to the point of intersection) directly and get these images: 3r31811.  3r31824. 3r31811.  3r31824. . According to Phong, the resulting color consists of three components: background, specular and diffuse. Given the fact that we are not striving for photo-realistic renders, it suffices to use only the diffuse component. The formula for this component follows from 3r33339. Lambert Act
and claims that the color of the pixel is proportional to Cosine the angle between the normal to the surface and the direction to the light source. 3r31811.  3r31824. 3r31811.  3r31824. Further, to simplify the calculations, assume that the light source and the camera are the same. Then, in essence, we need to find the sine of the angle between the beam emanating from the camera and the surface of the object:
 3r31824. 3r31811.  3r31824.
3r33352. 3r31820. 3r31811.  3r31824. Seeking angle
3r33357. 3r31739. I marked one arc in the drawing. The value of its sine is labeled
3r33360. 3r31739. . 3r31811.  3r31824. 3r31811.  3r31824. Usually, when using Ray Marching method, to find the normal to the object, do the following: consider the SDF value at six points (it is easy to reduce the number of points to four) near the intersection point and find the gradient of this function, which should coincide with the normal. It seemed to me that this is too much calculation for Excel, and I would like to find the desired angle easier. 3r31811.  3r31824. 3r31811.  3r31824. If you look at the rate of convergence of the algorithm, you can see that if the angle between the beam and the object is straight, then one iteration is enough. If the angle is small, then the algorithm will converge very slowly. 3r31811.  3r31824. 3r31811.  3r31824. Is it possible to get information about the angle to the surface based on the rate of convergence of the algorithm? If so, no additional calculations will be required at all: it is enough to analyze the values ​​of the previous iterations. 3r31811.  3r31824. 3r31811.  3r31824. Draw a drawing. Denote
3r33399. 3r31739. and 3r31737. 3r3402. 3r31739. - points obtained at adjacent iterations of the algorithm. Suppose that the points are close enough to the object, that it can be replaced with a plane, the angle with which we want to find. Let
3r31739. , 3r31737. 3r33333. 3r31739. - distance from points
3r33399. 3r31739. and 3r31737. 3r3402. 3r31739. up the plane. Then, according to the algorithm, the distance is between 3r31737. 3r33399. 3r31739. and 3r31737. 3r3402. 3r31739. equals 3r31737. 3r3405. 3r31739. . 3r31811.  3r31824. 3r31811.  3r31824. 3r33411. 3r31811.  3r31824. 3r31811.  3r31824. On the other hand, if we denote
3r31739. - the point of intersection of the beam and the figure, then 3r31811.  3r31824. 3r31737. 3r33434. 3r31739. , and 3r31737. 3r33434. 3r31739. therefore
 3r31824.
3r31737. 3r33334. 3r31739.
3r31811.  3r31824.
3r31737. 3r31739.
3r31811.  3r31824. That is, the pixel intensity is equal to one minus the ratio of the SDF functions of adjacent iterations! 3r31811.  3r31824. 3r31811.  3r31824.
We describe simple shapes

3r31811.  3r31824. Examples of SDFs for a sphere, a cube, and a torus: 3r31811.  3r31824. 3r31680.  3r31824. 3r31693.  3r31824. 3r31638. 3r31737. 3r33434. 3r31739. 3r31721.  3r31824. 3r31638. 3r33434. 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31638. 3r31737. 3r33477. 3r31739. 3r31721.  3r31824. 3r3612. 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31638. 3r31737. 3r31739. 3r31721.  3r31824. 3r31638. 3r31721.  3r31824. 3r31723.  3r31824. 3r31725. 3r31811.  3r31824. Figures can be moved and compressed along the axes:
 3r31824. 3r31680.  3r31824. 3r31693.  3r31824. 3r31638. 3r31737. 3r33512. 3r31739. 3r31721.  3r31824. 3r3612. 3r? 3517. 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31638. 3r31737. 3r33526. 3r31739. 3r31721.  3r31824. 3r31638. 3r? 3531. 3r31721.  3r31824. 3r31723.  3r31824. 3r31725. 3r31811.  3r31824. Figures can also be combined, intersected and subtracted. That is, the SDF supports basic operations 3r33539. constructive solid geometry
: 3r31811.  3r31824. 3r31680.  3r31824. 3r31693.  3r31824. 3r31638. 3r31737. 3r3-3549. 3r31739. 3r31721.  3r31824. 3r3612. 3r35454. 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31638. 3r31737. 3r33535. 3r31739. 3r31721.  3r31824. 3r31638. 3r3-3568. 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31638. 3r31737. 3r33577. 3r31739. 3r31721.  3r31824. 3r31638. 3r33582. 3r31721.  3r31824. 3r31723.  3r31824. 3r31725. 3r31811.  3r31824. Attentive chiThe teller might have noticed that for some shapes (for example, a cube), as well as for some operations (for example, compression), the above formulas do not always return the distance to the nearest point of the object, that is, SDF is not formally. Nevertheless, it turned out that they can still be fed to the input of the SDF engine and it will correctly display them. 3r31811.  3r31824. 3r31811.  3r31824. This is a small part of what you can do with the SDF, a full list of figures and operations can be found on page 3r-5394. www.iquilezles.org/www/articles/distfunctions/distfunctions.htm
3r31811.  3r31824. 3r31811.  3r31824. Combining all the above formulas, we get the first figure:
 3r31824. 3r31680.  3r31824. 3r31693.  3r31824. 3r31638. 3r31737. 3r3608. 3r31739. 3r31721.  3r31824. 3r3612. 3r33613. 3r31721.  3r31824. 3r31723.  3r31824. 3r31725. 3r31811.  3r31824.

The formula of the kettle is

3r31811.  3r31824. With a kettle a little harder: you need a plan 3r318111.  3r31824. 3r31811.  3r31824.  3r31824. 3r31811.  3r31824. 3r31737. 3r31739. 3r31811.  3r31824. 3r31811.  3r31824. And we select the desired angle. Done: 3r31811.  3r31824. 3r31811.  3r31824.
3r3650. 3r31820. 3r31811.  3r31824. 3r3654. 3r31811.  3r31824.

Camera 3r3393911. 3r31811.  3r31824. All that is left for us is to find the corresponding beam in space, leaving the camera, for a given pixel on the screen. More specifically, you must be able to find the point of this beam by distance from the camera. That is, we need the function 3r31737. 3r31739. where 37. 3r3904. 3r31739. - pixel coordinates, and
3r301901. 3r31739. - distance from the beginning of the beam (camera). 3r31811.  3r31824. 3r31811.  3r31824. For convenience of calculation, the coordinates of the pixels will be set relative to the center of the screen. Given that the screen consists of 3r3173737. 3r3675. 3r31739. lines and 3r31737. 3r3678. 3r31739. columns, we expect coordinates within 3r31737. . Thus we get three variables at the entrance: the angle 3r31739. , angle 3r31737. 3r33737. 3r31739. and distance 3r31737. 3r31739. . They determine both the position and the direction of the camera (the camera always looks at the origin of coordinates). 3r31811.  3r31824. 3r31811.  3r31824. With the help of 3r3726. WolframAlpha
Find the rotation matrix: 3r31811.  3r31824. 3r31811.  3r31824.
3r31737. 3r31739.
3r31811.  3r31824. 3r31811.  3r31824. If you apply it to a vector 3r31737. 3r3744. 3r31739. , we get the coordinates of the camera (do not ask me where the minus disappeared):
 3r31824. 3r31811.  3r31824.
3r31737. 3r3754. 3r31739.
3r31811.  3r31824. 3r31811.  3r31824. 3r3761. 3r31811.  3r31824. 3r31811.  3r31824. Subsequent calculations will be specific to the perspective projection. The main object is 3r31716. screen 3r31717. (it is red in the figure, italic in the text). This is an imaginary rectangle at some distance in front of the camera, having, as you might guess, a one-to-one correspondence with the pixels of a regular screen. The camera is actually just a point with coordinates
3r3769. 3r31739. . The rays corresponding to the pixels begin at the point of the camera and pass through the corresponding point screen 3r3r171717. . 3r31811.  3r31824. 3r31811.  3r31824. At 3r31716. screen 3r3r171717. No exact location and size. More precisely, they depend on the distance to the camera: if you move the screen further, you will need to do more. Therefore, we agree that the distance from the camera to the screen is 1. Then we can calculate the value of the vector
3r33780. 3r31739. connecting the camera point and the center of the screen (it is the same as the camera center, only multiplied not by 3r31737. 3r3786. 3r31739.):
 3r31824. 3r31811.  3r31824.
3r31737. 3r31739.
3r31811.  3r31824. 3r31811.  3r31824. Now we need to determine the size of screen 3r3r171717. . It depends on the viewing angle of the camera, which is measured in degrees and corresponds to what is called “zoom” in video cameras. The user sets it using the
variable. 3r31739. (field of view). Since the screen is not square, it is necessary to clarify what is meant by the vertical viewing angle. 3r31811.  3r31824. 3r31811.  3r31824. So, to determine the height of the screen, you need to find the base of an isosceles triangle with a vertex angle 3r31737. 3r31739. and height 1: recalling trigonometry, we get 3r3r171737. 3r33816. 3r31739. . Based on this, you can determine the size of one pixel at screen 3r31717. : 3r31811.  3r31824.
3r31737. 3r31739.
3r31811.  3r31824. 3r31811.  3r31824. Next, applying the rotation matrix to the vectors 37. 3r31739. and 3r31737. 3r33837. 3r31739. , we get the vector 3r31737. 3r33840. 3r31739. and 3r31737. 3r33843. 3r31739. , specifying horizontal and vertical directions screen 3r3r171717. (to simplify the calculations, they are also pre-multiplied by 3r31737. 3r3-34848.
):
 3r31824.
3r31737. 3r33856. 3r31739.
3r31811.  3r31824.
3r31737. 3r33865. 3r31739.
3r31811.  3r31824. Thus, we now have all the components to find the direction of the beam coming out of the camera and corresponding to the pixel with coordinates 3r31737. 3r3904. 3r31739. 3r31811.  3r31824.
3r31737. 3r31739.
3r31811.  3r31824. 3r31811.  3r31824. It is almost what you need. Only it is necessary to take into account that the beginning of the beam is at the point of the camera and that the direction vector must be normalized: 3r31811.  3r31824.
3r31737. 3r31739.
3r31811.  3r31824. So we got the desired function 3r31737. 3r31739. which returns the point of the beam at a distance of
3r301901. 3r31739. from its beginning, I correspond to a pixel with coordinates
3r3904. 3r31739. . 3r31811.  3r31824. 3r31811.  3r31824.
Excel

3r31811.  3r31824. The Excel file that results is a book consisting of> 6 sheets: 3r31811.  3r31824. 3r31811.  3r31824. 3r31734.  3r31824. 3r31744. The first sheet R contains everything the end user needs: cells with parameters 3r31737. 3r32424. 3r31739. , as well as cells with the result, painted on a black and white scale. 3r31800.  3r31824. 3r31744. Sheet N preempts the values ​​of
3r33932. 3r31739. . 3r31800.  3r31824. 3r31744. Sheets X , Y , Z calculate the coordinates
3r33944. 3r31739. vectors
3r31739. and 3r31737. 3r33939. 3r31739. . 3r31800.  3r31824. 3r31744. Sheets i1 , i2 , contain iterations of the Ray Marching algorithm for each pixel. 3r31800.  3r31824.
3r31811.  3r31824. All sheets are built according to the same scheme:
 3r31824. 3r31811.  3r31824. 3r31739. . In the tables at the end of the article, these cells are designated as 3r31746. ** 3r31800.  3r31824. 3r31744. In sheets X , Y and 3r? 31805. Z [/b] intermediate calculations by rows and columns (orange) are also used. For them, reserved the second row and the first column. In the tables at the end of the article, these boxes are labeled 3r31746. A * 3r31747. and 3r31746. * 2 . The idea is that to store the values ​​of r3r31737. 3r31739. over all pixels it is not necessary to add three more sheets (for each of the coordinates) since the formula for its calculation is divided into the sum of two components: 3r31811.  3r31824.
3r31737. 3r31739.
3r31811.  3r31824. Thus, we predict the first addendum in columns and the second in rows, and when we need to get the value 3r31737. 3r31739. , we add the cell value for row
3r31739. and column 3r31737. 3r31739. . 3r31811.  3r31824. 3r31800.  3r31824.
3r31811.  3r31824. 3r31680.  3r31824. 3r31693.  3r31824. 3r31684. Sheet R 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31630.
I1
3r31721.  3r31824. 3r31495. rows:
 3r31824. 3r31638. 3r31746. 50 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695.
V1 3r31793. 3r31721.  3r31824. 3r31695. cols: 3r31721.  3r31824. 3r31638. 3r31746. 77 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695.
AI1 3r31793. 3r31721.  3r31824. 3r31695. fov:
 3r31824. 3r31638. 3r31746. 39 3r31747. 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695.
AV1 3r31793. 3r31721.  3r31824. 3r31695. dist:
 3r31824. 3r31638. 3r31746. ???r31747. 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695.
BI1 3r31793. 3r31721.  3r31824. 3r31695. alpha: 3r31721.  3r31824. 3r31638. 3r31746. 35 3r31747. 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695.
BV1
3r31721.  3r31824. 3r31695. beta: 3r31721.  3r31824. 3r31638. 3r31746. 20 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695. 3r31716.
**
3r3171717. 3r31721.  3r31824.
3r31746. = IF (i14! 3r31717. XN 3r31717. - i13! 3r31717. XN 3r3r1717. 3r31517. XN 3r3аr17. ))) 3r31747. 3r31721.  3r31824. 3r31723.  3r31824. 3r31725. 3r31811.  3r31824. 3r31811.  3r31824. 3r31680.  3r31824. 3r31693.  3r31824. 3r31684. Sheet N 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31630.
I1
3r31721.  3r31824. 3r316335. pixelSize:
 3r31824. 3r31638. 3r31746. = TAN (R! AI1 /2) /(R! I1 /2) 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695. 3r31716.
**
3r3171717. 3r31721.  3r31824.
3r31746. = 1 /ROOT (DEGREE (X! A N 3r31717. + X! 3r3171716. X 3r3-3171717. 2; 2) + DEGREE (Y! A 3rr31716. N ; 2) + RELEASED CURDELETR); 3r31717. + Z! 3r31716. X 3r3r171717. 2; 2)) 3r31747. 3r31721.  3r31824. 3r31723.  3r31824. 3r31725. 3r31811.  3r31824. 3r31811.  3r31824. 3r31680.  3r31824. 3r31693.  3r31824. 3r31684. Sheet X 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31630.
I1
3r31721.  3r31824. 3r31495. camX:
 3r31824. 3r31638. 3r31746. = R! AV1 * COS (R! BV1) * COS (R! BI1) 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  
3r31695.
V1 3r31793. 3r31721.  3r31824. 3r31695. ux: 3r31721.  3r31824. 3r31638. 3r31746. = -N! I1 * SIN (R! BI1) 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695.
AI1 3r31793. 3r31721.  3r31824. 3r31695. vx: 3r31721.  3r31824. 3r31638. 3r31746. = N! I1 * SIN (R! BV1) * COS (R! BI1) 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695.
AV1 3r31793. 3r31721.  3r31824. 3r31695. x0:
 3r31824. 3r31638. 3r31746. = -COS (R! BV1) * COS (R! BI1) 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695. 3r31716.
A * 3r31793. 3r3171717. 3r31721.  3r31824.
3r31746. = AI1 * (LINE () - 2 - (R! I1 + 1) /2) 3r3171747. 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695. 3r31716.
* 2
3r3171717. 3r31721.  3r31824.
3r31746. = AV1 + V1 * (COLUMN () - 1 - (R! V1 + 1) /2) 3r31747. 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695. 3r31716.
**
3r3171717. 3r31721.  3r31824.
3r31746. = ( Z 2 + A N ) * N! 3r31716. Z
3r31716. N
3r31747. 3r31721.  3r31824. 3r31723.  3r31824. 3r31725. 3r31811.  3r31824. 3r31811.  3r31824. 3r31680.  3r31824. 3r31693.  3r31824. 3r31684. Sheet Y 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31630.
I1
3r31721.  3r31824. 3r31495. camY:
 3r31824. 3r31638. 3r31746. = R! AV1 * SIN (R! BV1) 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695.
V1 3r31793. 3r31721.  3r31824. 3r31695. vy:
 3r31824. 3r31638. 3r31746. = -N! I1 * COS (R! BV1) 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695.
AI1 3r31793. 3r31721.  3r31824. 3r31695. y0:
 3r31824. 3r31638. 3r31746. = -SIN (R! BV1) 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695. 3r31716.
A * 3r31793. 3r3171717. 3r31721.  3r31824.
3r31746. = AI1 + V1 * (STRING () - 2 - (R! I1 + 1) /2) 3r31747. 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695. 3r31716.
**
3r3171717. 3r31721.  3r31824.
3r31746. = A N * N! 3r31716. Z
3r31716. N 3r31747. 3r31721.  3r31824. 3r31723.  3r31824. 3r31725. 3r31811.  3r31824. 3r31811.  3r31824. 3r31680.  3r31824. 3r31693.  3r31824. 3r31684. Sheet Z 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31630.
I1
3r31721.  3r31824. 3r31495. camZ:
 3r31824. 3r31638. 3r31746. = R! AV1 * COS (R! BV1)) * SIN (R! BI1) 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695.
V1 3r31793. 3r31721.  3r31824. 3r31695. uz: 3r31721.  3r31824. 3r31638. 3r31746. = N! I1 * COS (R! BI1) 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695.
AI1 3r31793. 3r31721.  3r31824. 3r31695. vz: 3r31721.  3r31824. 3r31638. 3r31746. = N! I1 * SIN (R! BV1) * SIN (R! BI1) 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695.
AV1 3r31793. 3r31721.  3r31824. 3r31695. z0:
 3r31824. 3r31638. 3r31746. = -COS (R! BV1) * SIN (R! BI1) 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695. 3r31716.
A * 3r31793. 3r3171717. 3r31721.  3r31824.
3r31746. = AI1 * (LINE () - 2 - (R! I1 + 1) /2) 3r3171747. 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695. 3r31716.
* 2
3r3171717. 3r31721.  3r31824.
3r31746. = AV1 + V1 * (COLUMN () - 1 - (R! V1 + 1) /2) 3r31747. 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695. 3r31716.
**
3r3171717. 3r31721.  3r31824.
3r31746. = ( Z 2 + A N ) * N! 3r31716. Z [/i] 3r31716. N [/i] 3r31747. 3r31721.  3r31824. 3r31723.  3r31824. 3r31725. 3r31811.  3r31824. 3r31811.  3r31824. 3r31680.  3r31824. 3r31693.  3r31824. 3r31684. Sheet i1 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31630.
I1
3r31721.  3r31824. 3r316335. dist0:
 3r31824. 3r31638. 3r31746. = formula ( X! I? Y! I? Z! I1 ) 3r31747. 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695. 3r31716.
**
3r3171717. 3r31721.  3r31824.
3r31746. = formula (3r3-31808. X! I1 + X! XN 3r3r17717. * I? Y! I1 + Y! 3r3171716. XN * I? Z! I1 + Z! 3r317166 .166 3r31747. 3r31721.  3r31824. 3r31723.  3r31824. 3r31725. 3r31811.  3r31824. 3r31811.  3r31824. 3r31680.  3r31824. 3r31693.  3r31824. 3r31684. Sheets i2 , i3 3r31808. , 3r31721.  3r31824. 3r31723.  3r31824. 3r31693.  3r31824. 3r31695. 3r31716.
**
3r3171717. 3r31721.  3r31824.
3r31746. = formula ( X! I1 + X! XN * i *! 3r3r171716. XN [/i] , Y! I1 + Y! 3r31717. * i * 3r3171716. Z! 3r3171716. XN [/i] * I *! 3r3r17116. XN 3r3r171717. 3r3-331805.) 3r3-331808. 3r31747. 3r31721.  3r31824. 3r31723.  3r31824. 3r31725. 3r31811.  3r31824. 3r31811.  3r31824. Notes: 3r31811.  3r31824. 3r31811.  3r31824. 3r31734.  3r31824. 3r31744. Since in Excel calculations are made in radians, the arguments of all trigonometric functions are multiplied by 3r31737. 3r31738. 3r31739. (Excel for this is a function 3r31746. RADIANS 3r3171747.). In order not to confuse the formulas, I removed these multiplications in the tables above. 3r31800.  3r31824. 3r31744. Where it says 3r31746. formula , you need to insert one of these formulas:
 3r31824. 3r31811.  3r31824.
Formula of a cube with a torus to Excel

3r31824. MIN (
MAX (
ABS (x) - 0.? ABS (y) - 0.? ABS (z) - 0.? 3r31824. -SQRT (POWER (x, 2) + POWER (y, 2) + POWER ( z, 2)) + ???r3r31824.),
SQRT (POWER (SQRT (POWER (x - 0.2? 2) + POWER (z - 0.2? 2)) - 0.2? 2) + POWER (y, 2)) - ??? r3r31824.) R3r31824. 3r31793. 3r31811.  3r31824. 3r31820. 3r31820. 3r31811.  3r31824.
Formula teapot for Excel

3r31824. MIN (
SQRT (POWER (SQRT (POWER (x, 2) + POWER (z, 2)) - 0.? 2) + POWER (y - 0.1? 2)) - 0.0? 3r31824. SQRT (POWER (x, 2) + POWER (y, 2) * 2.5 + POWER (z, 2)) - 0.? 3r31824. MAX (
X + y - ??? - ??? - 0.?
- (y) + ??? - 0.?
.SQRT (POWER (SQRT (POWER (x - 0.5? 2) + POWER (y - 0.0? 2)) - 0.? 2) + POWER (z - 0.? 2)) - ???r31824.), 3r3r2424. MAX (
- (- (y) + ??? - 0.1), 3r3-31824. SQRT (POWER (SQRT (POWER (x - 0.3? 2) + POWER (y - 0.0? 2)) - 0.? 2) + POWER (z - 0.? 2)) - ???r3r31824.),
SQRT (POWER (x, 2) + POWER (y - 0.2? 2) + POWER (z, 2)) - ???r31824.) 3r3-32424. 3r31793. 3r31811.  3r31824. 3r31820. 3r31820. 3r31811.  3r31824. 3r31800.  3r31824.
3r31811.  3r31824. How this article correlates with article 3r3-31806. “3D engine written in MS Excel formulas” 3r3-31807. ? 3r31811.  3r31824. 3r31811.  3r31824. That engine is only suitable for rendering mazes and ellipsoids. One-dimensional Raycaster is used, from which data stripes are created up and down creating the illusion of walls. But there is implemented a full-fledged game logic, here the goal is only a three-dimensional engine. 3r31820. 3r31824. 3r31824. 3r31824. 3r31817. ! function (e) {function t (t, n) {if (! (n in e)) {for (var r, a = e.document, i = a.scripts, o = i.length; o-- ;) if (-1! == i[o].src.indexOf (t)) {r = i[o]; break} if (! r) {r = a.createElement ("script"), r.type = "text /jаvascript", r.async =! ? r.defer =! ? r.src = t, r.charset = "UTF-8"; var d = function () {var e = a.getElementsByTagName ("script")[0]; e.parentNode.insertBefore (r, e)}; "[object Opera]" == e.opera? a.addEventListener? a.addEventListener ("DOMContentLoaded", d,! 1): e.attachEvent ("onload", d ): d ()}}} t ("//mediator.mail.ru/script/2820404/"""_mediator") () (); 3r31818. 3r31824. 3r31820. 3r31824. 3r31824. 3r31824. 3r31824.
+ 0 -

Add comment