Auto reload Latex-generated pdfs on MacOS

16 December 2018 in macos

I like to write my Latex docs in Atom and use Latexmk to watch for changes and recompile everything automatically. The problem is that on macOS, there aren’t that many pdf viewers supporting automatic file reload (e.g. in Adobe Acrobat there is no such feature). I was using Skim, which can reload changed files, but it for some reason this no longer works: Skim manages stops syncins the file after the first few updates (no idea why).

A solution is to open the pdf in TeXShop and keep editing the tex file in Atom, as described in this StackExchange post. TeXShop steals window focus when it reloads the pdf, which is very annoying – fortunately, this can be prevented by executing the following in the terminal (kudos to this comment):

defaults write TeXShop BringPdfFrontOnAutomaticUpdate NO

How to animate isometric unwrapping of a curve

9 May 2018 in geometry

A while ago I was thinking about how to illustrate the input data in Shape from sensors — in 2D, the input is the unit tangent field parametrized by arc-length.

I ended with this cool-looking isometric and isotopic unwrapping.

Move the slider to unwrap the curve. You can also play around in fullscreen.

The effect is achieved by interpolating between the input curve and a straight line with the same length in the tangent space (using spherical linear interpolation).

continue reading…

Lerp vs Slerp

6 May 2018 in geometry

Here’s a demonstration of the difference between two common unit vector interpolation schemes.

The first option is to use linear interpolation in the ambient Euclidean space, followed by a normalization step. Simple and fast, but the angular velocity is not uniform.

Spherical linear interpolation produces uniform angular velocity at the expense of non-linear computation. Slerp is commonly used to interpolate between rotations represented by quaternions.

Your browser does not support the HTML5 canvas tag.

How to export a curve network with normals in Blender

9 April 2018 in blender

Most curve network datasets found online contain only positions and not surface normals along the curves (Cycles, True2Form, ILoveSketch). When I needed to create a bunch of synthetic curve networks with normals to test our surfacing algorithm, I thought this could be easily done using Blender:

  1. Select the network on a mesh
  2. Separate the network from the mesh using the Separation tool (P)
  3. Export the network as an OBJ file (including the normals)

It turned out to be much more tricky than that.

continue reading…

Zippering two pdfs

1 September 2017 in cmd

If for some reason you have two pdfs with separated odd and even pages of a document, the following command zippers them into a single pdf. (Assuming odd.pdf and even.pdf have the same number of pages; in this case 8.)

qpdf --empty --pages $(for i in $(seq 1 1 8); do echo " odd.pdf $i even.pdf $i "; done) -- all.pdf

Re-encoding subtitles in utf-8

29 August 2017 in cmd

Most Slovak/Czech subtitles are encoded in Plex-incompatible windows-1250 (wiki). The following changes the encoding to utf-8.

iconv -f windows-1250 -t utf-8 subs-win-1250.srt > subs-utf-8.srt