summaryrefslogtreecommitdiff
path: root/src/Geom2dLProp/Geom2dLProp_CurAndInf2d.cxx
blob: 0ae5352369fed15222912d6b362fd72a8a0666b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
// File:	Geom2dLProp_CurAndInf2d.cxx
// Created:	Tue Sep  6 15:14:52 1994
// Author:	Yves FRICAUD
//		<yfr@ecolox>


#include <Geom2dLProp_CurAndInf2d.ixx>
#include <Geom2dLProp_NumericCurInf2d.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <LProp_AnalyticCurInf.hxx>
#include <gp_Lin2d.hxx>
#include <gp_Circ2d.hxx>
#include <gp_Elips2d.hxx>
#include <gp_Hypr2d.hxx>
#include <gp_Parab2d.hxx>
#include <TColStd_Array1OfReal.hxx>



//=======================================================================
//function : Geom2dLProp_CurAndInf2d
//purpose  : 
//=======================================================================
Geom2dLProp_CurAndInf2d::Geom2dLProp_CurAndInf2d()
{
}


//=======================================================================
//function : Perform
//purpose  : 
//=======================================================================

void Geom2dLProp_CurAndInf2d::Perform(const Handle(Geom2d_Curve)& C)
{
  PerformCurExt(C);
  PerformInf   (C);
}


//=======================================================================
//function : PerformCurExt
//purpose  : 
//=======================================================================

void Geom2dLProp_CurAndInf2d::PerformCurExt(const Handle(Geom2d_Curve)& C)
{
  isDone = Standard_True;

  Geom2dAdaptor_Curve         CC(C);
  LProp_AnalyticCurInf        AC;
  Geom2dLProp_NumericCurInf2d NC;
  GeomAbs_CurveType           CType = CC.GetType();

  switch (CType) {
  case GeomAbs_Line: 
    break;
  case GeomAbs_Circle:
    break;
  case GeomAbs_Ellipse:
    AC.Perform(CType,CC.FirstParameter(),CC.LastParameter(),*this);
    break;
  case GeomAbs_Hyperbola:
    AC.Perform(CType,CC.FirstParameter(),CC.LastParameter(),*this);
    break;
  case GeomAbs_Parabola:
    AC.Perform(CType,CC.FirstParameter(),CC.LastParameter(),*this);
    break;
  case GeomAbs_BSplineCurve:
    if (CC.Continuity() >= GeomAbs_C3 ) {
      NC.PerformCurExt(C,*this);
      isDone = NC.IsDone();
    }
    else {
      // Decoupage en intervalles C3.
      isDone = Standard_True;
      Standard_Integer NbInt = CC.NbIntervals(GeomAbs_C3);
      TColStd_Array1OfReal Param(1,NbInt+1);
      CC.Intervals(Param,GeomAbs_C3);
      for (Standard_Integer i = 1; i <= NbInt; i++) {
	NC.PerformCurExt(C,Param(i),Param(i+1),*this);
	if (!NC.IsDone()) {isDone = Standard_False;}
      }
    }
    break;

    default : {
      NC.PerformCurExt(C,*this);
      isDone = NC.IsDone();
    }
    break;
  }
  
}


//=======================================================================
//function : PerformInf
//purpose  : 
//=======================================================================

void Geom2dLProp_CurAndInf2d::PerformInf(const Handle(Geom2d_Curve)& C)
{
  isDone = Standard_True;

  Geom2dAdaptor_Curve  CC(C);
  GeomAbs_CurveType    CType = CC.GetType();
  Geom2dLProp_NumericCurInf2d NC;

  switch (CType) {
  case GeomAbs_Line:
    break;
  case GeomAbs_Circle:
    break;
  case GeomAbs_Ellipse:
      break;
  case GeomAbs_Hyperbola:
    break;
  case GeomAbs_Parabola:
    break;
  case GeomAbs_BSplineCurve:
    if (CC.Continuity() >= GeomAbs_C3 ) {
      NC.PerformInf(C,*this);
      isDone = NC.IsDone();
    }
    else {
      // Decoupage en intervalles C3.
      isDone = Standard_True;
      Standard_Integer NbInt = CC.NbIntervals(GeomAbs_C3);
      TColStd_Array1OfReal Param(1,NbInt+1);
      CC.Intervals(Param,GeomAbs_C3);

      for (Standard_Integer i = 1; i <= NbInt; i++) {
	NC.PerformInf(C,Param(i),Param(i+1),*this);
	if (!NC.IsDone()) {isDone = Standard_False;}
      }
    }
    break;

    default : {
      NC.PerformInf(C,*this);
      isDone = NC.IsDone();
    }
    break;
  }  
}


//=======================================================================
//function : IsDone
//purpose  : 
//=======================================================================

Standard_Boolean Geom2dLProp_CurAndInf2d::IsDone() const 
{
  return isDone;
}