Skip to content

Commit 0aba093

Browse files
committed
refactor(Geometry/Euclidean): use orthogonalProjectionSpan more (#24503)
Make more use of `orthogonalProjectionSpan` in `Mathlib.Geometry.Euclidean.Projection` and `Mathlib.Geometry.Euclidean.SignedDist`. Split out from #23752.
1 parent f4adaa2 commit 0aba093

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

Mathlib/Geometry/Euclidean/Projection.lean

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -567,16 +567,14 @@ theorem dist_sq_eq_dist_orthogonalProjection_sq_add_dist_orthogonalProjection_sq
567567
variable {n : ℕ} [NeZero n] (s : Simplex ℝ P n)
568568

569569
@[simp] lemma ne_orthogonalProjection_faceOpposite (i : Fin (n + 1)) :
570-
s.points i ≠
571-
orthogonalProjection (affineSpan ℝ (Set.range (s.faceOpposite i).points)) (s.points i) := by
570+
s.points i ≠ (s.faceOpposite i).orthogonalProjectionSpan (s.points i) := by
572571
intro h
573-
rw [eq_comm, EuclideanGeometry.orthogonalProjection_eq_self_iff,
572+
rw [eq_comm, orthogonalProjectionSpan, EuclideanGeometry.orthogonalProjection_eq_self_iff,
574573
mem_affineSpan_range_faceOpposite_points_iff] at h
575574
simp at h
576575

577576
lemma dist_orthogonalProjection_faceOpposite_pos (i : Fin (n + 1)) :
578-
0 < dist (s.points i)
579-
(orthogonalProjection (affineSpan ℝ (Set.range (s.faceOpposite i).points)) (s.points i)) := by
577+
0 < dist (s.points i) ((s.faceOpposite i).orthogonalProjectionSpan (s.points i)) := by
580578
simp
581579

582580
end Simplex

Mathlib/Geometry/Euclidean/SignedDist.lean

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ noncomputable def signedInfDist : P →ᵃ[ℝ] ℝ :=
9898
AffineSubspace.signedInfDist (affineSpan ℝ (Set.range (s.faceOpposite i).points)) (s.points i)
9999

100100
lemma signedInfDist_apply_self : s.signedInfDist i (s.points i) = ‖s.points i -ᵥ
101-
orthogonalProjection (affineSpan ℝ (Set.range (s.faceOpposite i).points)) (s.points i)‖ :=
101+
(s.faceOpposite i).orthogonalProjectionSpan (s.points i)‖ :=
102102
AffineSubspace.signedInfDist_apply_self _ _
103103

104104
variable {i} in
@@ -108,11 +108,10 @@ lemma signedInfDist_apply_of_ne {j : Fin (n + 1)} (h : j ≠ i) :
108108

109109
lemma signedInfDist_affineCombination {w : Fin (n + 1) → ℝ} (h : ∑ i, w i = 1) :
110110
s.signedInfDist i (Finset.univ.affineCombination ℝ s.points w) = w i * ‖s.points i -ᵥ
111-
orthogonalProjection (affineSpan ℝ (Set.range (s.faceOpposite i).points)) (s.points i)‖ := by
111+
(s.faceOpposite i).orthogonalProjectionSpan (s.points i)‖ := by
112112
rw [Finset.map_affineCombination _ _ _ h,
113113
Finset.univ.affineCombination_apply_eq_lineMap_sum w (s.signedInfDist i ∘ s.points) 0
114-
‖s.points i -ᵥ
115-
orthogonalProjection (affineSpan ℝ (Set.range (s.faceOpposite i).points)) (s.points i)‖
114+
‖s.points i -ᵥ (s.faceOpposite i).orthogonalProjectionSpan (s.points i)‖
116115
{i} h]
117116
· simp [AffineMap.lineMap_apply]
118117
· simp [signedInfDist_apply_self]
@@ -125,7 +124,7 @@ variable {s} in
125124
lemma abs_signedInfDist_eq_dist_of_mem_affineSpan_range {p : P}
126125
(h : p ∈ affineSpan ℝ (Set.range s.points)) :
127126
|s.signedInfDist i p| =
128-
dist p (orthogonalProjection (affineSpan ℝ (Set.range (s.faceOpposite i).points)) p) := by
127+
dist p ((s.faceOpposite i).orthogonalProjectionSpan p) := by
129128
apply AffineSubspace.abs_signedInfDist_eq_dist_of_mem_affineSpan_insert
130129
rw [affineSpan_insert_affineSpan]
131130
convert h

0 commit comments

Comments
 (0)