Monday, August 14, 2017

new-sample-data-repo

OK, great news, a new version of the application is available from the Windows 10 Store. And I also have created a sample data repository on GitHub. With the initial commit, I posted some text data files. I know that I will have to fine tune and update these files in the future. At least they are at GitHub now where they belong. The reason why I think they may need an update is that I have many branches of the application with a different set of features. And I had to slightly change samples to work with the feature reduced application.

There is a feature I like very much, you can embed or imprint the model text data into a screenshot of the rendered image. I will just modify the red channel of the pixels in the png image, starting at the top row. Then you can drop the image on the drop target of the application, and the application will load the model data. What you get is the reproduced image, fully alive within the application.

Today I wanted to create new images with imprinted data and post them to the sample-data repository. I used the text data files from the repo, dropped them on the application. Then I resized the application to a 512 pixels square format and executed the CopyImprintedBitmap action, which will put an image into the clipboard. Then I pasted into Microsoft Paint and saved as png with the same name as the text data file. In a way, I ate my own dogfood.

And, you may have guessed it, I am now ready to write about the problems.

In the full application, I have implemented actions that will resize the window to a specific size. Many of the icon sizes and photo formats and mobile device form factor sizes are available, including the 512 pixels square. In the published app, I have removed that feature. I should perhaps say that I have chosen a version for publication which is clean and lean and sandboxed. Yes, the end user running the published app can produce the image with imprinted data. It will have the size of the application window when the action was executed. When the image will be resized in another program, the imprinted data will be lost though. You have to set the size of the application window before you create the image. That is why I used the full featured version to do that. I made a note and will probably add the feature to the published app.

Dropping the imprinted image worked great, for the first two images. The third one did not show as expected. But I found out why. Not sure if I should call it a bug or an issue. I think I will update the published app, so that there is no difference between the full internal and sandboxed published app.

The third image, Herz-01, was using scene 1 instead of scene 3. This means that just one spring is used in the computation. The difference was FaktorEQ. The published app will run all computations on the GPU. It does not contain the code which evaluates the model on the CPU. And that is why FaktorEQ was always the same, and did not change as it usually does when another scene is selected.

FaktorEQ will be used for scaling. It makes sense when it is different for each scene. But it does not have to. There are several ways to compensate for it, to achieve it through different means. The test sample worked perfectly with the published app, but I now remember that I had tweaked it to do so. Obviously, in the future the samples should work everywhere the same. I changed the code and it will be in the next published version.

There have been at least two reasons in the past why samples needed to be tweaked, the other one being the projection. Delphi does not do orthographic projection out of the box. And when you run without a patched version of the FMX library, you do not have it. It is desirable to sometimes run without the patched FMX units. So the issues with a unified set of example data is not always related to internal barriers.

I am starting out with GitHub and I am keeping it simple and I expect to make mistakes. Today I uploaded a new sample data file, Herz-02.txt, instead of changing Herz-01.txt to reflect the latest good version. The odd situation is that I have uploaded an image to the sample-data repository which does not work perfectly with the current app.

Resolution: I will recycle the Herz-01 sample in the future to show another good-looking heart, and maybe add the corresponding image to the imprinted sub-directory.

So, good news, the app is out, the sample data repository is up and running, and a future version of the app will be even better. You can use imprinted samples and you can create them. Try them out, they are cool.

(The text data files are smaller though.)