LibreCAD
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
geobeziercubic.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "cad/const.h"
4 #include "geoarea.h"
5 #include "geocoordinate.h"
6 #include "geobase.h"
7 #include <cad/math/lcmath.h>
8 #include <cmath>
9 #include <cstdlib>
10 #include <vector>
11 #include "geobezierbase.h"
12 
13 namespace lc {
14  namespace geo {
15  class CubicBezier : public BezierBase {
16  public:
20  CubicBezier(const Coordinate& point_a, const Coordinate& point_b, const Coordinate& point_c, const Coordinate& point_d);
21 
22  CubicBezier(const CubicBezier &bez);
23 
28  virtual const std::vector<Coordinate> getCP() const override;
29 
34  virtual const Area boundingBox() const override ;
35 
41  virtual Coordinate nearestPointOnPath(const Coordinate& coord) const override;
42 
48  virtual Coordinate nearestPointOnEntity(const Coordinate& coord) const override;
49 
56  virtual Coordinate CasteljauAt(std::vector<Coordinate> points, double t) const override;
57 
63  virtual Coordinate DirectValueAt(double t) const override;
64 
70  virtual const std::vector<Coordinate> Curve(double precession) override;
71 
76  virtual const double length() const override;
77 
83  virtual const Coordinate tangent(double t) const override;
84 
90  virtual const Coordinate normal(double t) const override;
91 
96  virtual std::vector<BB_CSPtr> splitHalf() const override;
97 
103  virtual BB_CSPtr splitAtT(double t) const override;
104 
110  virtual BB_CSPtr offset(const geo::Coordinate& offset) const override;
111 
118  virtual BB_CSPtr rotate(const geo::Coordinate& center, double angle) const override;
119 
126  virtual BB_CSPtr scale(const geo::Coordinate& center, const geo::Coordinate& factor) const override;
132  virtual BB_CSPtr move(const geo::Coordinate& offset) const override;
139  virtual BB_CSPtr mirror(const geo::Coordinate& axis1, const geo::Coordinate& axis2) const override;
140 
141  private:
142 
143  virtual std::vector<double> nearestPointTValue(const Coordinate &coord) const override;
145  double min_distance, const lc::geo::Coordinate &coord,
146  const Coordinate &ret) const override;
147  private:
152  };
153  }
154 }
virtual BB_CSPtr rotate(const geo::Coordinate &center, double angle) const override
rotate the bezier at specific center and some angle
virtual BB_CSPtr splitAtT(double t) const override
splitAtT Splits bezier at specific time.
virtual const lc::geo::Coordinate returnCasesForNearestPoint(double min_distance, const lc::geo::Coordinate &coord, const Coordinate &ret) const override
Bezier::returnCasesForNearestPoint.
virtual BB_CSPtr scale(const geo::Coordinate &center, const geo::Coordinate &factor) const override
scale the bezier at specific center by some factor
virtual const std::vector< Coordinate > Curve(double precession) override
Curve Creates a bezier curve for drawing with some precession value.
virtual BB_CSPtr mirror(const geo::Coordinate &axis1, const geo::Coordinate &axis2) const override
mirror a bezier around a line
virtual Coordinate nearestPointOnEntity(const Coordinate &coord) const override
nearestPointOnEntity of the bezier
virtual std::vector< double > nearestPointTValue(const Coordinate &coord) const override
Bezier::nearestPointTValue.
Definition: cadentity.h:12
virtual const std::vector< Coordinate > getCP() const override
getCP Returns the control points of the bezier
virtual BB_CSPtr move(const geo::Coordinate &offset) const override
move the bezeir by some offset
virtual const Coordinate tangent(double t) const override
tangent of the bezeir
std::shared_ptr< const BezierBase > BB_CSPtr
Definition: geobezierbase.h:15
virtual BB_CSPtr offset(const geo::Coordinate &offset) const override
offset offsets the bezier.
virtual Coordinate DirectValueAt(double t) const override
DirectValueAt Coordinate of bezier at time t calculated numerically.
virtual std::vector< BB_CSPtr > splitHalf() const override
splitHalf Splits the bezier into two halves.
virtual Coordinate nearestPointOnPath(const Coordinate &coord) const override
nearestPointOnPath of the bezier
virtual Coordinate CasteljauAt(std::vector< Coordinate > points, double t) const override
CasteljauAt Coordinate of bezier at time t.
CubicBezier(const Coordinate &point_a, const Coordinate &point_b, const Coordinate &point_c, const Coordinate &point_d)
virtual const Coordinate normal(double t) const override
normal of the bezier at time t
virtual const double length() const override
length of the Bezier
virtual const Area boundingBox() const override
boundingBox of the bezier