Public/Get-NormalizedVector.ps1
|
function Get-NormalizedVector { <# .SYNOPSIS Normalizes a vector to unit length. .DESCRIPTION Returns a new Vector with the same direction as the input but with a magnitude of 1. Throws if the input vector has zero magnitude. .PARAMETER Vector The vector to normalize. .EXAMPLE Get-NormalizedVector -Vector (New-Vector 3,4) #> [CmdletBinding()] [OutputType('Vector')] param( [Parameter(Mandatory, Position = 0)] [Vector] $Vector ) return $Vector.Normalize() } |