# Attractive Centers — geometry explorer

**Live app:** https://ismaa3iil.fyi/attractive-centers/explorer/

Free software by Ismail Hammoudeh, MIT license. The license covers this directory,
not the PDF papers in its parent directory.

## Use

- **Triangle:** drag any vertex. Gold is the standard chest; green is the hull
  of the selected attractive family. Hover over green points for their names.
- **Four planar points:** independently toggle parallelogram, bisector, network,
  and stability constructions. Stability is OFF initially: it needs absorption.
- **Tetrahedron:** drag empty space to rotate; drag a vertex in the screen plane.
  Exact x, y, z coordinates are editable. Scroll to zoom. Arrow keys rotate;
  the `0` key fits the view.

Planar coordinate scales are equal. Vertex positions do not jump when overlays
are selected. The viewport remains fixed during dragging; “Fit view” recenters it.
No account, backend, external library, or telemetry is used. Calculations run in
a Web Worker. Brief theory and live percentages are displayed beside the plot.

## Mathematics and scope

Every half-space is written `n ⋅ x ≥ b`. The construction requires symmetry,
attractivity along straight vertex motions, and continuous extension to the
degenerate configurations used as predecessors. It does **not** assume that
arbitrary nonparallel displacements transport a common supporting inequality.

### Triangle: outer chest

Intersect the convex hull with (1) the three strips between the perpendicular
bisector of each side and its parallel altitude, and (2) the anticomplementary
triangle of the **internal** Napoleon centroids. The internal equilateral apex
lies on the same side of a side as the opposite vertex. For an equilateral
triangle, this construction reduces to the centroid. The strip overlay is clipped
to the original triangle; the Napoleon triangle is shown unclipped.

### Triangle: attractive inner family

The green polygon is the convex hull of X(1), X(10), X(2), and 49 power centers
M_p with equally spaced p in `[4−2√2, 4+2√2]`. M_p minimizes
`sum(norm(x−p_i)^p)`; the computation uses its gradient, Hessian and a damped
Newton method. Papers III and IV provide the attractivity results. “Best” means
the extreme points of this sampled family for the current triangle, not a proof
of extremality in the class of all attractive centers.

The power interval is the sharp **universal** guarantee for the power family;
this does not assert that every endpoint is a boundary point of each triangle's
Heart. X(1)–X(10) supplies the sharp segment on its centroidal ray. Numerical
power samples whose convergence check fails are omitted and counted in the UI.
No center has been clipped or projected into the standard chest to hide a failure.

The older 50-point ETC base was generated by scans with subsequently identified
evaluation problems. It is not included as certified data. Noninteger power
centers also need not be analytic at every configuration: this green region
uses the regularity/extension conventions for radial centers in Paper III,
and is not labeled as an exact maximal **analytic** Heart.

### Four points: four constructions

1. **Parallelogram.** For each pair partition `ij | kl`, put
   `m=(p_i+p_j)/2`, `q=(p_k+p_l)/2`, `d=m−q`. Retain the slab
   `min(d⋅m,d⋅q) ≤ d⋅x ≤ max(d⋅m,d⋅q)`.
   Translating the other pair to equal midpoints gives a centrally symmetric
   predecessor; parallel restoration proves the bound. Equal midpoints force
   the center itself, not merely a vacuous zero-normal inequality.
2. **Bisectors.** Set `u=p_j−p_i`, `m=(p_i+p_j)/2`.
   If both other points have the same sign σ of `u⋅(p−m)`, impose
   `σu⋅(x−m) ≥ 0`. Project the other points onto the bisector, then restore them
   in the same parallel direction. If both lie on the bisector, symmetry gives
   equality; the implementation imposes both half-spaces.
3. **Two-order network.** For every labeling and both equilateral apices C0
   on AB, let D0 be the centroid of ABC0, `u=C−C0`, `v=D−D0`. The initial
   four-point center is D0. If C moves first, its intermediate center belongs to
   `R_C = parallelogram_chest(A,B,C,D0) ∩ {u⋅(y−D0)≥0}`.
   Restoring D therefore gives `v⋅x ≥ min_{y in R_C} v⋅y`.
   Reverse the order to obtain `u⋅x ≥ min_{y in R_D} u⋅y`.
   Intersect the resulting inequalities for all 48 scenarios. This is a finite
   network relaxation, not the optimal chest. The intermediate center is
   retained; it is not replaced by an invalid OR of endpoint inequalities.
   This method uses parallelogram chests at intermediate nodes, even when the
   separate final-configuration parallelogram option is off.
