← Back

Fragment Reassembly Algorithm

To match two broken shards, we calculate the curvature profile of the break edge. If $C_1$ is the curvature vector of Shard A and $C_2$ is Shard B (reversed), we minimize the Euclidean distance:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
import numpy as np
from scipy.spatial.distance import euclidean

def match_score(edge_a, edge_b):
    # Reverse edge_b to align orientation
    edge_b_reversed = np.flip(edge_b)
    
    # Calculate RMSE (Root Mean Square Error)
    score = euclidean(edge_a, edge_b_reversed)
    
    return score

# Example: Perfect match approaches 0
shard_1 = np.array([0.1, 0.4, 0.8, 0.5])
shard_2 = np.array([0.5, 0.8, 0.4, 0.1])

print(f"Fit Score: {match_score(shard_1, shard_2)}")
← Bayesian Calibration Logic
Dimensionality Reduction in Clay →