| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
|
|
| #ifndef LC_Parabola_H |
| #define LC_Parabola_H |
| #include <vector> |
|
|
| #include "lc_quadratic.h" |
| #include "lc_splinepoints.h" |
| #include "rs_vector.h" |
|
|
| class RS_Line; |
| struct RS_LineData; |
|
|
| |
| |
| |
| |
| struct LC_ParabolaData |
| { |
| |
| |
| |
| static std::vector<LC_ParabolaData> From4Points(const std::vector<RS_Vector>& points); |
| static LC_ParabolaData FromEndPointsTangents( |
| const std::array<RS_Vector, 2>& endPoints, |
| const std::array<RS_Vector, 2>& endTangents); |
| LC_ParabolaData() = default; |
| LC_ParabolaData(std::array<RS_Vector, 3> controlPoints); |
| RS_LineData GetAxis() const; |
| RS_LineData GetDirectrix() const; |
| RS_Vector GetFocus() const; |
|
|
|
|
| |
| |
| |
| |
| LC_Quadratic getQuadratic() const; |
| double FindX(const RS_Vector& point) const; |
| RS_Vector FromX(double x) const; |
| |
| |
| |
| |
| |
| std::array<RS_Vector, 2> FromXWithTangent(double x) const; |
|
|
| |
| std::array<RS_Vector, 3> controlPoints; |
| void CalculatePrimitives(); |
| |
| RS_Vector focus; |
| |
| RS_Vector axis; |
| RS_Vector vertex; |
| |
| bool valid = false; |
| }; |
|
|
| std::ostream& operator << (std::ostream& os, const LC_ParabolaData& ld); |
|
|
| |
| |
| |
| |
| |
| class LC_Parabola : public LC_SplinePoints |
| { |
| private: |
| LC_ParabolaData data; |
|
|
| public: |
| LC_Parabola(RS_EntityContainer* parent, const LC_ParabolaData& d); |
|
|
| RS_Entity* clone() const override; |
|
|
| |
| RS2::EntityType rtti() const override; |
|
|
| |
| bool isEdge() const override |
| { |
| return true; |
| } |
|
|
| |
| LC_ParabolaData const& getData() const |
| { |
| return data; |
| } |
| LC_ParabolaData& getData() |
| { |
| return data; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| LC_Quadratic getQuadratic() const override; |
| RS_VectorSolutions getRefPoints() const override; |
|
|
| RS_Vector getTangentDirection(const RS_Vector& point)const override; |
| |
| RS_VectorSolutions getTangentPoint(const RS_Vector& point) const override; |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| RS_Vector getNearestOrthTan(const RS_Vector& coord, |
| const RS_Line& normal, |
| bool onEntity ) const override; |
|
|
| RS_Vector dualLineTangentPoint(const RS_Vector& line) const override; |
| RS2::Ending getTrimPoint(const RS_Vector& trimCoord, |
| const RS_Vector& trimPoint) override; |
| RS_Vector prepareTrim(const RS_Vector& trimCoord, |
| const RS_VectorSolutions& trimSol) override; |
|
|
| double getDirection1() const override; |
| double getDirection2() const override; |
|
|
| void moveStartpoint(const RS_Vector& pos) override; |
| void moveEndpoint(const RS_Vector& pos) override; |
|
|
| void update() override; |
|
|
| void move(const RS_Vector& offset) override; |
| void rotate(const RS_Vector& center, double angle) override; |
| void rotate(const RS_Vector& center, const RS_Vector& angleVector) override; |
| void scale(const RS_Vector& center, const RS_Vector& factor) override; |
| void mirror(const RS_Vector& axisPoint1, const RS_Vector& axisPoint2) override; |
| RS_Entity& shear(double k) override; |
|
|
| void moveRef(const RS_Vector& ref, const RS_Vector& offset) override; |
| void revertDirection() override; |
| double getLength() const override; |
|
|
| |
| |
| |
| |
| |
| |
| double areaLineIntegral() const override; |
|
|
|
|
| |
| |
| |
| |
| |
| |
| std::unique_ptr<LC_Parabola> approximateOffset(double dist) const; |
|
|
| private: |
| |
| |
| RS_Vector rotateToQuadratic(RS_Vector vp) const; |
| }; |
|
|
| #endif |
|
|