///|
fn line_offset_difference(
a : @types.Point2,
b : @types.Point2,
) -> @types.Point2 raise @types.GroundError {
@types.Point2::new(a.x - b.x, a.y - b.y)
}
///|
// h = cross(u, v)/|u|. The line moves with its two anchors:
// dh = n.dv - (n.du/|u|) * (t.v), where t=u/|u| and n=(-t.y,t.x).
// Use the raw-edge compensated normal projection before scalar arithmetic.
fn line_offset_project(
reference : CalibrationSensitivityPair,
length : Double,
direction : @types.Point2,
offset : @types.Point2,
deltas : Array[@types.Point2],
) -> (Double, Array[Double]) raise @types.GroundError {
let edge = reference.displacement_m
let value = offset.signed_line_distance(edge)
let responses : Array[Double] = []
for i in 0.. CalibrationLineOffsetSensitivity raise @types.GroundError {
let deltas : Array[@types.Point2] = []
for i in 0.. CalibrationLineOffsetSensitivity raise @types.GroundError {
let reference = self.evaluate_pair(line_start, line_end)
let (length, direction) = distance_direction(reference.displacement_m)
line_offset_value(reference, length, direction, self.evaluate(pixel))
}
///|
/// Compare two signed offsets against one common infinite line. The difference
/// and its responses are projected directly from first-minus-second positions
/// and responses, avoiding subtraction of large rounded offsets or variances.
/// Contributions describe only the supplied first-order calibration modes.
pub fn HomographySensitivity::compare_line_offsets(
self : HomographySensitivity,
line_start : @types.Point2,
line_end : @types.Point2,
first_pixel : @types.Point2,
second_pixel : @types.Point2,
) -> CalibrationLineOffsetComparison raise @types.GroundError {
let reference = self.evaluate_pair(line_start, line_end)
let (length, direction) = distance_direction(reference.displacement_m)
let a = self.evaluate(first_pixel)
let b = self.evaluate(second_pixel)
let first = line_offset_value(reference, length, direction, a)
let second = line_offset_value(reference, length, direction, b)
let deltas : Array[@types.Point2] = []
for i in 0..