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

Represents a simple straight line segment between two 3D points. More...

#include <line_segment.h>

Inheritance diagram for LineSegment:
Collaboration diagram for LineSegment:

Public Member Functions

 LineSegment (const easy3d::vec3 &start, const easy3d::vec3 &end)
 Constructs a LineSegment with specified start and end points.
 
std::vector< easy3d::vec3generateWaypoints (float spacing) const override
 Generates a set of waypoints spaced along the line segment.
 
- Public Member Functions inherited from PathSegment
virtual ~PathSegment ()=default
 Virtual destructor for safe polymorphic destruction.
 

Private Attributes

easy3d::vec3 start_
 
easy3d::vec3 end_
 

Detailed Description

Represents a simple straight line segment between two 3D points.

Inherits from PathSegment and implements waypoint generation along the line.

Constructor & Destructor Documentation

◆ LineSegment()

LineSegment::LineSegment ( const easy3d::vec3 start,
const easy3d::vec3 end 
)

Constructs a LineSegment with specified start and end points.

Parameters
startThe starting point of the line segment.
endThe ending point of the line segment.

Member Function Documentation

◆ generateWaypoints()

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

Generates a set of waypoints spaced along the line segment.

Generates waypoints spaced along the line segment.

Parameters
spacingThe distance between consecutive waypoints.
Returns
A vector of 3D points representing the waypoints on the segment.

The function calculates equally spaced points starting from the start point up to the end point based on the given spacing.

Parameters
spacingDistance between consecutive waypoints.
Returns
std::vector<easy3d::vec3> A vector containing the generated waypoints.

Implements PathSegment.

Member Data Documentation

◆ end_

easy3d::vec3 LineSegment::end_
private

End point of the line segment

◆ start_

easy3d::vec3 LineSegment::start_
private

Start point of the line segment


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