Marco Azimonti Personal Blog

Quantum
Quest
Algorithms, Math, and Physics

Blog Search


JavaScriptライブラリを使ったWebサイトのローカライズ

本稿では、Webサイトのローカライズを簡略化するために開発した再利用可能なJavaScriptライブラリをご紹介します。以前取り組んだHTML5アプリケーションのローカライズの経験を活かし、このライブラリでは翻訳管理をシンプルにし、動的な言語切り替えを実現しています。ライブラリのアーキテクチャについて解説し、JSONファイルから翻訳データを取得してマージし、ページの内容を更新し、メタデータを扱う方法を示します。さらに、i18nextとLodashを活用することでパフォーマンスと柔軟性を高めています。また、ローカライズプロセスをさらに自動化するために作成した補助スクリプト(HTMLから翻訳可能なコンテンツを抽出するBashスクリプトや、LLMsを利用して自動翻訳を行うPythonスクリプト)についてもご紹介します。

Localizzazione di siti web con una libreria JavaScript

In questo post del blog, presento una libreria JavaScript riutilizzabile che ho sviluppato per semplificare la localizzazione dei siti web. Basata sul mio precedente lavoro con la localizzazione di applicazioni HTML5, questa libreria semplifica la gestione delle traduzioni e consente il cambio dinamico della lingua. Spiegherò l'architettura della libreria, mostrando come recupera e unisce i dati di traduzione da file JSON, aggiorna il contenuto delle pagine e gestisce i metadati. Il mio approccio utilizza i18next e Lodash per migliorare le prestazioni e la flessibilità. Fornirò inoltre approfondimenti sugli script di supporto che ho creato per automatizzare ulteriormente il processo di localizzazione, tra cui uno script Bash per estrarre contenuti traducibili dall'HTML e uno script Python che sfrutta LLM per la traduzione automatica.

Website localization with a JavaScript library

In this blog post, I present a reusable JavaScript library I developed to simplify website localization. Building on my previous work with HTML5 application localization, this library streamlines the management of translations and enables dynamic language switching. I will explain the library's architecture, demonstrating how it fetches and merges translation data from JSON files, updates page content, and handles metadata. My approach uses i18next and Lodash to enhance performance and flexibility. I also provide insights into helper scripts I created to further automate the localization process, including a Bash script for extracting translatable content from HTML and a Python script leveraging LLMs for automated translation.

3d translational transformation of inertia properties

In this blog post, I explore the parallel axis theorem, a useful tool for simplifying moment of inertia calculations for rigid bodies. My focus is on demonstrating how this theorem allows me to relate the moment of inertia around any axis to that calculated about a parallel axis that passes through the body's center of mass. I present the derivation of the tensor form of the theorem, as well as the matrix representation, with particular attention on how the translation of the axis affects the inertia tensor.

Tensor of inertia of a cuboid

In this blog post, I explore the calculation of the mass moment of inertia for a cuboid. I derive the inertia tensor components, detailing each step from the integral definitions to the final expressions for moments and products of inertia. My focus is on a cuboid with uniform mass density, and I provide the mathematical derivations using a step-by-step approach, making the underlying principles clear. I then show how the final matrix simplifies due to the symmetry of the cuboid and how the off-diagonal elements are zero, resulting in a diagonal matrix.

Angular momentum of a rigid body in 3d

In this blog post, I explore the concept of angular momentum for a rigid body undergoing three-dimensional motion. I derive the formula for angular momentum about an arbitrary point, starting from the basic definition involving the integral of the cross product between the position vector and velocity. I show how to incorporate the relative velocity equation to describe the velocity of mass elements within the rigid body. I then introduce the inertia tensor and show how it simplifies the expression for the angular momentum. I also cover specific cases where the reference point is the center of mass or a fixed point in the inertial frame, highlighting how the equation simplifies under these conditions.

Euler angles and rotational transformations

In this blog post, I explore the derivation of rotational transformations using Euler angles and transformation matrices. My focus is on a systematic approach to move from a fixed frame to a moving frame, applying three consecutive rotations. I detail the coordinate transformations and derive the angular velocity in both the fixed and moving frames. I also show the process of inverse transformations and how they are used to express coordinates from the body frame to the fixed frame. Finally, I verify the results by directly applying the rotation matrices to the angular velocity.

3d rotation matrices: tool for handling rotations

In this blog post, I will explore rotation matrices, a powerful tool for handling rotations in engineering and physics. I will show how these matrices can simplify the process of rotating vectors and coordinate systems, eliminating the need for step-by-step methods like Euler angles. I will present the transformation matrices for rotations about the x, y, and z axes and how to apply them to convert vectors between different frames of reference. I will discuss the property of orthonormality, which makes inverting rotation matrices straightforward.

Angular velocities using Euler angles

In this blog post, I explore the concept of angular velocity for a rigid body undergoing rotations, specifically when described by Euler angles. I detail how to calculate the total angular velocity by summing individual contributions of rotation, and I then derive expressions for this total angular velocity in two frames, the body-fixed and the space-fixed frames. This process involves expressing intermediate rotation axes in terms of the respective frame's basis vectors, leading to explicit formulas for angular velocity using Euler angle rates. This provides a clear understanding of how rotations accumulate to create a body's overall angular motion.

3d rigid body kinematics: Euler angles

In this blog post, I explore the concept of Euler angles, a method I use to describe the orientation of a rigid body. I will show how Euler angles use three successive rotations to transform a space-fixed coordinate system to a body-fixed one. I will explain the three rotations, precession, nutation, and spin and how their order matters. I will also highlight why I need a convention to describe this rotation, since successive rotations are non-commutative. My intention is to give you an intuitive way of visualizing these concepts, using the example of a gyroscope to make these rotations more concrete.

Kinematics of a point on a vinyl record

In this blog post, I explore the concepts of relative motion by examining a point moving on a rotating vinyl record. I analyze the velocity and acceleration of a point moving radially outward, as observed from a stationary reference frame. I present the mathematical formulations, breaking down each term in the velocity and acceleration equations. The analysis considers the centripetal and Coriolis accelerations, providing a clear understanding of how these components arise. I explain the meaning of each acceleration term and its physical effects on the motion of the point.

3d rigid body kinematics: acceleration

In this blog post, I explain how to analyze the velocity of a point observed from two different reference frames, one of which is moving and rotating relative to the other. I start by establishing the relationship between the position vectors in the two frames. Then, through differentiation and consideration of the relative rotation, I derive the general velocity transformation equation. This equation expresses the absolute velocity of a point as the sum of the absolute velocity of the moving frame's origin, the relative velocity of the point within the moving frame, and a term accounting for the frame's rotation.

Kinematics of a landing gear

In this blog post, I explore the calculation of the velocity of a point on a landing gear wheel using multiple reference frames. I will show how to break down the complex motion into simpler components using intermediate frames. I start by analyzing the motion of the wheel with respect to the landing gear arm, and then I analyze the motion of the arm with respect to the aircraft. This approach will allow me to find the final velocity of the point using vector algebra. I'll go through the entire derivation, clarifying each step.

More ...