Modules

geometor.pacioli

Symbolic modeling, digital codex tools, and conservation algebra for Fra Luca Pacioli.

Provides tools and exact SymPy / geometor.model modules spanning both of Fra Luca Pacioli’s Venetian folio masterpieces printed by Paganino de’ Paganini:

  • Summa de arithmetica, geometria, proportioni et proportionalita (Venice, 1494):

    • geometor.pacioli.proportions: Boethian ratio taxonomy, Euclidean modi arguendi, semicircle construction of the three classical means, golden section of 10, and Pacioli’s six canonical Cossic quadratic equations.

    • geometor.pacioli.tractatus_geometriae: Heron’s (13, 14, 15) triangle construction, De divisione superficierum proportional cuts, and inscribed Platonic and Archimedean solids in the sphere of diameter 6.

    • geometor.pacioli.ledger_conservation: Venetian l. s. g. p. money of account, skew-symmetric conservation algebra of the Quaderno, and the Problem of Points.

    • geometor.pacioli.svg_woodcut: Deterministic .euclid-graphic SVG generator.

  • De Divina Proportione (Venice, 1509 / Vienna, 1889):

    • PacioliParser, folio extraction, and woodcut graphic calibration utilities.

Submodules

Classes

AccountSummary

T-account summary in the Quaderno grande (Dare on left, Avere on right).

JournalEntry

Single Venetian Giornale entry Per <debit_account> // A <credit_account>.

ProblemOfPointsResult

Comparison of Pacioli's 1494 rule vs. Pascal–Fermat 1654 expectation.

QuadernoLedger

Directed-graph conservation model of Pacioli's Quaderno grande (Venice, 1494).

TrialBalanceReport

Exact Summa summarum and conservation verification of the Quaderno.

VenetianAmount

Exact Venetian money of account (lire, soldi, grossi, piccoli a oro, fol. 201v).

PacioliParser

BoethianClassification

Exact Boethian classification of a positive rational ratio \(p : q\).

CossicQuadraticResult

Symbolic solution and geometric gnomon invariants for Pacioli's 6 canonical equations.

ExtremeMeanResult

Exact symbolic outputs of dividing a segment in extreme and mean ratio.

SixModesResult

The six Euclidean modi arguendi (Book V / Summa fol. 74r) on \(a : b = c : d\).

ThreeMeansResult

Exact symbolic outputs of the semicircle construction of the three classical means.

EuclidGraphicCanvas

Builder for standard 5-layer .euclid-graphic interactive SVGs.

SVGSpec

Metadata describing a generated Summa .euclid-graphic SVG plate.

DodecahedronAxis48Result

Exact symbolic metrics for Problem 21 on Part II, fol. 70r (sphere axis sqrt(48)).

HeronTriangleResult

Exact symbolic invariants of Pacioli's (13, 14, 15) triangle (Part II, fol. 9v).

InscribedPolyhedronSpec

Exact symbolic metrics of a regular or Archimedean solid in a sphere of diameter D.

TriangleDivisionResult

Exact symbolic outputs for dividing a triangle's area in ratio p : q.

Functions

extract_all(pdf_path, output_dir[, start_page, ...]) → None

Extract page images and text for the entire volume in parallel.

build_graphics_index(directory) → pathlib.Path

Compile all per-folio <folio>.json files into graphics_index.json.

clean_image(pil_image[, white_point, preserve_color]) → PIL.Image.Image

Normalize aged parchment background and binding shadows to pure white (255).

detect_graphics_cv(image_path) → List[Dict[str, Any]]

Detect full-page plate graphics using OpenCV if available, falling back to SciPy.

detect_initials(image_path) → List[Dict[str, Any]]

Detect woodcut illuminated initial caps by finding 2D ink-density centers along the text column edge.

detect_margin_figures(image_path, is_recto) → List[Dict[str, Any]]

Detect geometric diagrams and marginalia strictly in the outer margin of a text folio.

extract_from_json(json_path[, no_clean]) → None

Extract all margin graphics and illuminated initial caps defined in <folio>.json.

build_venetian_merchant_quaderno_1493() → QuadernoLedger

Construct a canonical Venetian Quaderno modeled on Summa fols. 201v–210r (Nov. 1493).

compare_problem_of_points([target_rounds, ...]) → ProblemOfPointsResult

Compare Pacioli's 1494 balla / balestrare division against Pascal–Fermat (1654).

