Научная анимация на основе Asymptote
- Авторы: Геворкян М.Н.1, Королькова А.В.1, Кулябов Д.С.1,2
-
Учреждения:
- Российский университет дружбы народов
- Объединённый институт ядерных исследований
- Выпуск: Том 31, № 2 (2023)
- Страницы: 139-149
- Раздел: Статьи
- URL: https://journals.rudn.ru/miph/article/view/35110
- DOI: https://doi.org/10.22363/2658-4670-2023-31-2-139-149
- EDN: https://elibrary.ru/XKNIYV
- ID: 35110
Цитировать
Полный текст
Аннотация
В статье рассматривается универсальный способ создания анимации с помощью языка для создания векторной графики Asymptote. В сам язык Asymptote встроена библиотека для создания анимации, однако практическое её использование осложнено крайне кратким описанием в официальной документации и нестабильной работой существующих примеров. Целью статьи является устранение данного пробела. Излагаемый нами способ основывается на создании PDF-файла с кадрами с помощью Asymptote с дальнейшей конвертацией его в набор PNG-изображений и склейкой их в видео с помощью FFmpeg. Все этапы подробно описываются, что даёт возможность читателю использовать изложенный метод, не будучи знакомым с используемыми утилитами.
Ключевые слова
Полный текст
1. Introduction In this paper we study the creation of animation animation using the vector graphics language Asymptote [1-4]. Asymptote is an interpreted language, that is a translator into the PostScript vector graphics language. Designed to create vector images for mathematical publications. It is closely integrated with the TEX system and is an integral part of the TEX Live [5] distribution. It has a C-like syntax, supports the creation of functions, custom data structures, and comes with an extensive set of modules for various tasks. Unlike PGF/TikZ [6], Asymptote is more imperative, so it is easier to implement complex program logic on it. In the official documentation of this language, only a few paragraphs are devoted to the animation creation process and the user is referred to the source code examples located in the animations directory. Asymptote creates animation in two steps. At the first step, a multi-page PDF-file is created containing images that will become frames of future animation. Then, using the external utility ImageMagick [7] (command convert), this PDF-file is converted into a GIF image. If the ImageMagick utility is not installed on the user’s system, all examples will stop at creating a multi-page PDF-file with a set of images and a GIF image with animation will not be received. In this article, we are considering a universal way to create animation in video format using the ffmpeg [8, 9] and Ghostscript [10] utilities. All external programs will be called explicitly from the command line. With the help of Asymptote, only a multi-page PDF-file with frames for the future video will be created. The reader should be familiar with the basic capabilities of the Asymptote language. For an introduction to the basics of the language, we recommend the manual [11]. The information from it will be enough to understand this work. As an example, we chose the animation of the process of constructing epitrochoids and hypotrochoids. In the first part of the work, we will recall the definitions of these curves, some of their properties and reduce their construction to a composition of two rotations. In the second part of the article, we will describe in detail the implementation of their construction using Asymptote. And in the third part we will focus on the technical side of the issue and describe the process of creating a multi-page PDF-file, converting it into PNG images using Ghostscript and converting these images into video using ffmpeg. 2. Task description Consider the task of animating the process of constructing cycloidal curves, namely hypotrochoids and epitrochoids. We will not use the parametric equation of these curves, but will reduce everything to the composition of two rotations applied to the starting point of the curve. This will better illustrate the capabilities of the Asymptote language. 2.1. Definition of epitrochoids Epitrochoid is defined as a trajectory plotted by a fixed pointОб авторах
М. Н. Геворкян
Российский университет дружбы народов
Email: gevorkyan-mn@rudn.ru
ORCID iD: 0000-0002-4834-4895
Candidate of Sciences in Physics and Mathematics, Associate Professor of Department of Applied Probability and Informatics
ул. Миклухо-Маклая, д. 6, Москва, 117198, РоссияА. В. Королькова
Российский университет дружбы народов
Email: korolkova-av@rudn.ru
ORCID iD: 0000-0001-7141-7610
Candidate of Sciences in Physics and Mathematics, Associate Professor of Department of Applied Probability and Informatics
ул. Миклухо-Маклая, д. 6, Москва, 117198, РоссияД. С. Кулябов
Российский университет дружбы народов; Объединённый институт ядерных исследований
Автор, ответственный за переписку.
Email: kulyabov-ds@rudn.ru
ORCID iD: 0000-0002-0877-7063
Doctor of Sciences in Physics and Mathematics, Professor of the Department of Applied Probability and Informatics of Peoples’ Friendship University of Russia named after Patrice Lumumba (RUDN University); Senior Researcher of Laboratory of Information Technologies, Joint Institute for Nuclear Research
ул. Миклухо-Маклая, д. 6, Москва, 117198, Россия; ул. Жолио-Кюри, д. 6, Дубна, Московская область, 141980, РоссияСписок литературы
- O. Shardt and J. C. Bowman, “Surface parameterization of nonsimply connected planar Bézier regions,” Computer-Aided Design, vol. 44, no. 5, 484.e1-484.e10, May 2012. doi: 10.1016/j.cad.2011.05.010
- J. C. Bowman, “Asymptote: Interactive TEX-aware 3D vector graphics,” TUGboat, vol. 31, no. 2, pp. 203-205, 2010.
- J. C. Bowman and A. Hammerlindl, “Asymptote: A vector graphics language,” TUGboat, vol. 29, no. 2, pp. 288-294, 2008.
- J. C. Bowman. “Asymptote: The Vector Graphics Language.” (May 2023), [Online]. Available: https://asymptote.sourceforge.io/.
- “TeX Live.” (2023), [Online]. Available: https://www.tug.org/texlive/.
- T. Tantau and H. Menke. “PGF/TikZ.” (2023), [Online]. Available: https://ctan.org/pkg/pgf.
- “ImageMagick.” (Jun. 12, 2020), [Online]. Available: https://imagemagick.org.
- S. Tomar, “Converting video formats with FFmpeg,” Linux Journal, vol. 2006, no. 146, p. 10, 2006.
- “FFmpeg Website.” (2023), [Online]. Available: https://ffmpeg.org/. [10] “Ghostscript Website.” (2023), [Online]. Available: https ://www.ghostscript.com/.
- C. I. Staats. “An Asymptote tutorial.” (2015), [Online]. Available: https: //math.uchicago.edu/~cstaats/Charles_Staats_III/Notes_and_papers_files/asymptote_tutorial.pdf.
Дополнительные файлы