4. **Stability / absorption (conditional).** This assumes a family across
   cardinalities satisfying `X4(A,B,C,X3(A,B,C)) = X3(A,B,C)`.
   For an omitted point p and the remaining triangle chest T, some q in T must
   satisfy `(p−q)⋅(x−q) ≥ 0`. At fixed x this expression is convex in q, so
   its maximum over the polygon T is attained at a vertex. Thus use a finite
   OR over vertices. Intersect the four OR clauses and the hull, then take
   the convex hull to obtain a conditional chest. A clause containing q=p is
   identically true. We intersect this convexified chest with other checked
   chests; convexification can weaken the result, but does not invalidate it.

The optional ABC triangle chest is only a visual reference. It is **not**
automatically a four-point chest and is never imposed on the four-point center.

### Three dimensions

Intersect the tetrahedron's four inward facet half-spaces with the three
opposite-edge slabs and the useful bisector planes. Vertices are feasible
triple-plane intersections; faces are ordered in their planes. Volume is the
sum of tetrahedra from an interior point to triangularized faces. These are
outer constructions, not a claim to the OSC. Planar network and absorption
algorithms are not silently extended to tetrahedra.

### Percentages: a reproducible reference

For `A=(0,0), B=(21,0), C=(5,12), D=(26/3,4)`, the hull area is 126.
Each “alone” row includes the hull and **only that final-region construction**:

| Construction | Hull area retained | Hull area excluded |
|---|---:|---:|
| Parallelogram | 58.410491% | 41.589509% |
| Bisectors alone | 21.239749% | 78.760251% |
| Network alone | 31.369615% | 68.630385% |
| Stability alone (conditional) | 82.260924% | 17.739076% |
| First three intersected | 13.412708% | 86.587292% |

For ABC alone, the standard chest retains 5.930191% and the sampled inner
family retains approximately 0.398093% of the triangle's area. An inner hull's
complement is **not** ruled out for attractive centers; its percentage is a
size comparison only. Areas/volumes are floating-point values, not interval
certificates or percentages of centers.

## Run locally and reproduce

Serve this directory over HTTP (module workers cannot run from `file://`):

```sh
python -m http.server 8772
# Open http://localhost:8772/
node tests.mjs
julia --startup-file=no tests.jl
```

The browser engine is plain JavaScript so it can run directly on GitHub Pages.
The scientific companion is genuine Julia using only `LinearAlgebra` from the
standard library. Example:

```julia
include("AttractiveCenters.jl")
using .AttractiveCenters
p = [[0.,0.], [21.,0.], [5.,12.], [26/3,4.]]
r = explore_four(p; stability=false)
100 * polygon_area(r.chests.selected) / polygon_area(r.chests.hull)
t = explore_triangle(p[1:3])
# Undo normalization for the chest vertices:
world = [t.center + t.scale*x for x in t.chest.polygon]
v = explore_tetra([[0.,0.,0.],[2.,0.,0.],[.3,1.8,0.],[.5,.6,2.2]])
```

High-level `explore_*` functions normalize coordinates and return the inverse
map `(center, scale)`. Low-level functions assume moderate coordinate scales.
Regression tests cover reference percentages, equality/symmetry, similarity
and permutation invariance, and seeded random configurations. Collinear
triangles/four-point inputs and flat tetrahedra get explicit messages in the
browser. Near-degenerate inputs still have the limitations of floating-point
geometry; this is research software, not a formal proof assistant.

An optional WebMCP tool configures the same vertex state when the hosting browser
supports it. It waits for computation, validates input, and never publishes or
transmits geometry. Unsupported browsers simply use the normal UI.

## Papers

The theory follows the four [Attractive Centers papers](../), especially
Paper I (symmetry-displacement chests), Paper III (radial attractivity), and
Paper IV (analytic inner families and nonlocal constraints).