apply_six_euclidean_modes(a, b, c, d[, e, f]) → SixModesResult

Verify and transform \(a:b = c:d\) under Pacioli's six modes (Summa fol. 74r).

classify_boethian_ratio(p, q) → BoethianClassification

Classify a positive rational ratio \(p : q\) according to Summa Dist. VI.

compound_ratios(ratios) → BoethianClassification

Compound a sequence of rational ratios (proportioni composte, Summa fol. 83r).

construct_extreme_and_mean_ratio([length]) → ExtremeMeanResult

Divide a line of given length (default 10) in extreme and mean ratio.

construct_three_means([a, b]) → ThreeMeansResult

Construct Arithmetic, Geometric, and Harmonic means of \(a\) and \(b\) in Model.

solve_cossic_quadratic(canon_number, a_censi, b_cose, ...) → CossicQuadraticResult

Solve one of Pacioli's six canonical Cossic equations (Summa fols. 145r–146r).

generate_all_summa_svgs(summa_docsrc_dir) → list[SVGSpec]

Generate and write all nine .euclid-graphic SVGs into docsrc/summa_1494/.

construct_heron_13_14_15() → HeronTriangleResult

Construct and verify Pacioli's (13, 14, 15) Heron triangle (Part II, fol. 9v).

construct_triangle_division_cevian([ratio_p, ratio_q]) → TriangleDivisionResult

Divide \(\triangle GBA\) (13, 14, 15) in ratio p : q by a vertex cevian.

construct_triangle_division_parallel([ratio_p, ratio_q]) → TriangleDivisionResult

Divide \(\triangle GBA\) in ratio p : q by a cut parallel to side BA.

dodecahedron_in_sphere_sqrt48() → DodecahedronAxis48Result

Reproduce Problem 21 on Part II, fol. 70r (dodecahedron in sphere of axis sqrt(48)).

inscribed_polyhedra_sphere_table([diameter]) → dict[str, InscribedPolyhedronSpec]

Compute exact symbolic metrics for regular & Archimedean solids in a sphere of diameter D.

Package Contents

geometor.pacioli.extract_all(pdf_path: pathlib.Path, output_dir: pathlib.Path, start_page: int = 1, end_page: int = 318, dpi: int = 150, max_workers: int = 6, force: bool = False) → None

Extract page images and text for the entire volume in parallel.

geometor.pacioli.build_graphics_index(directory: pathlib.Path) → pathlib.Path

Compile all per-folio <folio>.json files into graphics_index.json.

geometor.pacioli.clean_image(pil_image: PIL.Image.Image, white_point: int = 226, preserve_color: bool = False) → PIL.Image.Image

Normalize aged parchment background and binding shadows to pure white (255).

Uses morphological closing + Gaussian blur to estimate local paper illumination per channel, eliminating yellowed paper cast, bleed-through, and gutter shadows while preserving crisp ink. When preserve_color=True (e.g., red rubrication on folios 0005 and 0311), chromatic ink is kept.

geometor.pacioli.detect_graphics_cv(image_path: pathlib.Path) → List[Dict[str, Any]]

Detect full-page plate graphics using OpenCV if available, falling back to SciPy.

geometor.pacioli.detect_initials(image_path: pathlib.Path) → List[Dict[str, Any]]

Detect woodcut illuminated initial caps by finding 2D ink-density centers along the text column edge.

Woodcut initials in the 1509 Paganini edition have consistent square dimensions: - Standard chapter initials: 120x132 px (padded around the ~112x118 woodcut frame) - Large treatise-opening initials (folios 0017 and 0085): 260x304 px - Title-page red initial D (folio 0005): 184x188 px

geometor.pacioli.detect_margin_figures(image_path: pathlib.Path, is_recto: bool) → List[Dict[str, Any]]

Detect geometric diagrams and marginalia strictly in the outer margin of a text folio.

  • Odd (recto) folios: right outer margin (to the right of the main text column).

  • Even (verso) folios: left outer margin (to the left of the main text column).

Never falls back to full-page text blocks.

geometor.pacioli.extract_from_json(json_path: pathlib.Path, no_clean: bool = False) → None

Extract all margin graphics and illuminated initial caps defined in <folio>.json.

class geometor.pacioli.AccountSummary

T-account summary in the Quaderno grande (Dare on left, Avere on right).

folio: int
name: str
kind: str
dare_ducati: sympy.Rational
avere_ducati: sympy.Rational
net_dare_ducati: sympy.Rational
class geometor.pacioli.JournalEntry

