src/map/map.cpp
/**
    transform vector in world frame to frenet frame .

    @param x world x.
    @param y world y.
    @param theta world theta. 
    @param vx world vx.
    @param vy world vy.   
    @return vector in frenet frame.
*/
transform vector in world frame to frenet frame .
transform vector in world frame to frenet frame .
std::vector<double> Map::get_frenet_frame_vector(double x, double y, double theta, double vx, double vy) {
	int next_waypoint_index = get_next_waypoint(x,y, theta);
	int prev_waypoint_index = (0 == next_waypoint_index ? center_line_x.size() - 1 : next_waypoint_index - 1);
    double nx = center_line_dx[prev_waypoint_index];
    double ny = center_line_dy[prev_waypoint_index];
    double vs = (-vx*ny + vy*nx);
    double vd = (+vx*nx + vy*ny);
    return {vs, vd};
}
std :: vector < double > Map :: get_frenet_frame_vector ( double x , double y , double theta , double vx , double vy ) { int next_waypoint_index = get_next_waypoint ( x , y , theta ) ; int prev_waypoint_index = ( 0 == next_waypoint_index ? center_line_x . size ( ) - 1 : next_waypoint_index - 1 ) ; double nx = center_line_dx [ prev_waypoint_index ] ; double ny = center_line_dy [ prev_waypoint_index ] ; double vs = ( - vx * ny + vy * nx ) ; double vd = ( + vx * nx + vy * ny ) ; return { vs , vd } ; }
transform vector in world frame to frenet frame .
transform vector in world frame to frenet frame .
// localize lane segment: // unit normal vector: