From 51919df86e50286212695021327d9969067dac62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Wed, 19 May 2021 22:57:49 +0300 Subject: [PATCH] better formulae --- Makefile | 2 +- layer2img.py | 1 - mj-msc.tex | 16 +++++++++------- wm.sql | 9 +++++++-- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index cfffea1..a28d80d 100644 --- a/Makefile +++ b/Makefile @@ -70,7 +70,7 @@ slides: $(SLIDES) mj-msc.pdf: mj-msc.tex version.inc.tex vars.inc.tex bib.bib \ $(LISTINGS) $(addsuffix .pdf,$(FIGURES)) $(addsuffix .pdf,$(RIVERS)) - latexmk -shell-escape -g -pdf $< + latexmk -shell-escape -pdf $< ############################ # Report's test dependencies diff --git a/layer2img.py b/layer2img.py index 5517d38..1a13800 100644 --- a/layer2img.py +++ b/layer2img.py @@ -63,7 +63,6 @@ def read_layer(select, width, maybe_quadrant): conn = psycopg2.connect(PSQL_CREDS) sql = "SELECT {way} as way1 FROM {select}".format(way=way, select=select) - print(sql) return geopandas.read_postgis(sql, con=conn, geom_col='way1') diff --git a/mj-msc.tex b/mj-msc.tex index 4656f20..d1fb73c 100644 --- a/mj-msc.tex +++ b/mj-msc.tex @@ -729,21 +729,23 @@ compactness index is calculated as follows: \item Construct a polygon by joining first and last vertices of the bend. - \item Calculate area of the polygon. + \item Calculate area of the polygon $A_p$. - \item Calculate perimeter $u$ of the polygon. The same value is the - circumference of the circle. + \item Calculate perimeter $P$ of the polygon. The same value is the + circumference of the circle: $C = P$. - \item Given circle's perimeter $u$, circle's area $A$ is: + \item Given circle's circumference $C$, circle's area $A_c$ is: \[ - A = \frac{u^2}{4\pi} + A_{c} = \frac{C^2}{4\pi} \] - \item Compactness index is $\nicefrac{P}{A}$: + \item Compactness index is $\frac{A_p}{A_c}$: \[ - cmp = \frac{P}{A} = \frac{P}{ \frac{u^2}{4\pi} } = \frac{4\pi P}{u^2} + cmp = \frac{A_p}{A_c} = + \frac{A_p}{ \frac{C^2}{4\pi} } = + \frac{4\pi A_p}{C^2} \] \end{enumerate} diff --git a/wm.sql b/wm.sql index cdb096d..e809f93 100644 --- a/wm.sql +++ b/wm.sql @@ -411,8 +411,8 @@ create function isolated_bends( dbgname text default null ) as $$ declare - -- if neighbor's curvatures are within, it's isolated - isolation_threshold constant real default 0.25; + -- if neighbor's curvatures are within this fraction of the current bend + isolation_threshold constant real default 0.5; this real; skip_next bool; res t_bend_attrs; @@ -438,6 +438,11 @@ begin i, res.bend, jsonb_build_object( + 'area', res.area, + 'cmp', res.cmp, + 'adjsize', res.adjsize, + 'baselinelength', res.baselinelength, + 'curvature', res.curvature, 'isolated', res.isolated ) );