UAV Simulator
Loading...
Searching...
No Matches
Path Class Reference

Represents a sequence of connected path segments (e.g., straight lines, arcs). More...

#include <path.h>

Public Member Functions

void addStraightSegment (const easy3d::vec3 &start, const easy3d::vec3 &end)
 Adds a straight line segment to the path.
 
std::vector< easy3d::vec3generateWaypoints (float spacing) const
 Generates a list of evenly spaced waypoints along the entire path.
 
void draw (easy3d::Viewer &viewer) const
 Renders the full path in the viewer.
 

Private Attributes

std::vector< std::unique_ptr< LineSegment > > segments
 The sequence of segments (e.g., lines, arcs) that make up the full path.
 

Detailed Description

Represents a sequence of connected path segments (e.g., straight lines, arcs).

This class allows the construction of a path using various types of segments and supports generating discrete waypoints and visualizing the full path.

Member Function Documentation

◆ addStraightSegment()

void Path::addStraightSegment ( const easy3d::vec3 start,
const easy3d::vec3 end 
)

Adds a straight line segment to the path.

Parameters
startThe 3D start point of the segment.
endThe 3D end point of the segment.

This function creates a new LineSegment instance and appends it to the internal list of path segments.

Parameters
startStart position of the line segment in 3D space.
endEnd position of the line segment in 3D space.

◆ draw()

void Path::draw ( easy3d::Viewer &  viewer) const

Renders the full path in the viewer.

Renders the entire path as a sequence of line segments in the viewer.

This method draws all path segments currently stored in the path. Each segment handles its own rendering logic (e.g., line, arc).

Parameters
viewerReference to the Easy3D viewer used for rendering.

This method converts the path into a set of line segments using sampled waypoints and sends the data to an Easy3D LinesDrawable for visualization.

Parameters
viewerReference to the Easy3D viewer instance.

◆ generateWaypoints()

std::vector< easy3d::vec3 > Path::generateWaypoints ( float  spacing) const

Generates a list of evenly spaced waypoints along the entire path.

Generates waypoints along all segments in the path.

Parameters
spacingDistance (in world units) between consecutive waypoints.
Returns
A vector of 3D waypoints covering all segments in the path.

This method queries each segment in the path to compute evenly spaced waypoints, then aggregates them into a single list.

Parameters
spacingDesired distance between consecutive waypoints.
Returns
A vector of 3D points representing the waypoints.

Member Data Documentation

◆ segments

std::vector<std::unique_ptr<LineSegment> > Path::segments
private

The sequence of segments (e.g., lines, arcs) that make up the full path.


The documentation for this class was generated from the following files: