Canvas is cool! - page 92

 
Nikolai Semko #:

Nikolai, is it appropriate to ask DX questions here? I need help.

I've done some tinkering with the standard terminal codes, which demonstrate the possibilities of 3D graphics. I removed morphing, of course, it's clumsy.

The question is this, I need to draw points on the surface when optimising the test function, I can't figure out how to do it.

It should turn out something like this:

Files:
 
Nikolai Semko #:

Personally, I need kanvas first of all to develop complex algorithms. Without intermediate visualisations of processes and data, it is much harder and longer to do it.

Indeed, at some stages of development it may be necessary to visualise the processes

 
Andrey Dik #:

Nikolai, is it appropriate to ask DX questions here? I need help.

I've done some tinkering with the standard terminal codes, which demonstrate the possibilities of 3D graphics. I removed morphing, of course, it's clumsy.

The question is this, I need to draw points on the surface when optimising the test function, I can't figure out how to do it.

It should turn out something like this:

Well, if you need points in space with coordinates x,y,z, then everything is simple and without DirectX and OpenCL( although with them will be more productive of course).
Maximum close to this topic in this example:
h ttps://www.mql5.com/ru/forum/227736/page72#comment_25130501
 
Nikolai Semko #:
Well, if you need points in space with coordinates x,y,z, then everything is simple and without DirectX and OpenCL (although with them will be more productive of course).
Maximum close to this topic in this example:
Thanks, I will try it. I'll let you know later what I got.
 
Andrey Dik #:
Thanks, I'll give it a try. I will report later on what I got.
If there are several tens of thousands of points, there should be no lags, if there are hundreds of thousands of points, it is better to do the calculation part using OpenCl.
The most resource-intensive are trigonometric functions (sin, cos). So it makes sense to use your own tables of these functions in case of lags, as I realised in the first example of this branch.
 
Nikolai Semko #:
If there are several tens of thousands of points, there should be no lags, if there are hundreds of thousands, it is better to do the calculation part using OpenCl.
The most resource-intensive are trigonometric functions (sin, cos). So it makes sense to use your own tables of these functions in case of lags, as I realised in the first example of this branch.
I'm afraid that with a small number of points a continuous surface will not work, it will look like a sieve.
I think I understand the principle in the example, I will show you what I got.
 
Andrey Dik #:
I'm afraid that with a small number of points a continuous surface won't work, it will look like a sieve.
I understand the principle in the example, I'll show you what I got.

Yes, unfortunately my fears were justified.


 
Andrey Dik #:

Yes, the fears were unfortunately justified.


Send me your array of 3d points via FileWriteArray
 
Nikolai Semko #:
Drop me your array of 3d points via FileWriteArray
I'm not sure how to do it, but the surface formula is like this:

double Z (double x, double y)
  {
    double res =
    20.0 + x*x + y*y - 10.0 * cos (2.0 * M_PI * x) - 10.0 * cos (2.0 * M_PI * y)
    - 40.0  * exp (-(pow (x - 1.0, 2) + y*y) / 0.1)
    + 200.0 * exp (-(pow (x + M_PI * 0.47, 2) + pow (y - M_PI * 0.2, 2)) / 0.1)  //global max
    + 100.0 * exp (-(pow (x - 0.5, 2) + pow (y + 0.5, 2)) / 0.01)
    - 60.0  * exp (-(pow (x - 1.5, 2) + pow (y - 2.0, 2)) / 0.02)                //global min
    - 50.0  * exp (-(pow (x + 1.3, 2) + pow (y + 0.2, 2)) / 0.5)
    + 60.0  * exp (-(pow (x - 1.5, 2) + pow (y + 1.5, 2)) / 0.1);

    return res;
  }
 
Andrey Dik #:
I am not sure how to do it, but the surface formula is like this:

.

Andrei, do you just want to get a picture or do you want to get a picture in MQL5?
I can easily visualise it, but there are more advanced tools for visualisation.
For example, here is your formula as it looks on this resource:
https://www.desmos.com/3d/887356da26.

Reason: