Schwarz-Christoffel Conformal Mapping
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

sccm: Schwarz-Christoffel Conformal Mapping

Project Status: Active – The project has reached a stable, usable state and is being actively developed. Build Status Coverage Status

An R package Providing a conformal mapping of one 2D polygon to a rectangular region via the Schwarz-Christoffel theorem.

Methods are provide to find a convex hull for an arbitrary set (x, y) coordinates. This hull, and the points within, are, via an (inverse) Schwarz-Christoffel mapping, mapped to the unit disk. A second Schwarz-Christoffel mapping from the unit disk to an arbitrary rectangle is use to finish the conformal mapping.

This package builds hulls via Andrew's monotone chain algorithm implemented in C++. The Schwarz-Christoffel mappings are provided by the fortran SCPACK by Lloyd N. Trefethen.


Useful methods in this package:

  • convex_hull: given a set of (x, y) coordinates, return the convex hull, vertices listed in an anti-clockwise order, and the exterior angles at each vertex.

  • polygon: given a set of (x, y) coordinates return, return the coordinates and the exterior angles at each vertex.

  • is_in: given a point and polygon, determin if the point is within, on, or outside of the polygon.

  • polar2cartesian : quick translation from polar to cartesian coordinates.

  • cartesian2polar : quick translation from cartesian to polar coordinates.

  • d2p: the conformal mapping from the unit disk to a given polygon.

  • p2d: the (inverse) conformal mapping from a polygon to the unit disk.

  • p2p: a composite mapping from one polygon to another polygon.

Date Sets

Two MC Escher images used to illustrate the conformal mappings

  • CircleLimitI
  • HexagonalFish


Within R run

vignette("sccm-overview", package = "sccm")

to get a detailed overview of the package.


If you clone this repository you should be able to install the package via GNU make:

make install

Install form Github

You can install this package from github using the devtools package:

if (!("devtools" %in% rownames(installed.packages()))) { 
  warning("installing devtools from")
                   repo = "")

                         build_vignettes = TRUE)

If you are working on a Windows machine you will need to download and install Rtools before devtools will work for you.

What about CRAN?

This package is currently not on CRAN. Some elements of Trefethen's FORTRAN code is not compliant with the standards set by CRAN. (writing to stdin/stdout, and stops) A long term goal is to edit the FORTRAN code to make it CRAN compliant.

* checking compiled code ... NOTE
File ‘sccm/libs/’:
  Found ‘_gfortran_st_write’, possibly from ‘write’ (Fortran), ‘print’
    Objects: ‘sclibdbl.o’, ‘scpdbl.o’
  Found ‘_gfortran_stop_string’, possibly from ‘stop’ (Fortran)
    Object: ‘scpdbl.o’