@@ -768,8 +768,9 @@ function calculate_span(wing::AbstractWing)
768768end
769769
770770# Project point onto plane
771- function project_onto_plane (point:: PosVector , normal:: Vector{Float64} )
772- return point .- dot (point, normal) .* normal
771+ @inline function project_onto_plane! (point_proj, point, normal)
772+ point_proj .= point .- (point ⋅ normal) .* normal
773+ return nothing
773774end
774775
775776"""
@@ -784,6 +785,11 @@ function calculate_projected_area(wing::AbstractWing,
784785 z_plane_vector:: Vector{Float64} = [0.0 , 0.0 , 1.0 ])
785786 # Normalize plane normal vector
786787 z_plane_vector = z_plane_vector ./ norm (z_plane_vector)
788+
789+ LE_current_proj = zeros (MVec3)
790+ TE_current_proj = zeros (MVec3)
791+ LE_next_proj = zeros (MVec3)
792+ TE_next_proj = zeros (MVec3)
787793
788794 # Calculate area by summing trapezoid areas
789795 projected_area = 0.0
@@ -795,10 +801,10 @@ function calculate_projected_area(wing::AbstractWing,
795801 TE_next = wing. sections[i+ 1 ]. TE_point
796802
797803 # Project points
798- LE_current_proj = project_onto_plane ( LE_current, z_plane_vector)
799- TE_current_proj = project_onto_plane ( TE_current, z_plane_vector)
800- LE_next_proj = project_onto_plane ( LE_next, z_plane_vector)
801- TE_next_proj = project_onto_plane ( TE_next, z_plane_vector)
804+ project_onto_plane! (LE_current_proj, LE_current, z_plane_vector)
805+ project_onto_plane! (TE_current_proj, TE_current, z_plane_vector)
806+ project_onto_plane! (LE_next_proj, LE_next, z_plane_vector)
807+ project_onto_plane! (TE_next_proj, TE_next, z_plane_vector)
802808
803809 # Calculate projected dimensions
804810 chord_current = norm (TE_current_proj - LE_current_proj)
0 commit comments