Single Venetian Giornale entry Per <debit_account> // A <credit_account>.

entry_no: int
date: str
debit_account: str
credit_account: str
amount: VenetianAmount
narrative: str
format_giornale() → str

Render the entry in Pacioli’s Venetian Giornale syntax (fol. 201r–201v).

class geometor.pacioli.ProblemOfPointsResult

Comparison of Pacioli’s 1494 rule vs. Pascal–Fermat 1654 expectation.

target_rounds: int
current_scores: tuple[int, ...]
total_stake_ducati: sympy.Rational
pacioli_shares: tuple[sympy.Rational, ...]
pascal_fermat_probabilities: tuple[sympy.Rational, ...]
pascal_fermat_shares: tuple[sympy.Rational, ...]
discrepancies: tuple[sympy.Rational, ...]
class geometor.pacioli.QuadernoLedger

Directed-graph conservation model of Pacioli’s Quaderno grande (Venice, 1494).

property accounts: list[str]

Ordered list of registered ledger accounts.

property entries: list[JournalEntry]

Chronological list of posted Giornale entries.

register_account(name: str, kind: str = 'real') → int

Register an account in the Alfabeto / Repertorio and return its Quaderno folio.

Parameters:
  • name – Account title (e.g., "Cassa de contanti", "Cavedal").

  • kind – Account category ("cassa", "capitale", "mercanzia", "personal", "nominal", "pro_e_danno", "bilancio").

Returns:

1-indexed Quaderno folio (carta) number.

post(date: str, debit_account: str, credit_account: str, amount: VenetianAmount, narrative: str, *, debit_kind: str = 'real', credit_kind: str = 'real') → JournalEntry

Post a Giornale item Per <debit> // A <credit> to both Quaderno folios.

Enforces Pacioli’s Cap. 14 rule (fol. 202r): mai si deue mettere cosa in dare che quella ancora non si ponga in hauere.

Parameters:
  • date – Venetian entry date string.

  • debit_account – Debtor account prefixed by Per.

  • credit_account – Creditor account prefixed by A.

  • amount – Strictly positive VenetianAmount.

  • narrative – Brief Giornale description distilled from the Memoriale.

  • debit_kind – Category if debit_account is not yet registered.

  • credit_kind – Category if credit_account is not yet registered.

Returns:

The recorded JournalEntry.

incidence_matrix() → sympy.Matrix

Return oriented vertex-edge incidence matrix \(B \in \{-1, 0, +1\}^{|V| \times |E|}\).

