better formulae

main
Motiejus Jakštys 2021-05-19 22:57:49 +03:00 committed by Motiejus Jakštys
parent 9386a3dda1
commit 51919df86e
4 changed files with 17 additions and 11 deletions

View File

@ -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

View File

@ -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')

View File

@ -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}

9
wm.sql
View File

@ -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
)
);