% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/R-trajectory.R
\name{unit_normal_left}
\alias{unit_normal_left}
\title{Compute the left unit normal of the directed segment A->B}
\usage{
unit_normal_left(A, B)
}
\arguments{
\item{A}{A data frame with columns `x` and `y` representing point A.
If it contains multiple rows, only the first row is used.}

\item{B}{A data frame with columns `x` and `y` representing point B.
If it contains multiple rows, only the first row is used.}
}
\value{
A numeric vector of length 2 with named components:
\describe{
  \item{nx}{x-component of the left unit normal.}
  \item{ny}{y-component of the left unit normal.}
}
}
\description{
Returns the unit-length normal vector pointing to the left of the directed
segment \eqn{A \rightarrow B}. For a direction vector \eqn{v = (vx, vy)},
the left normal is \eqn{(-vy, vx)} normalized by \eqn{||v||}.
}
\examples{
# Horizontal segment to the right: (0,0) -> (1,0)
#    Left normal points upward: (0, 1)
A <- data.frame(x = 0, y = 0)
B <- data.frame(x = 1, y = 0)
unit_normal_left(A, B)
}
