LuciadCPillar 2024.1.06
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
luciad::BezierCurve Class Referencefinal

Represents a quadratic or cubic BezierCurve. More...

#include <luciad/geometries/BezierCurve.h>

Inheritance diagram for luciad::BezierCurve:
luciad::Curve luciad::Geometry

Public Member Functions

 ~BezierCurve () override
 
Coordinate computePoint (double parameter) const override
 Computes a point of the curve, defined by the given parameter. More...
 
Bounds getBounds () const override
 Returns the bounds for the geometry object. More...
 
Coordinate getControlPoint (size_t index) const
 Retrieves the control point at the given index. More...
 
size_t getControlPointCount () const
 Returns the amount of control points defining the Bézier curve. More...
 
Coordinate getEndPoint () const
 Returns the end point (third control point) of the quadratic Bézier curve. More...
 
double getLength2D () const override
 Returns the length of the curve. More...
 
std::shared_ptr< luciad::CoordinateReferencegetReference () const override
 Returns the coordinate reference of the geometry. More...
 
Coordinate getStartPoint () const
 Returns the start point (first control point) of the quadratic Bézier curve. More...
 
std::shared_ptr< BezierCurvemoveControlPoint (Coordinate newLocation, size_t index) const
 Moves the control point at the given index to a new location. More...
 
std::shared_ptr< BezierCurvemoveEndPoint (Coordinate newLocation) const
 Returns a copy of the Bézier curve with a moved end point. More...
 
std::shared_ptr< BezierCurvemoveStartPoint (Coordinate newLocation) const
 Returns a copy of the Bézier curve with a moved start point. More...
 
virtual Coordinate computePoint (double parameter) const =0
 Computes a point of the curve, defined by the given parameter. More...
 
virtual double getLength2D () const =0
 Returns the length of the curve. More...
 
- Public Member Functions inherited from luciad::Geometry
virtual ~Geometry ()=default
 
virtual Bounds getBounds () const =0
 Returns the bounds for the geometry object. More...
 
virtual std::shared_ptr< CoordinateReferencegetReference () const =0
 Returns the coordinate reference of the geometry. More...
 

Protected Member Functions

size_t getHash () const override
 Returns the hash value for this geometry. More...
 
virtual size_t getHash () const =0
 Returns the hash value for this geometry. More...
 

Detailed Description

Represents a quadratic or cubic BezierCurve.

A Bézier curve is defined by 3 or 4 control points:

  • the start point
  • one control point for a quadratic curve, or two control points for a cubic curve
  • the end point
See also
GeometryFactory::createQuadraticBezierCurve
GeometryFactory::createCubicBezierCurve

Constructor & Destructor Documentation

◆ ~BezierCurve()

luciad::BezierCurve::~BezierCurve ( )
override

Member Function Documentation

◆ computePoint()

Coordinate luciad::BezierCurve::computePoint ( double  parameter) const
overridevirtual

Computes a point of the curve, defined by the given parameter.

  1. At parameter 0, the point is the start point of the curve.
  2. At parameter 1, the point is the end point of the curve.
Parameters
parameterthe parameter value, within [0,1], to compute the point location for.
Returns
the computed point location.
Exceptions
luciad::InvalidArgumentExceptionif parameter is not within [0,1], or if the point could not be computed. For example, when the curve is defined by invalid points.

Implements luciad::Curve.

◆ getBounds()

Bounds luciad::BezierCurve::getBounds ( ) const
overridevirtual

Returns the bounds for the geometry object.

Returns
the bounds for the geometry object.
Exceptions
luciad::InvalidArgumentExceptionif the bounds could not be computed. For example, when the geometry is defined by invalid points.

Implements luciad::Geometry.

◆ getControlPoint()

Coordinate luciad::BezierCurve::getControlPoint ( size_t  index) const

Retrieves the control point at the given index.

The available indices depends on the degree of the Bézier curve.

  • Quadratic Bézier curve (degree 2 => 3 control points):
    • 0 => start control point
    • 1 => intermediate control point
    • 2 => end control point
  • Cubic Bézier curve (degree 3 => 4 control points):
    • 0 => start control point
    • 1 or 2 => intermediate control points
    • 3 => end control point

Using indices out of this range will result in an exception.

Bézier curves with a higher degree are currently not supported.

Parameters
indexthe index of the control point
Returns
a copy of the Bézier curve with a moved control point.
Exceptions
InvalidArgumentExceptionwhen the index of the control point is out of range (i.e. larger than 2 or 3, depending on the degree of the Bézier curve)
Since
2024.1

◆ getControlPointCount()

size_t luciad::BezierCurve::getControlPointCount ( ) const

Returns the amount of control points defining the Bézier curve.

  • For a quadratic curve, it returns 3.
  • For a cubic curve, it returns 4.
Returns
the amount of control points defining the Bézier curve.
Since
2024.1

◆ getEndPoint()

Coordinate luciad::BezierCurve::getEndPoint ( ) const

Returns the end point (third control point) of the quadratic Bézier curve.

Returns
the end point (third control point) of the quadratic Bézier curve.

◆ getHash()

size_t luciad::BezierCurve::getHash ( ) const
overrideprotectedvirtual

Returns the hash value for this geometry.

Returns
the hash value for this geometry.

Implements luciad::Geometry.

◆ getLength2D()

double luciad::BezierCurve::getLength2D ( ) const
overridevirtual

Returns the length of the curve.

Returns
the length of the curve.
Exceptions
luciad::InvalidArgumentExceptionif the length could not be computed. For example, when the curve is defined by invalid points.

Implements luciad::Curve.

◆ getReference()

std::shared_ptr< luciad::CoordinateReference > luciad::BezierCurve::getReference ( ) const
overridevirtual

Returns the coordinate reference of the geometry.

Returns
the coordinate reference of the geometry.

Implements luciad::Geometry.

◆ getStartPoint()

Coordinate luciad::BezierCurve::getStartPoint ( ) const

Returns the start point (first control point) of the quadratic Bézier curve.

Returns
the start point (first control point) of the quadratic Bézier curve.

◆ moveControlPoint()

std::shared_ptr< BezierCurve > luciad::BezierCurve::moveControlPoint ( Coordinate  newLocation,
size_t  index 
) const

Moves the control point at the given index to a new location.

The available indices depends on the degree of the Bézier curve.

  • Quadratic Bézier curve (degree 2 => 3 control points):
    • 0 => start control point
    • 1 => intermediate control point
    • 2 => end control point
  • Cubic Bézier curve (degree 3 => 4 control points):
    • 0 => start control point
    • 1 or 2 => intermediate control points
    • 3 => end control point

Using indices out of this range will result in an exception.

Bézier curves with a higher degree are currently not supported.

Parameters
newLocationthe new location of the control point.
indexthe index of the control point
Returns
a copy of the Bézier curve with a moved control point.
Exceptions
InvalidArgumentExceptionwhen the index of the control point is out of range (i.e. larger than 2 or 3, depending on the degree of the Bézier curve)
Since
2024.1

◆ moveEndPoint()

std::shared_ptr< BezierCurve > luciad::BezierCurve::moveEndPoint ( Coordinate  newLocation) const

Returns a copy of the Bézier curve with a moved end point.

Parameters
newLocationthe new location of the point.
Returns
a copy of the Bézier curve with a moved end point.

◆ moveStartPoint()

std::shared_ptr< BezierCurve > luciad::BezierCurve::moveStartPoint ( Coordinate  newLocation) const

Returns a copy of the Bézier curve with a moved start point.

Parameters
newLocationthe new location of the point.
Returns
a copy of the Bézier curve with a moved start point.