Dynamical system model
Loading...
Searching...
No Matches
dsf::mdt::PointsCluster Class Reference

Represents a cluster of activity points, providing main methods to manage and analyze them. More...

#include <PointsCluster.hpp>

Public Member Functions

 PointsCluster ()=default
 Default constructor for PointsCluster.
 
 PointsCluster (PointsCluster const &other)=default
 Copy constructor for PointsCluster.
 
void addActivityPoint (ActivityPoint const &activityPoint) noexcept
 Add an activity point to the cluster.
 
void addPoint (std::time_t timestamp, dsf::geometry::Point const &point) noexcept
 Add a point with timestamp to the cluster.
 
void sort () const noexcept
 Sort the activity points in the cluster by timestamp.
 
dsf::geometry::Point centroid () const
 Compute and return the centroid of the cluster.
 
std::size_t size () const noexcept
 Get the number of activity points in the cluster.
 
bool empty () const noexcept
 Check if the cluster is empty.
 
std::vector< ActivityPoint > const & points () const noexcept
 Get the underlying activity points.
 
std::time_t firstTimestamp () const
 Get the timestamp of the first activity point in the cluster.
 
std::time_t lastTimestamp () const
 Get the timestamp of the last activity point in the cluster.
 
std::time_t duration () const
 Get the duration (in seconds) between the first and last activity points.
 

Detailed Description

Represents a cluster of activity points, providing main methods to manage and analyze them.

Constructor & Destructor Documentation

◆ PointsCluster()

dsf::mdt::PointsCluster::PointsCluster ( PointsCluster const & other)
default

Copy constructor for PointsCluster.

Parameters
otherThe PointsCluster to copy from.

Member Function Documentation

◆ addActivityPoint()

void dsf::mdt::PointsCluster::addActivityPoint ( ActivityPoint const & activityPoint)
noexcept

Add an activity point to the cluster.

Parameters
activityPointThe activity point to add.

◆ addPoint()

void dsf::mdt::PointsCluster::addPoint ( std::time_t timestamp,
dsf::geometry::Point const & point )
noexcept

Add a point with timestamp to the cluster.

Parameters
timestampThe timestamp of the activity point.
pointThe geometric point of the activity point.

◆ centroid()

dsf::geometry::Point dsf::mdt::PointsCluster::centroid ( ) const

Compute and return the centroid of the cluster.

Returns
The centroid point of the cluster.

◆ duration()

std::time_t dsf::mdt::PointsCluster::duration ( ) const

Get the duration (in seconds) between the first and last activity points.

Returns
The duration in seconds.
Exceptions
std::runtime_errorif the cluster is empty.

◆ empty()

bool dsf::mdt::PointsCluster::empty ( ) const
inlinenoexcept

Check if the cluster is empty.

Returns
True if the cluster has no activity points, false otherwise.

◆ firstTimestamp()

std::time_t dsf::mdt::PointsCluster::firstTimestamp ( ) const

Get the timestamp of the first activity point in the cluster.

Returns
The timestamp of the first activity point.
Exceptions
std::runtime_errorif the cluster is empty.

◆ lastTimestamp()

std::time_t dsf::mdt::PointsCluster::lastTimestamp ( ) const

Get the timestamp of the last activity point in the cluster.

Returns
The timestamp of the last activity point.
Exceptions
std::runtime_errorif the cluster is empty.

◆ points()

std::vector< ActivityPoint > const & dsf::mdt::PointsCluster::points ( ) const
inlinenoexcept

Get the underlying activity points.

Returns
A const reference to the vector of activity points.

◆ size()

std::size_t dsf::mdt::PointsCluster::size ( ) const
inlinenoexcept

Get the number of activity points in the cluster.

Returns
The size of the cluster.

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