Wavelength
Privacy-focused, cross-platform, and open-source communication application
Loading...
Searching...
No Matches
BlobPath Class Reference

Provides a static utility function to create a smooth QPainterPath from blob control points. More...

#include <blob_path.h>

Collaboration diagram for BlobPath:

Static Public Member Functions

static QPainterPath CreateBlobPath (const std::vector< QPointF > &control_points, int num_of_points)
 Creates a closed, smooth QPainterPath using Catmull-Rom-like spline interpolation.
 

Detailed Description

Provides a static utility function to create a smooth QPainterPath from blob control points.

This class is used to generate the visual outline of the blob by creating a closed curve that interpolates smoothly through the given control points.

Member Function Documentation

◆ CreateBlobPath()

QPainterPath BlobPath::CreateBlobPath ( const std::vector< QPointF > & control_points,
int num_of_points )
static

Creates a closed, smooth QPainterPath using Catmull-Rom-like spline interpolation.

Iterates through the provided control points and generates cubic Bezier segments to create a smooth, closed curve passing through them. Uses neighboring points to calculate control handles for the Bézier curves, effectively creating a Catmull-Rom spline effect with a specified tension. Includes validation to skip invalid points.

Parameters
control_pointsA vector containing the QPointF coordinates of the blob's control points.
num_of_pointsThe number of control points in the vector. Should match control_points.size().
Returns
A QPainterPath representing the smooth outline of the blob. Returns an empty path if control_points are empty.
Here is the call graph for this function:
Here is the caller graph for this function:

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