1 // AppDef_MyLineTool.cxx
3 #include <AppDef_MyLineTool.ixx>
4 #include <AppDef_MultiPointConstraint.hxx>
6 #include <gp_Pnt2d.hxx>
8 #include <gp_Vec2d.hxx>
10 Standard_Integer AppDef_MyLineTool::FirstPoint(const AppDef_MultiLine&)
15 Standard_Integer AppDef_MyLineTool::LastPoint(const AppDef_MultiLine& ML)
17 return ML.NbMultiPoints();
20 Standard_Integer AppDef_MyLineTool::NbP2d(const AppDef_MultiLine& ML)
22 return ML.Value(1).NbPoints2d();
25 Standard_Integer AppDef_MyLineTool::NbP3d(const AppDef_MultiLine& ML)
27 return ML.Value(1).NbPoints();
31 void AppDef_MyLineTool::Value(const AppDef_MultiLine& ML,
32 const Standard_Integer MPointIndex,
33 TColgp_Array1OfPnt& tabPt)
35 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
36 Standard_Integer nbp3d = MPC.NbPoints(), low = tabPt.Lower();
37 for (Standard_Integer i = 1; i <= nbp3d; i++) {
38 tabPt(i+low-1) = MPC.Point(i);
42 void AppDef_MyLineTool::Value(const AppDef_MultiLine& ML,
43 const Standard_Integer MPointIndex,
44 TColgp_Array1OfPnt2d& tabPt2d)
46 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
47 Standard_Integer nbp2d = MPC.NbPoints2d(), low = tabPt2d.Lower();
48 for (Standard_Integer i = 1; i <= nbp2d; i++) {
49 tabPt2d(i+low-1) = MPC.Point2d(i);
53 void AppDef_MyLineTool::Value(const AppDef_MultiLine& ML,
54 const Standard_Integer MPointIndex,
55 TColgp_Array1OfPnt& tabPt,
56 TColgp_Array1OfPnt2d& tabPt2d)
58 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
59 Standard_Integer i, nbp2d = MPC.NbPoints2d(), low2d = tabPt2d.Lower();
60 Standard_Integer nbp3d = MPC.NbPoints(), low = tabPt.Lower();
61 for (i = 1; i <= nbp3d; i++) {
62 tabPt(i+low-1) = MPC.Point(i);
64 for (i = 1; i <= nbp2d; i++) {
65 tabPt2d(i+low2d-1) = MPC.Point2d(nbp3d+i);
70 Standard_Boolean AppDef_MyLineTool::Tangency(const AppDef_MultiLine& ML,
71 const Standard_Integer MPointIndex,
72 TColgp_Array1OfVec& tabV)
74 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
75 if (MPC.IsTangencyPoint()) {
76 Standard_Integer nbp3d = MPC.NbPoints(), low = tabV.Lower();
77 for (Standard_Integer i = 1; i <= nbp3d; i++) {
78 tabV(i+low-1) = MPC.Tang(i);
82 else return Standard_False;
85 Standard_Boolean AppDef_MyLineTool::Tangency(const AppDef_MultiLine& ML,
86 const Standard_Integer MPointIndex,
87 TColgp_Array1OfVec2d& tabV2d)
89 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
90 if (MPC.IsTangencyPoint()) {
91 Standard_Integer nbp2d = MPC.NbPoints2d(), low = tabV2d.Lower();
92 for (Standard_Integer i = 1; i <= nbp2d; i++) {
93 tabV2d(i+low-1) = MPC.Tang2d(i);
97 else return Standard_False;
100 Standard_Boolean AppDef_MyLineTool::Tangency(const AppDef_MultiLine& ML,
101 const Standard_Integer MPointIndex,
102 TColgp_Array1OfVec& tabV,
103 TColgp_Array1OfVec2d& tabV2d)
105 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
106 if (MPC.IsTangencyPoint()) {
107 Standard_Integer i, nbp3d = MPC.NbPoints(), low = tabV.Lower();
108 Standard_Integer nbp2d = MPC.NbPoints2d(), low2d = tabV2d.Lower();
109 for (i = 1; i <= nbp3d; i++) {
110 tabV(i+low-1) = MPC.Tang(i);
112 for (i = 1; i <= nbp2d; i++) {
113 tabV2d(i+low2d-1) = MPC.Tang2d(nbp3d+i);
115 return Standard_True;
117 else return Standard_False;
122 AppDef_MultiLine& AppDef_MyLineTool::MakeMLBetween(const AppDef_MultiLine&,
123 const Standard_Integer ,
124 const Standard_Integer ,
125 const Standard_Integer )
127 return *((AppDef_MultiLine*) 0);
130 Approx_Status AppDef_MyLineTool::WhatStatus(const AppDef_MultiLine&,
131 const Standard_Integer,
132 const Standard_Integer)
134 return Approx_NoPointsAdded;
138 Standard_Boolean AppDef_MyLineTool::Curvature(const AppDef_MultiLine& ML,
139 const Standard_Integer MPointIndex,
140 TColgp_Array1OfVec& tabV)
142 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
143 if (MPC.IsCurvaturePoint()) {
144 Standard_Integer nbp3d = MPC.NbPoints(), low = tabV.Lower();
145 for (Standard_Integer i = 1; i <= nbp3d; i++) {
146 tabV(i+low-1) = MPC.Curv(i);
148 return Standard_True;
150 else return Standard_False;
153 Standard_Boolean AppDef_MyLineTool::Curvature(const AppDef_MultiLine& ML,
154 const Standard_Integer MPointIndex,
155 TColgp_Array1OfVec2d& tabV2d)
157 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
158 if (MPC.IsCurvaturePoint()) {
159 Standard_Integer nbp2d = MPC.NbPoints2d(), low = tabV2d.Lower();
160 for (Standard_Integer i = 1; i <= nbp2d; i++) {
161 tabV2d(i+low-1) = MPC.Curv2d(i);
163 return Standard_True;
165 else return Standard_False;
169 Standard_Boolean AppDef_MyLineTool::Curvature(const AppDef_MultiLine& ML,
170 const Standard_Integer MPointIndex,
171 TColgp_Array1OfVec& tabV,
172 TColgp_Array1OfVec2d& tabV2d)
175 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
176 if (MPC.IsCurvaturePoint()) {
177 Standard_Integer i, nbp3d = MPC.NbPoints(), low = tabV.Lower();
178 Standard_Integer nbp2d = MPC.NbPoints2d(), low2d = tabV2d.Lower();
179 for (i = 1; i <= nbp3d; i++) {
180 tabV(i+low-1) = MPC.Curv(i);
182 for (i = 1; i <= nbp2d; i++) {
183 tabV2d(i+low2d-1) = MPC.Curv2d(nbp3d+i);
185 return Standard_True;
187 else return Standard_False;