File indexing completed on 2026-09-28 09:20:02
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _Geom2dEval_RepCurveDesc_HeaderFile
0015 #define _Geom2dEval_RepCurveDesc_HeaderFile
0016
0017 #include <Geom2d_Curve.hxx>
0018 #include <Precision.hxx>
0019 #include <Standard_Transient.hxx>
0020
0021 #include <cmath>
0022 #include <cstddef>
0023 #include <optional>
0024
0025 namespace Geom2dEval_RepCurveDesc
0026 {
0027
0028 struct Map1d
0029 {
0030 double Scale = 1.0;
0031 double Offset = 0.0;
0032
0033 bool IsIdentity() const
0034 {
0035 return std::abs(Scale - 1.0) < Precision::Confusion()
0036 && std::abs(Offset) < Precision::Confusion();
0037 }
0038
0039 bool IsValid() const { return std::abs(Scale) > Precision::Confusion(); }
0040
0041 double Map(const double theU) const { return Scale * theU + Offset; }
0042 };
0043
0044
0045 struct Domain1d
0046 {
0047 double First = 0.0;
0048 double Last = 1.0;
0049
0050 bool Contains(const double theU) const
0051 {
0052 return (theU >= First - Precision::Confusion()) && (theU <= Last + Precision::Confusion());
0053 }
0054 };
0055
0056
0057
0058 class Base : public Standard_Transient
0059 {
0060 public:
0061
0062 enum class Kind
0063 {
0064 Full,
0065 DerivBounded,
0066 Mapped
0067 };
0068
0069 occ::handle<Geom2d_Curve> Representation;
0070
0071
0072 virtual Kind GetKind() const = 0;
0073
0074 DEFINE_STANDARD_RTTI_INLINE(Base, Standard_Transient)
0075
0076 protected:
0077 Base() = default;
0078 };
0079
0080
0081
0082 class Full : public Base
0083 {
0084 public:
0085 Kind GetKind() const override { return Kind::Full; }
0086
0087 DEFINE_STANDARD_RTTI_INLINE(Full, Base)
0088 };
0089
0090
0091 class DerivBounded : public Base
0092 {
0093 public:
0094 std::size_t MaxDerivOrder = 3;
0095
0096 Kind GetKind() const override { return Kind::DerivBounded; }
0097
0098 DEFINE_STANDARD_RTTI_INLINE(DerivBounded, Base)
0099 };
0100
0101
0102
0103 class Mapped : public Base
0104 {
0105 public:
0106 std::size_t MaxDerivOrder = 3;
0107 std::optional<Domain1d> Domain;
0108 Map1d ParamMap;
0109
0110 Kind GetKind() const override { return Kind::Mapped; }
0111
0112 DEFINE_STANDARD_RTTI_INLINE(Mapped, Base)
0113 };
0114 }
0115
0116 #endif