For entry \(e\) (Per u // A v), \(B_{u, e} = +1\) (Dare) and \(B_{v, e} = -1\) (Avere), so \(\mathbf{1}^T B = \mathbf{0}^T\).

weight_vector_ducati() → sympy.Matrix

Return column vector \(w \in \mathbb{Q}^{|E|}\) of transaction weights in ducats.

skew_symmetric_flow_matrix() → sympy.Matrix

Return skew-symmetric pairwise flow matrix \(F \in \mathbb{Q}^{|V| \times |V|}\).

Entry \(F_{i,j}\) equals net ducats debited to account \(i\) against credit to account \(j\), satisfying \(F^T = -F\) identically.

trial_balance() → TrialBalanceReport

Compute Pacioli’s Summa summarum and verify all conservation invariants.

close_to_bilancio(date: str = '1493-12-31', pro_e_danno_account: str = 'Pro e Danno', capitale_account: str = 'Cavedal', bilancio_account: str = 'Bilancio del libro') → sympy.Rational

Execute Pacioli’s Cap. 27 & Cap. 34 closing cycle (Pro e Danno -> Cavedal -> Bilancio).

First sweeps all "mercanzia" (closed venture) and "nominal" accounts into Pro e Danno, transfers net profit/loss from Pro e Danno to Cavedal (Cap. 27), and finally closes all remaining open asset/liability/capital accounts into Bilancio del libro (Cap. 34), bringing every account’s net balance to 0.

Parameters:
  • date – Closing date string.

  • pro_e_danno_account – Profit-and-loss summary account name.

  • capitale_account – Merchant’s capital account name.

  • bilancio_account – Final closing balance account name.

Returns:

Exact net profit (positive) or loss (negative) in ducats transferred to Cavedal.

class geometor.pacioli.TrialBalanceReport

Exact Summa summarum and conservation verification of the Quaderno.

accounts: tuple[AccountSummary, ...]
summa_dare_ducati: sympy.Rational
summa_avere_ducati: sympy.Rational
net_conservation_sum: sympy.Rational
is_balanced: bool
cassa_non_negative: bool
class geometor.pacioli.VenetianAmount

Exact Venetian money of account (lire, soldi, grossi, piccoli a oro, fol. 201v).

piccoli_total: sympy.Integer
classmethod from_lsgp(lire: int = 0, soldi: int = 0, grossi: int = 0, piccoli: int = 0) → VenetianAmount

Construct an exact amount from (lire, soldi, grossi, piccoli) columns.

classmethod from_ducati(ducati: int = 0, grossi: int = 0, piccoli: int = 0) → VenetianAmount

Construct an exact amount from Venetian gold ducats (24 grossi = 1 ducato).

to_lsgp() → tuple[int, int, int, int]

Decompose into canonical (lire, soldi, grossi, piccoli) columns.

to_ducati_rational() → sympy.Rational

Express the exact value in Venetian gold ducats as a sympy.Rational.

to_lire_rational() → sympy.Rational

Express the exact value in Venetian lire di grossi as a sympy.Rational.

format_venetian() → str

Format in Pacioli’s four-column Venetian ledger notation (l. s. g. p.).

__add__(other: VenetianAmount) → VenetianAmount

Add two exact Venetian amounts.

__sub__(other: VenetianAmount) → VenetianAmount

Subtract two exact Venetian amounts.

geometor.pacioli.build_venetian_merchant_quaderno_1493() → QuadernoLedger

Construct a canonical Venetian Quaderno modeled on Summa fols. 201v–210r (Nov. 1493).

Includes opening inventory of cash and gems against Cavedal, purchase of sugar and Ginger (zenzer mechini, fol. 201v item 7), credit sale to Martino da Foro, brokerage expense (Spese de mercanzia), partial cash settlement, and profit transfer.

Returns:

Populated QuadernoLedger prior to final closing.

geometor.pacioli.compare_problem_of_points(target_rounds: int = 6, current_scores: tuple[int, ...] = (5, 3), total_stake_ducati: int | sympy.Expr = 10) → ProblemOfPointsResult

Compare Pacioli’s 1494 balla / balestrare division against Pascal–Fermat (1654).

Covers both the classic two-player giuoco della balla on fol. 197r (e.g., (5, 3) or (5, 2) playing to 6 for 10 ducats) and Problem 51 on fol. 197v (three crossbowmen a balestrare playing to 6 best shots for 10 ducats, interrupted at (4, 3, 2)).

Parameters:
  • target_rounds – Winning score threshold (e.g., 6).

  • current_scores – Tuple of positive/non-negative scores below target_rounds.

  • total_stake_ducati – Total pot in ducats (default 10).

Returns:

Exact ProblemOfPointsResult with sp.Rational shares and discrepancies.

class geometor.pacioli.PacioliParser(resources_dir: pathlib.Path, output_dir: pathlib.Path)
resources_dir
output_dir
transcribed_file
parse()

Execute the parsing process.

This method orchestrates the extraction of TOC and text chapters, merges them, and generates the RST output structure.

create_root_index(book_names: List[str])
process_book(lines: List[str], book_config: Dict)
extract_chapters(lines: List[str], start_marker: str, end_marker: str, prefix: str) → Dict[str, Dict]

Extract chapters from a section of lines.

Parameters:
  • lines – The list of lines to process.

  • start_marker – The string marking the start of the section.

  • end_marker – The string marking the end of the section.

  • prefix – The prefix for chapter headers (e.g., “Cap”, “Gap”).

Returns:

A dictionary of chapters keyed by Roman Numeral ID.

Return type:

dict

merge_chapters(toc_chapters: Dict, text_chapters: Dict) → List[Dict]

Merge TOC and Text chapters into a single list.

Parameters:
  • toc_chapters – Dictionary of chapters extracted from the TOC.

  • text_chapters – Dictionary of chapters extracted from the text.

Returns:

A list of merged chapter dictionaries, sorted by Roman Numeral ID.

Return type:

list

generate_rst_structure(chapters: List[Dict], output_dir: pathlib.Path)

Generate the RST folder structure and files for the chapters.

Parameters:
  • chapters – List of chapter dictionaries.

  • output_dir – The directory where RST files will be generated.

create_main_index(chapters: List[Dict], output_dir: pathlib.Path)
create_chapter_files(chapter_dir: pathlib.Path, chapter: Dict)
indent_text(text: str, indent: str = '   ') → str
class geometor.pacioli.BoethianClassification

Exact Boethian classification of a positive rational ratio \(p : q\).

antecedent: sympy.Integer
consequent: sympy.Integer
reduced_ratio: sympy.Rational
inequality: str
genus: str
latin_species: str
quotient: sympy.Integer
remainder: sympy.Integer
denominator: sympy.Integer
class geometor.pacioli.CossicQuadraticResult

Symbolic solution and geometric gnomon invariants for Pacioli’s 6 canonical equations.

canon_number: int
canon_kind: str
cossic_statement: str
positive_roots: tuple[sympy.Expr, ...]
half_cose: sympy.Expr
half_cose_squared: sympy.Expr
completed_square_area: sympy.Expr
class geometor.pacioli.ExtremeMeanResult

Exact symbolic outputs of dividing a segment in extreme and mean ratio.

model: geometor.model.Model
whole: sympy.Expr
major_part: sympy.Expr
minor_part: sympy.Expr
cut_point: sympy.geometry.Point
phi_ratio: sympy.Expr
class geometor.pacioli.SixModesResult

The six Euclidean modi arguendi (Book V / Summa fol. 74r) on \(a : b = c : d\).

original: tuple[sympy.Rational, sympy.Rational]
conversa: tuple[sympy.Rational, sympy.Rational]
permutata: tuple[sympy.Rational, sympy.Rational]
congionta: tuple[sympy.Rational, sympy.Rational]
disgiunta: tuple[sympy.Rational, sympy.Rational] | None
eversa: tuple[sympy.Rational, sympy.Rational] | None
equa: tuple[sympy.Rational, sympy.Rational] | None
class geometor.pacioli.ThreeMeansResult

Exact symbolic outputs of the semicircle construction of the three classical means.

model: geometor.model.Model
a: sympy.Expr
b: sympy.Expr
arithmetic_mean: sympy.Expr
geometric_mean: sympy.Expr
harmonic_mean: sympy.Expr
harmonic_conjugate_point: sympy.geometry.Point
geometor.pacioli.apply_six_euclidean_modes(a: int | sympy.Expr, b: int | sympy.Expr, c: int | sympy.Expr, d: int | sympy.Expr, e: int | sympy.Expr | None = None, f: int | sympy.Expr | None = None) → SixModesResult

Verify and transform \(a:b = c:d\) under Pacioli’s six modes (Summa fol. 74r).

On fol. 74r (De sex speciebus sive modis arguendi proportionalitatum), Pacioli enumerates: conversa (\(b:a = d:c\)), permutata (\(a:c = b:d\)), congionta (\((a+b):b = (c+d):d\)), disgiunta (\((a-b):b = (c-d):d\)), eversa (\(a:(a-b) = c:(c-d)\)), and equa (\(a:e = c:f\) when \(b:e = d:f\)).

Parameters:
  • a – First antecedent.

  • b – First consequent.

  • c – Second antecedent.

  • d – Second consequent.

  • e – Optional third term for proportione equa (Euclid V.22).

  • f – Optional sixth term for proportione equa (Euclid V.22).

Returns:

Exact SixModesResult verifying equality of both sides in every valid mode.

geometor.pacioli.classify_boethian_ratio(p: int | sympy.Expr, q: int | sympy.Expr) → BoethianClassification

Classify a positive rational ratio \(p : q\) according to Summa Dist. VI.

Implements Severinus Boethius’s and Pacioli’s fivefold taxonomy of greater (maior inaequalitas) and lesser (minor inaequalitas, prefixed sub-) inequality on fols. 70r–83r.

Parameters:
  • p – Positive rational or integer antecedent.

  • q – Positive rational or integer consequent.

Returns:

Exact BoethianClassification record with reduced integers and species name.

Raises:

ValueError – If p or q is non-positive or non-rational.

geometor.pacioli.compound_ratios(ratios: list[tuple[int | sympy.Expr, int | sympy.Expr]]) → BoethianClassification

Compound a sequence of rational ratios (proportioni composte, Summa fol. 83r).

For example, compounding musical sesquialtera (\(3:2\)) and sesquitertia (\(4:3\)) yields the octave dupla (\(2:1\)).

Parameters:

ratios – Non-empty list of (antecedent, consequent) pairs.

Returns:

The BoethianClassification of the compounded product ratio.

geometor.pacioli.construct_extreme_and_mean_ratio(length: int | sympy.Expr = 10) → ExtremeMeanResult

Divide a line of given length (default 10) in extreme and mean ratio.

Reproduces Pacioli’s canonical numerical archetype (Summa Dist. VI & Part II Dist. VIII; De Divina Proportione Cap. VIII–X): for \(AB = 10\), the major segment is \(AC = \sqrt{125} - 5 = 5(\sqrt{5} - 1)\) and the minor segment is \(CB = 15 - \sqrt{125} = 5(3 - \sqrt{5})\), satisfying \(AB \cdot CB = AC^2 = 150 - 10\sqrt{125}\) and Euclid XIII.1 \((AC + 5)^2 = 125 = 5 \cdot 5^2\).

Parameters:

length – Positive exact length of segment \(AB\) (default 10).

Returns:

Exact ExtremeMeanResult with proven Model and closed-form algebraic parts.

geometor.pacioli.construct_three_means(a: int | sympy.Expr = 9, b: int | sympy.Expr = 4) → ThreeMeansResult

Construct Arithmetic, Geometric, and Harmonic means of \(a\) and \(b\) in Model.

Places collinear points \(A=(0,0)\), \(P=(a,0)\), \(B=(a+b,0)\). In the semicircle on diameter \(AB\) with center \(M\):

  • Radius \(MQ = (a+b)/2 = A\) (Arithmetic mean),

  • Altitude \(PQ = \sqrt{ab} = G\) (Geometric mean, Euclid VI.13),

  • Leg \(QN = 2ab/(a+b) = H\) on radius \(MQ\) where \(PN \perp MQ\) (Harmonic mean), satisfying \(PQ^2 = MQ \cdot QN \iff G^2 = A \cdot H\).

Also constructs the collinear harmonic range \((A, C_H; P, D_H)\) with cross-ratio \(-1\).

Parameters:
  • a – First positive exact length (default 9, matching Summa / Compendio ratios).

  • b – Second positive exact length (default 4).

Returns:

Exact ThreeMeansResult with proven Model and exact symbolic means.

geometor.pacioli.solve_cossic_quadratic(canon_number: int, a_censi: int | sympy.Expr, b_cose: int | sympy.Expr, c_numero: int | sympy.Expr) → CossicQuadraticResult

Solve one of Pacioli’s six canonical Cossic equations (Summa fols. 145r–146r).

On fol. 145r, Pacioli classifies positive-coefficient equations into three simple (capitoli semplici, 1–3) and three compound (capitoli composti, 4–6) canons:

  1. a .ce. = b .co. (\(a x^2 = b x\))

  2. a .ce. = c (\(a x^2 = c\))

  3. b .co. = c (\(b x = c\))

  4. a .ce. p̄ b .co. = c (\(a x^2 + b x = c\) — Primi canonis versus: Si res et census numero coaequantur…)

  5. a .ce. p̄ c = b .co. (\(a x^2 + c = b x\) — Secundi canonis versus: two positive roots when \((b/(2a))^2 > c/a\))

  6. b .co. p̄ c = a .ce. (\(b x + c = a x^2\) — Tertii canonis versus)

Parameters:
  • canon_number – Integer 1 through 6 selecting Pacioli’s canon.

  • a_censi – Coefficient of censo (\(x^2\)), positive for canons 1, 2, 4, 5, 6.

  • b_cose – Coefficient of cosa (\(x\)), positive for canons 1, 3, 4, 5, 6.

  • c_numero – Constant numero, positive for canons 2, 3, 4, 5, 6.

Returns:

Exact CossicQuadraticResult with Cossic statement, positive root(s), and completion-of-the-square gnomon invariants.

class geometor.pacioli.EuclidGraphicCanvas(*, width: int, height: int, graphic_id: str, folio: str, proposition: str, scale: float = 1.0, origin_x: float = 0.0, origin_y: float = 0.0)

Builder for standard 5-layer .euclid-graphic interactive SVGs.

width
height
graphic_id
folio
proposition
scale = 1.0
origin_x = 0.0
origin_y = 0.0
to_px(x: float | int | sympy.Expr, y: float | int | sympy.Expr) → tuple[float, float]

Map exact mathematical (x, y) (y-up) to SVG screen coordinates (y-down).

add_circle(el_id: str, cx: float | int | sympy.Expr, cy: float | int | sympy.Expr, r: float | int | sympy.Expr, *, data_ref: str = '', css_class: str = 'geom-circle') → None

Add a circle to #elements and #highlights.

add_arc(el_id: str, cx: float | int | sympy.Expr, cy: float | int | sympy.Expr, r: float | int | sympy.Expr, deg_start: float, deg_end: float, *, data_ref: str = '', css_class: str = 'geom-arc') → None

Add a circular arc (math degrees counter-clockwise from +x) to #elements.

add_polygon(el_id: str, vertices: list[tuple[float | int | sympy.Expr, float | int | sympy.Expr]], *, data_ref: str = '', css_class: str = 'geom-polygon') → None

Add a filled polygon to #graphics and #highlights.

add_segment(el_id: str, p1: tuple[float | int | sympy.Expr, float | int | sympy.Expr], p2: tuple[float | int | sympy.Expr, float | int | sympy.Expr], *, data_ref: str = '', css_class: str = 'geom-line') → None

Add a 3-vertex midpoint segment path M x1 y1 L xm ym L x2 y2 to #graphics.

add_point(pt_id: str, x: float | int | sympy.Expr, y: float | int | sympy.Expr, *, label: str | None = None, dx: float = 0.0, dy: float = -10.0, anchor: str = 'middle', radius: float = 3.4) → None

Add a point circle in #points and optional label in #labels.

add_annotation(ann_id: str, x: float | int | sympy.Expr, y: float | int | sympy.Expr, text: str, *, anchor: str = 'middle', data_ref: str = '') → None

Add a compact mathematical or woodcut caption inside #labels.

render() → str

Serialize the complete 5-layer .euclid-graphic SVG XML string.

class geometor.pacioli.SVGSpec

Metadata describing a generated Summa .euclid-graphic SVG plate.

graphic_id: str
unit_dir: str
filename: str
folio: str
proposition: str
path: pathlib.Path
geometor.pacioli.generate_all_summa_svgs(summa_docsrc_dir: pathlib.Path | str) → list[SVGSpec]

Generate and write all nine .euclid-graphic SVGs into docsrc/summa_1494/.

Parameters:

summa_docsrc_dir – Target root directory (typically <repo>/docsrc/summa_1494).

Returns:

Ordered list of SVGSpec records written to disk.

class geometor.pacioli.DodecahedronAxis48Result

Exact symbolic metrics for Problem 21 on Part II, fol. 70r (sphere axis sqrt(48)).

sphere_axis_squared: sympy.Integer
sphere_axis: sympy.Expr
inscribed_cube_edge_squared: sympy.Integer
inscribed_cube_edge: sympy.Integer
dodecahedron_edge: sympy.Expr
extreme_mean_minor_part: sympy.Expr
class geometor.pacioli.HeronTriangleResult

Exact symbolic invariants of Pacioli’s (13, 14, 15) triangle (Part II, fol. 9v).

model: geometor.model.Model
pt_g: sympy.geometry.Point
pt_b: sympy.geometry.Point
pt_a: sympy.geometry.Point
pt_d: sympy.geometry.Point
incenter: sympy.geometry.Point
circumcenter: sympy.geometry.Point
sides: tuple[sympy.Integer, sympy.Integer, sympy.Integer]
perimeter: sympy.Integer
semiperimeter: sympy.Integer
excesses: tuple[sympy.Integer, sympy.Integer, sympy.Integer]
heron_radicand: sympy.Integer
area: sympy.Integer
altitude: sympy.Integer
base_segments: tuple[sympy.Integer, sympy.Integer]
inradius: sympy.Integer
circumradius: sympy.Rational
class geometor.pacioli.InscribedPolyhedronSpec

Exact symbolic metrics of a regular or Archimedean solid in a sphere of diameter D.

key: str
italian_name: str
faces_description: str
sphere_diameter: sympy.Expr
edge_squared: sympy.Expr
edge: sympy.Expr
surface_area: sympy.Expr
volume: sympy.Expr
folio_citation: str
class geometor.pacioli.TriangleDivisionResult

Exact symbolic outputs for dividing a triangle’s area in ratio p : q.

model: geometor.model.Model
method: str
ratio_p: sympy.Integer
ratio_q: sympy.Integer
total_area: sympy.Expr
part_1_area: sympy.Expr
part_2_area: sympy.Expr
cut_points: tuple[sympy.geometry.Point, ...]
geometor.pacioli.construct_heron_13_14_15() → HeronTriangleResult

Construct and verify Pacioli’s (13, 14, 15) Heron triangle (Part II, fol. 9v).

On Part II, fol. 9v (Distinctio prima, Capitulum octavum), Pacioli computes for \(\triangle ABG\) with \(AG=13\), \(BG=14\), \(AB=15\):

  • Perimeter \(13 + 14 + 15 = 42\), semiperimeter \(s = 21\),

  • Excesses \((s - 15, s - 14, s - 13) = (6, 7, 8)\),

  • Product \(6 \cdot 7 \cdot 8 = 336\), and \(336 \cdot 21 = 7056\),

  • Area \(\sqrt{7056} = 84\) braccia quadre, cathetus \(AD = 12\), segments \(5, 9\).

Returns:

Exact HeronTriangleResult containing the proven Model and invariants.

geometor.pacioli.construct_triangle_division_cevian(ratio_p: int = 1, ratio_q: int = 2) → TriangleDivisionResult

Divide \(\triangle GBA\) (13, 14, 15) in ratio p : q by a vertex cevian.

Implements the first problem of Part II, Distinctio IV: De divisione superficierum (following Euclid VI.1 and Leonardo Pisano’s Practica Geometriae): dividing base \(GB\) at \(K\) in ratio \(p : q\) via Thales’s intercept construction (VI.10) so \(\text{Area}(\triangle GAK) : \text{Area}(\triangle KAB) = p : q\).

Parameters:
  • ratio_p – Positive integer share adjacent to G (default 1).

  • ratio_q – Positive integer share adjacent to B (default 2).

Returns:

Exact TriangleDivisionResult with verified polygonal areas.

geometor.pacioli.construct_triangle_division_parallel(ratio_p: int = 1, ratio_q: int = 1) → TriangleDivisionResult

Divide \(\triangle GBA\) in ratio p : q by a cut parallel to side BA.

Implements Pacioli’s De divisione superficierum (Part II, Distinctio IV, Euclid VI.13 + VI.19): to cut off \(\triangle GUV \sim \triangle GBA\) with \(\text{Area}(\triangle GUV) / \text{Area}(\triangle GBA) = p / (p + q)\), first divide \(GB\) at \(K\) with \(GK / GB = p / (p+q)\), then construct the geometric mean \(GU = \sqrt{GB \cdot GK}\) via a semicircle on \(GB\) and draw \(UV \parallel BA\).

Parameters:
  • ratio_p – Positive integer share for sub-triangle GUV (default 1, bisecting area).

  • ratio_q – Positive integer share for trapezoid UBAV (default 1).

Returns:

Exact TriangleDivisionResult with verified radical cut coordinates and rational areas.

geometor.pacioli.dodecahedron_in_sphere_sqrt48() → DodecahedronAxis48Result

Reproduce Problem 21 on Part II, fol. 70r (dodecahedron in sphere of axis sqrt(48)).

On fol. 70r, Pacioli takes a sphere whose axis has squared length (possanza) 48: by Euclid XIII.15, the inscribed cube has squared edge 48 / 3 = 16, so edge 4; dividing 4 in extreme and mean ratio (Campanus XIV.18 / Euclid XIII.17 corollary) yields major part sqrt(20) - 2 (the dodecahedron edge) and minor part 6 - sqrt(20).

Returns:

Exact DodecahedronAxis48Result verified against inscribed_polyhedra_sphere_table().

geometor.pacioli.inscribed_polyhedra_sphere_table(diameter: int | sympy.Expr = 6) → dict[str, InscribedPolyhedronSpec]

Compute exact symbolic metrics for regular & Archimedean solids in a sphere of diameter D.

Defaults to diameter = 6 (Summa Part II, Distinctio VIII: De corporibus regularibus, fol. 69v–70r), reproducing both Euclid Book XIII’s five regular solids and Pacioli’s dependent Archimedean solids inherited from Piero della Francesca:

  • truncated_tetrahedron (fol. 69v, prob. 15–16): \(e^2 = \frac{2}{11} D^2\) (\(= \frac{72}{11} = 6\frac{6}{11}\) for \(D=6\), matching Pacioli’s ℞.6 6/11!).

  • cuboctahedron (fol. 69v–70r, prob. 17–19): \(e = \frac{1}{2} D\) (\(= 3\) braccia for \(D=6\)).

Parameters:

diameter – Exact positive sphere diameter D (default 6).

Returns:

Dictionary mapping solid keys to InscribedPolyhedronSpec.